[PATCH 1/2] tools: mkimage: Update U-Boot to version 2021.01

Hauke Mehrtens hauke at hauke-m.de
Sun Jan 31 18:32:09 EST 2021


* The fit image is now created with 0666 permission in upstream U-Boot
  remove our patch switch creates it with 0744
* The generated/autoconf.h file is created now as an empty file, it is
  not needed to remove this include any more.
* Upstream lib/rsa/rsa-sign.c now includes stdlib.h instead of malloc.h
* ALIGN_MASK was moved to imagetool.h, own patch should not be needed
  any more.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---

Could someone test this on MacOS please.

 tools/mkimage/Makefile                        |  6 +++--
 .../patches/020-fix-file-creation-perms.patch | 11 --------
 .../030-allow-to-use-different-magic.patch    | 14 +++++-----
 ...d-compatibility-with-non-Linux-hosts.patch | 26 -------------------
 .../070-remove_generated_autoconf.patch       | 10 -------
 .../patches/210-link-libcrypto-static.patch   |  4 +--
 6 files changed, 13 insertions(+), 58 deletions(-)
 delete mode 100644 tools/mkimage/patches/020-fix-file-creation-perms.patch
 delete mode 100644 tools/mkimage/patches/070-remove_generated_autoconf.patch

diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile
index 90ecdaaa6e57..6901d921cfc6 100644
--- a/tools/mkimage/Makefile
+++ b/tools/mkimage/Makefile
@@ -7,14 +7,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mkimage
-PKG_VERSION:=2020.04
+PKG_VERSION:=2021.01
 
 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
 	https://mirror.cyberbits.eu/u-boot \
 	https://ftp.denx.de/pub/u-boot \
 	ftp://ftp.denx.de/pub/u-boot
-PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
+PKG_HASH:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454
 
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION)
 
@@ -24,6 +24,8 @@ define Host/Prepare
 	$(Host/Prepare/Default)
 	mkdir -p $(HOST_BUILD_DIR)/include/config
 	touch $(HOST_BUILD_DIR)/include/config/auto.conf
+	mkdir -p $(HOST_BUILD_DIR)/include/generated/
+	touch $(HOST_BUILD_DIR)/include/generated/autoconf.h
 endef
 
 define Host/Compile
diff --git a/tools/mkimage/patches/020-fix-file-creation-perms.patch b/tools/mkimage/patches/020-fix-file-creation-perms.patch
deleted file mode 100644
index 80cda288ab3d..000000000000
--- a/tools/mkimage/patches/020-fix-file-creation-perms.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/tools/fit_image.c
-+++ b/tools/fit_image.c
-@@ -642,7 +642,7 @@ static int copyfile(const char *src, con
- 		goto out;
- 	}
- 
--	fd_dst = open(dst, O_WRONLY | O_CREAT, 0700);
-+	fd_dst = open(dst, O_WRONLY | O_CREAT, 0744);
- 	if (fd_dst < 0) {
- 		printf("Can't open file %s (%s)\n", dst, strerror(errno));
- 		goto out;
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 8d79de29921a..3a1677d54ddb 100644
--- a/tools/mkimage/patches/030-allow-to-use-different-magic.patch
+++ b/tools/mkimage/patches/030-allow-to-use-different-magic.patch
@@ -2,7 +2,7 @@ This patch makes it possible to set a custom image magic.
 
 --- a/tools/mkimage.c
 +++ b/tools/mkimage.c
-@@ -20,6 +20,7 @@ static struct image_tool_params params =
+@@ -21,6 +21,7 @@ static struct image_tool_params params =
  	.arch = IH_ARCH_PPC,
  	.type = IH_TYPE_KERNEL,
  	.comp = IH_COMP_GZIP,
@@ -10,7 +10,7 @@ This patch makes it possible to set a custom image magic.
  	.dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
  	.imagename = "",
  	.imagename2 = "",
-@@ -76,11 +77,12 @@ static void usage(const char *msg)
+@@ -82,11 +83,12 @@ static void usage(const char *msg)
  			 "          -l ==> list image header information\n",
  		params.cmdname);
  	fprintf(stderr,
@@ -24,16 +24,16 @@ This patch makes it possible to set a custom image magic.
  		"          -a ==> set load address to 'addr' (hex)\n"
  		"          -e ==> set entry point to 'ep' (hex)\n"
  		"          -n ==> set image name to 'name'\n"
-@@ -143,7 +145,7 @@ static void process_args(int argc, char
+@@ -150,7 +152,7 @@ static void process_args(int argc, char
  	int opt;
  
  	while ((opt = getopt(argc, argv,
--			     "a:A:b:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qsT:vVx")) != -1) {
-+			     "a:A:b:c:C:d:D:e:Ef:Fk:i:K:lM:n:N:p:O:rR:qsT:vVx")) != -1) {
+-		   "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) {
++		   "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:lM:n:N:p:O:rR:qstT:vVx")) != -1) {
  		switch (opt) {
  		case 'a':
  			params.addr = strtoull(optarg, &ptr, 16);
-@@ -221,6 +223,14 @@ static void process_args(int argc, char
+@@ -237,6 +239,14 @@ static void process_args(int argc, char
  		case 'l':
  			params.lflag = 1;
  			break;
@@ -61,7 +61,7 @@ This patch makes it possible to set a custom image magic.
  	image_set_load(hdr, addr);
 --- a/tools/imagetool.h
 +++ b/tools/imagetool.h
-@@ -53,6 +53,7 @@ struct image_tool_params {
+@@ -56,6 +56,7 @@ struct image_tool_params {
  	int arch;
  	int type;
  	int comp;
diff --git a/tools/mkimage/patches/050-Add-compatibility-with-non-Linux-hosts.patch b/tools/mkimage/patches/050-Add-compatibility-with-non-Linux-hosts.patch
index ea2e8e3da3d5..1d71f889f8d9 100644
--- a/tools/mkimage/patches/050-Add-compatibility-with-non-Linux-hosts.patch
+++ b/tools/mkimage/patches/050-Add-compatibility-with-non-Linux-hosts.patch
@@ -35,21 +35,6 @@ Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
  #include <stdbool.h>
  
  /* Define this to avoid #ifdefs later on */
---- a/include/imx8image.h
-+++ b/include/imx8image.h
-@@ -11,7 +11,12 @@
- #include <image.h>
- #include <inttypes.h>
- #include "imagetool.h"
-+#ifdef linux
- #include "linux/kernel.h"
-+#else
-+#define ALIGN(x,a)		__ALIGN_MASK((x),(typeof(x))(a)-1)
-+#define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))
-+#endif
- 
- #define __packed   __attribute__((packed))
- 
 --- a/include/linux/posix_types.h
 +++ b/include/linux/posix_types.h
 @@ -43,6 +43,8 @@ typedef void (*__kernel_sighandler_t)(in
@@ -82,14 +67,3 @@ Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
  typedef __u64 __bitwise __le64;
  typedef __u64 __bitwise __be64;
  #endif
---- a/lib/rsa/rsa-sign.c
-+++ b/lib/rsa/rsa-sign.c
-@@ -4,7 +4,7 @@
-  */
- 
- #include "mkimage.h"
--#include <malloc.h>
-+#include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <image.h>
diff --git a/tools/mkimage/patches/070-remove_generated_autoconf.patch b/tools/mkimage/patches/070-remove_generated_autoconf.patch
deleted file mode 100644
index 7dcc8b64c127..000000000000
--- a/tools/mkimage/patches/070-remove_generated_autoconf.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/tools/imximage.c
-+++ b/tools/imximage.c
-@@ -11,7 +11,6 @@
- #include "imagetool.h"
- #include <image.h>
- #include "imximage.h"
--#include <generated/autoconf.h>
- 
- #define UNDEFINED 0xFFFFFFFF
- 
diff --git a/tools/mkimage/patches/210-link-libcrypto-static.patch b/tools/mkimage/patches/210-link-libcrypto-static.patch
index c609912be903..87a425bd9450 100644
--- a/tools/mkimage/patches/210-link-libcrypto-static.patch
+++ b/tools/mkimage/patches/210-link-libcrypto-static.patch
@@ -3,10 +3,10 @@ needed dependencies are added too.
 
 --- a/tools/Makefile
 +++ b/tools/Makefile
-@@ -162,7 +162,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON
+@@ -158,7 +158,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON
  HOSTCFLAGS_kwbimage.o += \
  	$(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
- HOSTLOADLIBES_mkimage += \
+ HOSTLDLIBS_mkimage += \
 -	$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
 +	$(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
  
-- 
2.20.1




More information about the openwrt-devel mailing list