From 985d666e366bb9ef159439265f77a2ad04e08f0f Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 7 Mar 2013 17:32:29 +0000 Subject: build: BSD compile fixes following patch allows to build images for Qemu ARM on OpenBSD 5.2 amd64 and FreeBSD 9.1 amd64. Mostly small pieces of code changes to get things right on the specific platform. Updated the README to describe better, which tools on the host are required. Added some kind of prepare scripts to install needed tools on BSD via packages. Signed-off-by: Waldemar Brodkorb git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35900 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/mkimage/patches/020-openbsd_fixes.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tools/mkimage/patches/020-openbsd_fixes.patch (limited to 'tools/mkimage') diff --git a/tools/mkimage/patches/020-openbsd_fixes.patch b/tools/mkimage/patches/020-openbsd_fixes.patch new file mode 100644 index 000000000..31ee38f66 --- /dev/null +++ b/tools/mkimage/patches/020-openbsd_fixes.patch @@ -0,0 +1,19 @@ +diff -Nur u-boot-2012.04.01.orig/tools/mkimage.c u-boot-2012.04.01/tools/mkimage.c +--- u-boot-2012.04.01.orig/tools/mkimage.c Wed Apr 25 15:22:50 2012 ++++ u-boot-2012.04.01/tools/mkimage.c Wed Mar 6 17:09:29 2013 +@@ -449,6 +449,7 @@ + #if defined(_POSIX_SYNCHRONIZED_IO) && \ + !defined(__sun__) && \ + !defined(__FreeBSD__) && \ ++ !defined(__OpenBSD__) && \ + !defined(__APPLE__) + (void) fdatasync (ifd); + #else +@@ -492,6 +493,7 @@ + #if defined(_POSIX_SYNCHRONIZED_IO) && \ + !defined(__sun__) && \ + !defined(__FreeBSD__) && \ ++ !defined(__OpenBSD__) && \ + !defined(__APPLE__) + (void) fdatasync (ifd); + #else -- cgit v1.2.3 From 9f1a2f29e1259d2d3283ff373f3d50b2b200b36f Mon Sep 17 00:00:00 2001 From: luka Date: Fri, 8 Mar 2013 20:16:11 +0000 Subject: [tools] mkimage: upgrade to version 2013.01.01 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35905 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/mkimage/Makefile | 12 ++++++------ tools/mkimage/patches/010-freebsd-ulong-fix.patch | 2 +- tools/mkimage/patches/020-openbsd_fixes.patch | 9 ++++----- tools/mkimage/patches/030-allow-to-use-different-magic.patch | 12 ++++++------ tools/mkimage/patches/040-include_order.patch | 2 +- 5 files changed, 18 insertions(+), 19 deletions(-) (limited to 'tools/mkimage') diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile index 149aaa6f1..7bd731653 100644 --- a/tools/mkimage/Makefile +++ b/tools/mkimage/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2012 OpenWrt.org +# Copyright (C) 2006-2013 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mkimage -PKG_VERSION:=2012.04.01 +PKG_VERSION:=2013.01.01 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot -PKG_MD5SUM:=192bb231082d9159fb6e16de3039b6b2 +PKG_MD5SUM:=73939f78606f89a1775c7e9acb2ca617 PKG_CAT:=bzcat HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION) @@ -22,12 +22,12 @@ define Host/Prepare $(Host/Prepare/Default) rm -f \ $(HOST_BUILD_DIR)/include/errno.h \ - $(HOST_BUILD_DIR)/include/malloc.h + $(HOST_BUILD_DIR)/include/malloc.h \ + $(HOST_BUILD_DIR)/tools/.depend + touch $(HOST_BUILD_DIR)/include/config.h endef define Host/Compile - rm -f $(HOST_BUILD_DIR)/tools/.depend - touch $(HOST_BUILD_DIR)/include/config.h $(MAKE) -C $(HOST_BUILD_DIR) BUILD_DIR= BIN_FILES-y="mkimage" HOSTLDFLAGS="$(HOST_STATIC_LINKING)" tools endef diff --git a/tools/mkimage/patches/010-freebsd-ulong-fix.patch b/tools/mkimage/patches/010-freebsd-ulong-fix.patch index 32fa07453..737291466 100644 --- a/tools/mkimage/patches/010-freebsd-ulong-fix.patch +++ b/tools/mkimage/patches/010-freebsd-ulong-fix.patch @@ -1,6 +1,6 @@ --- a/include/image.h +++ b/include/image.h -@@ -50,6 +50,10 @@ +@@ -51,6 +51,10 @@ #endif /* USE_HOSTCC */ diff --git a/tools/mkimage/patches/020-openbsd_fixes.patch b/tools/mkimage/patches/020-openbsd_fixes.patch index 31ee38f66..17232360d 100644 --- a/tools/mkimage/patches/020-openbsd_fixes.patch +++ b/tools/mkimage/patches/020-openbsd_fixes.patch @@ -1,7 +1,6 @@ -diff -Nur u-boot-2012.04.01.orig/tools/mkimage.c u-boot-2012.04.01/tools/mkimage.c ---- u-boot-2012.04.01.orig/tools/mkimage.c Wed Apr 25 15:22:50 2012 -+++ u-boot-2012.04.01/tools/mkimage.c Wed Mar 6 17:09:29 2013 -@@ -449,6 +449,7 @@ +--- a/tools/mkimage.c ++++ b/tools/mkimage.c +@@ -464,6 +464,7 @@ #if defined(_POSIX_SYNCHRONIZED_IO) && \ !defined(__sun__) && \ !defined(__FreeBSD__) && \ @@ -9,7 +8,7 @@ diff -Nur u-boot-2012.04.01.orig/tools/mkimage.c u-boot-2012.04.01/tools/mkimage !defined(__APPLE__) (void) fdatasync (ifd); #else -@@ -492,6 +493,7 @@ +@@ -507,6 +508,7 @@ #if defined(_POSIX_SYNCHRONIZED_IO) && \ !defined(__sun__) && \ !defined(__FreeBSD__) && \ diff --git a/tools/mkimage/patches/030-allow-to-use-different-magic.patch b/tools/mkimage/patches/030-allow-to-use-different-magic.patch index 23f39ad22..305b8342b 100644 --- a/tools/mkimage/patches/030-allow-to-use-different-magic.patch +++ b/tools/mkimage/patches/030-allow-to-use-different-magic.patch @@ -1,14 +1,14 @@ --- a/tools/mkimage.c +++ b/tools/mkimage.c -@@ -37,6 +37,7 @@ struct mkimage_params params = { +@@ -37,6 +37,7 @@ .arch = IH_ARCH_PPC, .type = IH_TYPE_KERNEL, .comp = IH_COMP_GZIP, + .magic = IH_MAGIC, .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS, .imagename = "", - }; -@@ -186,6 +187,16 @@ main (int argc, char **argv) + .imagename2 = "", +@@ -189,6 +190,16 @@ genimg_get_comp_id (*++argv)) < 0) usage (); goto NXTARG; @@ -25,7 +25,7 @@ case 'D': if (--argc <= 0) usage (); -@@ -596,12 +607,13 @@ usage () +@@ -613,12 +624,13 @@ fprintf (stderr, "Usage: %s -l image\n" " -l ==> list image header information\n", params.cmdname); @@ -42,7 +42,7 @@ " -n ==> set image name to 'name'\n" --- a/tools/mkimage.h +++ b/tools/mkimage.h -@@ -65,6 +65,7 @@ struct mkimage_params { +@@ -65,6 +65,7 @@ int arch; int type; int comp; @@ -52,7 +52,7 @@ unsigned int ep; --- a/tools/default_image.c +++ b/tools/default_image.c -@@ -111,7 +111,7 @@ static void image_set_header(void *ptr, +@@ -111,7 +111,7 @@ sbuf->st_size - sizeof(image_header_t)); /* Build new header */ diff --git a/tools/mkimage/patches/040-include_order.patch b/tools/mkimage/patches/040-include_order.patch index 5a9d15eb7..f94e91d70 100644 --- a/tools/mkimage/patches/040-include_order.patch +++ b/tools/mkimage/patches/040-include_order.patch @@ -1,6 +1,6 @@ --- a/tools/Makefile +++ b/tools/Makefile -@@ -159,9 +159,9 @@ NOPEDOBJS := $(addprefix $(obj),$(NOPED_ +@@ -162,9 +162,9 @@ # Use native tools and options # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps # -- cgit v1.2.3 From ec948531f990a33dda24ecb46d23494b7e526828 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 9 Mar 2013 19:00:39 +0000 Subject: mkimage: unbreak build on non-linux systems git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35909 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../mkimage/patches/050-image_h_portability.patch | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/mkimage/patches/050-image_h_portability.patch (limited to 'tools/mkimage') diff --git a/tools/mkimage/patches/050-image_h_portability.patch b/tools/mkimage/patches/050-image_h_portability.patch new file mode 100644 index 000000000..1f222370b --- /dev/null +++ b/tools/mkimage/patches/050-image_h_portability.patch @@ -0,0 +1,31 @@ +--- a/include/image.h ++++ b/include/image.h +@@ -34,7 +34,6 @@ + #define __IMAGE_H__ + + #include "compiler.h" +-#include + + #ifdef USE_HOSTCC + +@@ -191,13 +190,13 @@ + * all data in network byte order (aka natural aka bigendian). + */ + typedef struct image_header { +- __be32 ih_magic; /* Image Header Magic Number */ +- __be32 ih_hcrc; /* Image Header CRC Checksum */ +- __be32 ih_time; /* Image Creation Timestamp */ +- __be32 ih_size; /* Image Data Size */ +- __be32 ih_load; /* Data Load Address */ +- __be32 ih_ep; /* Entry Point Address */ +- __be32 ih_dcrc; /* Image Data CRC Checksum */ ++ uint32_t ih_magic; /* Image Header Magic Number */ ++ uint32_t ih_hcrc; /* Image Header CRC Checksum */ ++ uint32_t ih_time; /* Image Creation Timestamp */ ++ uint32_t ih_size; /* Image Data Size */ ++ uint32_t ih_load; /* Data Load Address */ ++ uint32_t ih_ep; /* Entry Point Address */ ++ uint32_t ih_dcrc; /* Image Data CRC Checksum */ + uint8_t ih_os; /* Operating System */ + uint8_t ih_arch; /* CPU architecture */ + uint8_t ih_type; /* Image Type */ -- cgit v1.2.3 From f84b697c231ab36e0460008983dfc5645b8048e2 Mon Sep 17 00:00:00 2001 From: luka Date: Sun, 5 May 2013 20:11:04 +0000 Subject: [tools] mkimage: update to 2013.04 Signed-off-by: Luka Perkov git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36550 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/mkimage/Makefile | 4 +- tools/mkimage/patches/010-freebsd-ulong-fix.patch | 2 +- tools/mkimage/patches/020-openbsd_fixes.patch | 4 +- .../patches/030-allow-to-use-different-magic.patch | 10 +-- tools/mkimage/patches/040-include_order.patch | 14 ---- tools/mkimage/patches/100-dtc-binary.patch | 86 ++++++++++++++++++++++ 6 files changed, 96 insertions(+), 24 deletions(-) delete mode 100644 tools/mkimage/patches/040-include_order.patch create mode 100644 tools/mkimage/patches/100-dtc-binary.patch (limited to 'tools/mkimage') diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile index 7bd731653..458cca8fe 100644 --- a/tools/mkimage/Makefile +++ b/tools/mkimage/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mkimage -PKG_VERSION:=2013.01.01 +PKG_VERSION:=2013.04 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot -PKG_MD5SUM:=73939f78606f89a1775c7e9acb2ca617 +PKG_MD5SUM:=21bf962d69938ed4ed783b792b2b074e PKG_CAT:=bzcat HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION) diff --git a/tools/mkimage/patches/010-freebsd-ulong-fix.patch b/tools/mkimage/patches/010-freebsd-ulong-fix.patch index 737291466..715755b87 100644 --- a/tools/mkimage/patches/010-freebsd-ulong-fix.patch +++ b/tools/mkimage/patches/010-freebsd-ulong-fix.patch @@ -9,5 +9,5 @@ +#endif + #if defined(CONFIG_FIT) - #include #include + #include diff --git a/tools/mkimage/patches/020-openbsd_fixes.patch b/tools/mkimage/patches/020-openbsd_fixes.patch index 17232360d..4c376caad 100644 --- a/tools/mkimage/patches/020-openbsd_fixes.patch +++ b/tools/mkimage/patches/020-openbsd_fixes.patch @@ -1,6 +1,6 @@ --- a/tools/mkimage.c +++ b/tools/mkimage.c -@@ -464,6 +464,7 @@ +@@ -464,6 +464,7 @@ NXTARG: ; #if defined(_POSIX_SYNCHRONIZED_IO) && \ !defined(__sun__) && \ !defined(__FreeBSD__) && \ @@ -8,7 +8,7 @@ !defined(__APPLE__) (void) fdatasync (ifd); #else -@@ -507,6 +508,7 @@ +@@ -507,6 +508,7 @@ NXTARG: ; #if defined(_POSIX_SYNCHRONIZED_IO) && \ !defined(__sun__) && \ !defined(__FreeBSD__) && \ diff --git a/tools/mkimage/patches/030-allow-to-use-different-magic.patch b/tools/mkimage/patches/030-allow-to-use-different-magic.patch index 305b8342b..14397964b 100644 --- a/tools/mkimage/patches/030-allow-to-use-different-magic.patch +++ b/tools/mkimage/patches/030-allow-to-use-different-magic.patch @@ -1,6 +1,6 @@ --- a/tools/mkimage.c +++ b/tools/mkimage.c -@@ -37,6 +37,7 @@ +@@ -37,6 +37,7 @@ struct mkimage_params params = { .arch = IH_ARCH_PPC, .type = IH_TYPE_KERNEL, .comp = IH_COMP_GZIP, @@ -8,7 +8,7 @@ .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS, .imagename = "", .imagename2 = "", -@@ -189,6 +190,16 @@ +@@ -189,6 +190,16 @@ main (int argc, char **argv) genimg_get_comp_id (*++argv)) < 0) usage (); goto NXTARG; @@ -25,7 +25,7 @@ case 'D': if (--argc <= 0) usage (); -@@ -613,12 +624,13 @@ +@@ -613,12 +624,13 @@ usage () fprintf (stderr, "Usage: %s -l image\n" " -l ==> list image header information\n", params.cmdname); @@ -42,7 +42,7 @@ " -n ==> set image name to 'name'\n" --- a/tools/mkimage.h +++ b/tools/mkimage.h -@@ -65,6 +65,7 @@ +@@ -65,6 +65,7 @@ struct mkimage_params { int arch; int type; int comp; @@ -52,7 +52,7 @@ unsigned int ep; --- a/tools/default_image.c +++ b/tools/default_image.c -@@ -111,7 +111,7 @@ +@@ -111,7 +111,7 @@ static void image_set_header(void *ptr, sbuf->st_size - sizeof(image_header_t)); /* Build new header */ diff --git a/tools/mkimage/patches/040-include_order.patch b/tools/mkimage/patches/040-include_order.patch deleted file mode 100644 index f94e91d70..000000000 --- a/tools/mkimage/patches/040-include_order.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -162,9 +162,9 @@ - # Use native tools and options - # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps - # --HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \ -+HOSTCPPFLAGS = -I $(SRCTREE)/include \ - -idirafter $(OBJTREE)/include2 \ -- -idirafter $(OBJTREE)/include \ -+ -I $(OBJTREE)/include \ - -I $(SRCTREE)/lib/libfdt \ - -I $(SRCTREE)/tools \ - -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \ diff --git a/tools/mkimage/patches/100-dtc-binary.patch b/tools/mkimage/patches/100-dtc-binary.patch new file mode 100644 index 000000000..50341198b --- /dev/null +++ b/tools/mkimage/patches/100-dtc-binary.patch @@ -0,0 +1,86 @@ +--- a/doc/mkimage.1 ++++ b/doc/mkimage.1 +@@ -82,6 +82,10 @@ + .B Create FIT image: + + .TP ++.BI "\-B [" "dtc bin" "]" ++Set path to the device tree compiler binary. ++ ++.TP + .BI "\-D [" "dtc options" "]" + Provide special options to the device tree compiler that is used to + create the image. +--- a/tools/fit_image.c ++++ b/tools/fit_image.c +@@ -82,7 +82,8 @@ + + /* dtc -I dts -O dtb -p 500 datafile > tmpfile */ + sprintf (cmd, "%s %s %s > %s", +- MKIMAGE_DTC, params->dtc, params->datafile, tmpfile); ++ params->dtc_bin, params->dtc_options, params->datafile, ++ tmpfile); + debug ("Trying to execute \"%s\"\n", cmd); + if (system (cmd) == -1) { + fprintf (stderr, "%s: system(%s) failed: %s\n", +--- a/tools/mkimage.c ++++ b/tools/mkimage.c +@@ -38,7 +38,8 @@ + .type = IH_TYPE_KERNEL, + .comp = IH_COMP_GZIP, + .magic = IH_MAGIC, +- .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS, ++ .dtc_bin = MKIMAGE_DTC, ++ .dtc_options = MKIMAGE_DEFAULT_DTC_OPTIONS, + .imagename = "", + .imagename2 = "", + }; +@@ -200,10 +201,15 @@ + params.cmdname, *argv); + } + goto NXTARG; ++ case 'B': ++ if (--argc <= 0) ++ usage (); ++ params.dtc_bin = *++argv; ++ goto NXTARG; + case 'D': + if (--argc <= 0) + usage (); +- params.dtc = *++argv; ++ params.dtc_options = *++argv; + goto NXTARG; + + case 'O': +@@ -637,7 +643,9 @@ + " -d ==> use image data from 'datafile'\n" + " -x ==> set XIP (execute in place)\n", + params.cmdname); +- fprintf (stderr, " %s [-D dtc_options] -f fit-image.its fit-image\n", ++ fprintf (stderr, " %s [-B dtc_bin] [-D dtc_options] -f fit-image.its fit-image\n", ++ " -B ==> set path to the dtc binary\n", ++ " -D ==> set options that will be passed to dtc\n", + params.cmdname); + fprintf (stderr, " %s -V ==> print version information and exit\n", + params.cmdname); +--- a/tools/mkimage.h ++++ b/tools/mkimage.h +@@ -46,7 +46,7 @@ + #define MKIMAGE_MAX_TMPFILE_LEN 256 + #define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500" + #define MKIMAGE_MAX_DTC_CMDLINE_LEN 512 +-#define MKIMAGE_DTC "dtc" /* assume dtc is in $PATH */ ++#define MKIMAGE_DTC "dtc" + + /* + * This structure defines all such variables those are initialized by +@@ -66,7 +66,8 @@ + int type; + int comp; + unsigned int magic; +- char *dtc; ++ char *dtc_bin; ++ char *dtc_options; + unsigned int addr; + unsigned int ep; + char *imagename; -- cgit v1.2.3 From bb735bed5c96cf3f730df123f488949e54bd3776 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 6 May 2013 10:30:29 +0000 Subject: tools/mkimage: unbreak non-linux build again Signed-off-by: Felix Fietkau git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36556 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/060-remove_kernel_includes.patch | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tools/mkimage/patches/060-remove_kernel_includes.patch (limited to 'tools/mkimage') diff --git a/tools/mkimage/patches/060-remove_kernel_includes.patch b/tools/mkimage/patches/060-remove_kernel_includes.patch new file mode 100644 index 000000000..b408bb10f --- /dev/null +++ b/tools/mkimage/patches/060-remove_kernel_includes.patch @@ -0,0 +1,35 @@ +--- a/include/compiler.h ++++ b/include/compiler.h +@@ -53,6 +53,11 @@ + typedef uint16_t __u16; + typedef uint32_t __u32; + typedef unsigned int uint; ++typedef uint64_t __u64; ++#ifndef linux ++typedef int __kernel_daddr_t; ++typedef unsigned int __kernel_ino_t; ++#endif + + #define uswap_16(x) \ + ((((x) & 0xff00) >> 8) | \ +--- a/include/linux/posix_types.h ++++ b/include/linux/posix_types.h +@@ -43,6 +43,8 @@ + /* Type of a SYSV IPC key. */ + typedef int __kernel_key_t; + ++#ifdef linux + #include ++#endif + + #endif /* _LINUX_POSIX_TYPES_H */ +--- a/include/linux/types.h ++++ b/include/linux/types.h +@@ -6,7 +6,6 @@ + #endif + + #include +-#include + #include + + #ifndef __KERNEL_STRICT_NAMES -- cgit v1.2.3