From b6385a36680b6924239cbc6766a253cab45db8d9 Mon Sep 17 00:00:00 2001 From: Huangbin Zhan Date: Fri, 26 Nov 2021 08:38:31 +0800 Subject: [PATCH] tools/mkimage: update to 2021.10 Changelog: - upstream now needs OpenSSL in order to be able to sign FITs. See: commit cb9faa6f98ae ("tools: Use a single target-independent config to enable OpenSSL") - removes upstream patches. Link: https://github.com/u-boot/u-boot/commit/cb9faa6f98ae56d70d59505dad290dd3d381cb7b Tested-by: Sergey V. Lobanov Signed-off-by: Huangbin Zhan Signed-off-by: Christian Lamparter --- tools/mkimage/Makefile | 5 +- .../030-allow-to-use-different-magic.patch | 12 +- ...d-compatibility-with-non-Linux-hosts.patch | 4 +- ...add-support-for-booting-ARM64-images.patch | 134 ----------- ...n-option-to-set-device-header-offset.patch | 226 ------------------ .../patches/090-macos-arm64-builing-fix.patch | 30 +-- 6 files changed, 12 insertions(+), 399 deletions(-) delete mode 100644 tools/mkimage/patches/080-mtk_image-add-support-for-booting-ARM64-images.patch delete mode 100644 tools/mkimage/patches/081-mtk_image-add-an-option-to-set-device-header-offset.patch diff --git a/tools/mkimage/Makefile b/tools/mkimage/Makefile index 1eb713a22a..5ed4107e1d 100644 --- a/tools/mkimage/Makefile +++ b/tools/mkimage/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mkimage -PKG_VERSION:=2021.01 +PKG_VERSION:=2021.10 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:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454 +PKG_HASH:=cde723e19262e646f2670d25e5ec4b1b368490de950d4e26275a988c36df0bd4 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION) @@ -38,6 +38,7 @@ define Host/Compile CONFIG_FIT=y \ CONFIG_FIT_SIGNATURE=y \ CONFIG_FIT_SIGNATURE_MAX_SIZE=0x10000000 \ + CONFIG_TOOLS_LIBCRYPTO=y \ tools-only endef 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 3a1677d54d..936113595a 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 -@@ -21,6 +21,7 @@ static struct image_tool_params params = +@@ -24,6 +24,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 = "", -@@ -82,11 +83,12 @@ static void usage(const char *msg) +@@ -85,11 +86,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" -@@ -150,7 +152,7 @@ static void process_args(int argc, char +@@ -155,7 +157,7 @@ static void process_args(int argc, char int opt; while ((opt = getopt(argc, argv, -- "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) { +- "a:A:b:B:c:C:d:D:e:Ef:FG:k:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) { ++ "a:A:b:B:c:C:d:D:e:Ef:FG:k:i:K:lM:n:N:p:O:rR:qstT:vVx")) != -1) { switch (opt) { case 'a': params.addr = strtoull(optarg, &ptr, 16); -@@ -237,6 +239,14 @@ static void process_args(int argc, char +@@ -245,6 +247,14 @@ static void process_args(int argc, char case 'l': params.lflag = 1; break; 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 5b87a259db..7b71dce3b3 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 @@ -15,11 +15,9 @@ __u64 is not available on FreeBSD, remove its usage. Signed-off-by: Hauke Mehrtens --- include/image.h | 2 ++ - include/imx8image.h | 5 +++++ include/linux/posix_types.h | 2 ++ include/linux/types.h | 4 +++- - lib/rsa/rsa-sign.c | 2 +- - 5 files changed, 13 insertions(+), 2 deletions(-) + 3 files changed, 7 insertions(+), 1 deletion(-) --- a/include/image.h +++ b/include/image.h diff --git a/tools/mkimage/patches/080-mtk_image-add-support-for-booting-ARM64-images.patch b/tools/mkimage/patches/080-mtk_image-add-support-for-booting-ARM64-images.patch deleted file mode 100644 index dfe8128fb5..0000000000 --- a/tools/mkimage/patches/080-mtk_image-add-support-for-booting-ARM64-images.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 44165e4c676d266f73fda2e6ba82b4bf3262daf2 Mon Sep 17 00:00:00 2001 -From: Fabien Parent -Date: Fri, 16 Oct 2020 19:52:37 +0200 -Subject: [PATCH] tools: mtk_image: add support for booting ARM64 images - -mkimage is only able to package aarch32 binaries. Add support for -AArch64 images. - -One can create a ARM64 image using the following command line: -mkimage -T mtk_image -a 0x201000 -e 0x201000 -n "media=emmc;arm64=1" --d bl2.bin bl2.img - -Signed-off-by: Fabien Parent ---- - tools/mtk_image.c | 28 ++++++++++++++++++++++++---- - tools/mtk_image.h | 6 +++++- - 2 files changed, 29 insertions(+), 5 deletions(-) - -diff --git a/tools/mtk_image.c b/tools/mtk_image.c -index 2ca519483d..bde1e5da4b 100644 ---- a/tools/mtk_image.c -+++ b/tools/mtk_image.c -@@ -246,6 +246,7 @@ static const struct brom_img_type { - /* Image type selected by user */ - static enum brlyt_img_type hdr_media; - static int use_lk_hdr; -+static bool is_arm64_image; - - /* LK image name */ - static char lk_name[32] = "U-Boot"; -@@ -276,6 +277,7 @@ static int mtk_brom_parse_imagename(const char *imagename) - static const char *media = ""; - static const char *nandinfo = ""; - static const char *lk = ""; -+ static const char *arm64_param = ""; - - key = buf; - while (key) { -@@ -323,6 +325,9 @@ static int mtk_brom_parse_imagename(const char *imagename) - - if (!strcmp(key, "lkname")) - snprintf(lk_name, sizeof(lk_name), "%s", val); -+ -+ if (!strcmp(key, "arm64")) -+ arm64_param = val; - } - - if (next) -@@ -354,6 +359,9 @@ static int mtk_brom_parse_imagename(const char *imagename) - } - } - -+ if (arm64_param && arm64_param[0] == '1') -+ is_arm64_image = true; -+ - free(buf); - - if (hdr_media == BRLYT_TYPE_INVALID) { -@@ -458,6 +466,9 @@ static int mtk_image_verify_gen_header(const uint8_t *ptr, int print) - le32_to_cpu(gfh->file_info.load_addr) + - le32_to_cpu(gfh->file_info.jump_offset)); - -+ if (print) -+ printf("Architecture: %s\n", is_arm64_image ? "ARM64" : "ARM"); -+ - return 0; - } - -@@ -523,6 +534,9 @@ static int mtk_image_verify_nand_header(const uint8_t *ptr, int print) - le32_to_cpu(gfh->file_info.load_addr) + - le32_to_cpu(gfh->file_info.jump_offset)); - -+ if (print) -+ printf("Architecture: %s\n", is_arm64_image ? "ARM64" : "ARM"); -+ - return 0; - } - -@@ -581,6 +595,8 @@ static void put_ghf_common_header(struct gfh_common_header *gfh, int size, - static void put_ghf_header(struct gfh_header *gfh, int file_size, - int dev_hdr_size, int load_addr, int flash_type) - { -+ uint32_t cfg_bits; -+ - memset(gfh, 0, sizeof(struct gfh_header)); - - /* GFH_FILE_INFO header */ -@@ -608,11 +624,15 @@ static void put_ghf_header(struct gfh_header *gfh, int file_size, - /* GFH_BROM_CFG header */ - put_ghf_common_header(&gfh->brom_cfg.gfh, sizeof(gfh->brom_cfg), - GFH_TYPE_BROM_CFG, 3); -- gfh->brom_cfg.cfg_bits = cpu_to_le32( -- GFH_BROM_CFG_USBDL_AUTO_DETECT_DIS | -- GFH_BROM_CFG_USBDL_BY_KCOL0_TIMEOUT_EN | -- GFH_BROM_CFG_USBDL_BY_FLAG_TIMEOUT_EN); -+ cfg_bits = GFH_BROM_CFG_USBDL_AUTO_DETECT_DIS | -+ GFH_BROM_CFG_USBDL_BY_KCOL0_TIMEOUT_EN | -+ GFH_BROM_CFG_USBDL_BY_FLAG_TIMEOUT_EN; - gfh->brom_cfg.usbdl_by_kcol0_timeout_ms = cpu_to_le32(5000); -+ if (is_arm64_image) { -+ gfh->brom_cfg.jump_bl_arm64 = GFH_BROM_CFG_JUMP_BL_ARM64; -+ cfg_bits |= GFH_BROM_CFG_JUMP_BL_ARM64_EN; -+ } -+ gfh->brom_cfg.cfg_bits = cpu_to_le32(cfg_bits); - - /* GFH_BL_SEC_KEY header */ - put_ghf_common_header(&gfh->bl_sec_key.gfh, sizeof(gfh->bl_sec_key), -diff --git a/tools/mtk_image.h b/tools/mtk_image.h -index 4e78b3d0ff..7dda71ce88 100644 ---- a/tools/mtk_image.h -+++ b/tools/mtk_image.h -@@ -136,7 +136,9 @@ struct gfh_brom_cfg { - struct gfh_common_header gfh; - uint32_t cfg_bits; - uint32_t usbdl_by_auto_detect_timeout_ms; -- uint8_t unused[0x48]; -+ uint8_t unused[0x45]; -+ uint8_t jump_bl_arm64; -+ uint8_t unused2[2]; - uint32_t usbdl_by_kcol0_timeout_ms; - uint32_t usbdl_by_flag_timeout_ms; - uint32_t pad; -@@ -146,6 +148,8 @@ struct gfh_brom_cfg { - #define GFH_BROM_CFG_USBDL_AUTO_DETECT_DIS 0x10 - #define GFH_BROM_CFG_USBDL_BY_KCOL0_TIMEOUT_EN 0x80 - #define GFH_BROM_CFG_USBDL_BY_FLAG_TIMEOUT_EN 0x100 -+#define GFH_BROM_CFG_JUMP_BL_ARM64_EN 0x1000 -+#define GFH_BROM_CFG_JUMP_BL_ARM64 0x64 - - struct gfh_bl_sec_key { - struct gfh_common_header gfh; --- -2.30.1 - diff --git a/tools/mkimage/patches/081-mtk_image-add-an-option-to-set-device-header-offset.patch b/tools/mkimage/patches/081-mtk_image-add-an-option-to-set-device-header-offset.patch deleted file mode 100644 index 45f8f7c1c1..0000000000 --- a/tools/mkimage/patches/081-mtk_image-add-an-option-to-set-device-header-offset.patch +++ /dev/null @@ -1,226 +0,0 @@ -From patchwork Tue Mar 9 07:52:31 2021 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Weijie Gao -X-Patchwork-Id: 1449568 -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@bilbo.ozlabs.org -Authentication-Results: ozlabs.org; - spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de - (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; - envelope-from=u-boot-bounces@lists.denx.de; receiver=) -Authentication-Results: ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 - header.s=dk header.b=i1dK9gFR; - dkim-atps=neutral -Received: from phobos.denx.de (phobos.denx.de - [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) - (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) - key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest - SHA256) - (No client certificate requested) - by ozlabs.org (Postfix) with ESMTPS id 4DvnX84rrHz9sW1 - for ; Tue, 9 Mar 2021 18:53:44 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id DF60F8219C; - Tue, 9 Mar 2021 08:53:29 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=mediatek.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de -Authentication-Results: phobos.denx.de; - dkim=pass (1024-bit key; - unprotected) header.d=mediatek.com header.i=@mediatek.com - header.b="i1dK9gFR"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 5456882625; Tue, 9 Mar 2021 08:53:28 +0100 (CET) -X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de -X-Spam-Level: -X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,MIME_BASE64_TEXT,RDNS_NONE,SPF_HELO_NONE, - UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 -Received: from mailgw02.mediatek.com (unknown [1.203.163.81]) - by phobos.denx.de (Postfix) with ESMTP id 7526E80EF2 - for ; Tue, 9 Mar 2021 08:53:19 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=mediatek.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=weijie.gao@mediatek.com -X-UUID: 3b5ccbd89ab948daa31ec738ee94e7ed-20210309 -DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; - d=mediatek.com; - s=dk; - h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; - bh=mijplkmurYfYet7eQPGQD6GyyMtN6xMXZKHVAlpy0hM=; - b=i1dK9gFRfmkqD5vAud81Q3CdZlOQm3XK0H/NwbxYyncwalZqRZA1YBKTQhmPW0avcbwOQpGVlRmu1VAfALWgK80acX7bPIjWjtaJtK4/99vc+wIthmm1E5QMewyBAFkzGfx7A8ryh4HdcsG/esbnI0Mk2nletBHwRFAEVs3uUfU=; -X-UUID: 3b5ccbd89ab948daa31ec738ee94e7ed-20210309 -Received: from mtkcas32.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com - (envelope-from ) - (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) - with ESMTP id 23424931; Tue, 09 Mar 2021 15:53:06 +0800 -Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS31N1.mediatek.inc - (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; - Tue, 9 Mar 2021 15:52:58 +0800 -Received: from mcddlt001.mediatek.inc (10.19.240.15) by MTKCAS32.mediatek.inc - (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend - Transport; Tue, 9 Mar 2021 15:52:58 +0800 -From: Weijie Gao -To: -CC: GSS_MTK_Uboot_upstream , Weijie Gao - -Subject: [PATCH] tools: mtk_image: add an option to set device header offset -Date: Tue, 9 Mar 2021 15:52:31 +0800 -Message-ID: <1615276351-30641-1-git-send-email-weijie.gao@mediatek.com> -X-Mailer: git-send-email 1.9.1 -MIME-Version: 1.0 -X-TM-SNTS-SMTP: - B09EA906E69093D91FA73A3F764A0B89D3838DA91A4FA20DA0483EBE19962CA02000:8 -X-MTK: N -X-BeenThere: u-boot@lists.denx.de -X-Mailman-Version: 2.1.34 -Precedence: list -List-Id: U-Boot discussion -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Errors-To: u-boot-bounces@lists.denx.de -Sender: "U-Boot" -X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de -X-Virus-Status: Clean - -This patch adds an option which allows setting the device header offset. -This is useful if this tool is used to generate ATF BL2 image of mt7622 for -SD cards. - -Signed-off-by: Weijie Gao ---- - tools/mtk_image.c | 50 ++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 47 insertions(+), 3 deletions(-) - -diff --git a/tools/mtk_image.c b/tools/mtk_image.c -index bde1e5da4b..418c5fd54b 100644 ---- a/tools/mtk_image.c -+++ b/tools/mtk_image.c -@@ -243,8 +243,13 @@ static const struct brom_img_type { - } - }; - -+/* Indicates whether we're generating or verifying */ -+static bool img_gen; -+static uint32_t img_size; -+ - /* Image type selected by user */ - static enum brlyt_img_type hdr_media; -+static uint32_t hdr_offset; - static int use_lk_hdr; - static bool is_arm64_image; - -@@ -275,6 +280,7 @@ static int mtk_brom_parse_imagename(const char *imagename) - - /* User passed arguments from image name */ - static const char *media = ""; -+ static const char *hdr_offs = ""; - static const char *nandinfo = ""; - static const char *lk = ""; - static const char *arm64_param = ""; -@@ -317,6 +323,9 @@ static int mtk_brom_parse_imagename(const char *imagename) - if (!strcmp(key, "media")) - media = val; - -+ if (!strcmp(key, "hdroffset")) -+ hdr_offs = val; -+ - if (!strcmp(key, "nandinfo")) - nandinfo = val; - -@@ -359,6 +368,10 @@ static int mtk_brom_parse_imagename(const char *imagename) - } - } - -+ /* parse device header offset */ -+ if (hdr_offs && hdr_offs[0]) -+ hdr_offset = strtoul(hdr_offs, NULL, 0); -+ - if (arm64_param && arm64_param[0] == '1') - is_arm64_image = true; - -@@ -422,6 +435,7 @@ static int mtk_image_vrec_header(struct image_tool_params *params, - static int mtk_image_verify_gen_header(const uint8_t *ptr, int print) - { - union gen_boot_header *gbh = (union gen_boot_header *)ptr; -+ uint32_t gfh_offset, total_size, devh_size; - struct brom_layout_header *bh; - struct gfh_header *gfh; - const char *bootmedia; -@@ -453,7 +467,32 @@ static int mtk_image_verify_gen_header(const uint8_t *ptr, int print) - le32_to_cpu(bh->type) != BRLYT_TYPE_SDMMC)) - return -1; - -- gfh = (struct gfh_header *)(ptr + le32_to_cpu(bh->header_size)); -+ devh_size = sizeof(struct gen_device_header); -+ -+ if (img_gen) { -+ gfh_offset = devh_size; -+ } else { -+ gfh_offset = le32_to_cpu(bh->header_size); -+ -+ if (gfh_offset + sizeof(struct gfh_header) > img_size) { -+ /* -+ * This may happen if the hdr_offset used to generate -+ * this image is not zero. -+ * Since device header size is not fixed, we can't -+ * cover all possible cases. -+ * Assuming the image is valid only if the real -+ * device header size equals to devh_size. -+ */ -+ total_size = le32_to_cpu(bh->total_size); -+ -+ if (total_size - gfh_offset > img_size - devh_size) -+ return -1; -+ -+ gfh_offset = devh_size; -+ } -+ } -+ -+ gfh = (struct gfh_header *)(ptr + gfh_offset); - - if (strcmp(gfh->file_info.name, GFH_FILE_INFO_NAME)) - return -1; -@@ -549,6 +588,8 @@ static int mtk_image_verify_header(unsigned char *ptr, int image_size, - if (le32_to_cpu(lk->magic) == LK_PART_MAGIC) - return 0; - -+ img_size = image_size; -+ - if (!strcmp((char *)ptr, NAND_BOOT_NAME)) - return mtk_image_verify_nand_header(ptr, 0); - else -@@ -682,8 +723,8 @@ static void mtk_image_set_gen_header(void *ptr, off_t filesize, - - /* BRLYT header */ - put_brom_layout_header(&hdr->brlyt, hdr_media); -- hdr->brlyt.header_size = cpu_to_le32(sizeof(struct gen_device_header)); -- hdr->brlyt.total_size = cpu_to_le32(filesize); -+ hdr->brlyt.header_size = cpu_to_le32(hdr_offset + sizeof(*hdr)); -+ hdr->brlyt.total_size = cpu_to_le32(hdr_offset + filesize); - hdr->brlyt.header_size_2 = hdr->brlyt.header_size; - hdr->brlyt.total_size_2 = hdr->brlyt.total_size; - -@@ -747,6 +788,9 @@ static void mtk_image_set_header(void *ptr, struct stat *sbuf, int ifd, - return; - } - -+ img_gen = true; -+ img_size = sbuf->st_size; -+ - if (hdr_media == BRLYT_TYPE_NAND || hdr_media == BRLYT_TYPE_SNAND) - mtk_image_set_nand_header(ptr, sbuf->st_size, params->addr); - else diff --git a/tools/mkimage/patches/090-macos-arm64-builing-fix.patch b/tools/mkimage/patches/090-macos-arm64-builing-fix.patch index 216a8abd35..9f842146f7 100644 --- a/tools/mkimage/patches/090-macos-arm64-builing-fix.patch +++ b/tools/mkimage/patches/090-macos-arm64-builing-fix.patch @@ -2,27 +2,9 @@ This patch fixes compilation issues on MacOS arm64. Based on discussion https://github.com/u-boot/u-boot/commit/3b142045e8a7f0ab17b6099e9226296af45967d0 -diff --git a/Makefile b/Makefile -index b4f1cbc..551041f 100644 ---- a/Makefile -+++ b/Makefile -@@ -324,11 +324,6 @@ HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") - KBUILD_HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") - KBUILD_HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") - --# since Lion (10.7) ASLR is on by default, but we use linker generated lists --# in some host tools which is a problem then ... so disable ASLR for these --# tools --KBUILD_HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie") -- - # macOS Mojave (10.14.X) - # Undefined symbols for architecture x86_64: "_PyArg_ParseTuple" - KBUILD_HOSTLDFLAGS += $(call os_x_after, 10, 14, "-lpython -dynamclib", "") -diff --git a/tools/imagetool.h b/tools/imagetool.h -index 8726792..d1b72ef 100644 --- a/tools/imagetool.h +++ b/tools/imagetool.h -@@ -270,17 +270,20 @@ int rockchip_copy_image(int fd, struct image_tool_params *mparams); +@@ -272,11 +272,14 @@ int rockchip_copy_image(int fd, struct i * b) we need a API call to get the respective section symbols */ #if defined(__MACH__) #include @@ -30,18 +12,10 @@ index 8726792..d1b72ef 100644 #define INIT_SECTION(name) do { \ unsigned long name ## _len; \ -- char *__cat(pstart_, name) = getsectdata("__TEXT", \ -+ char *__cat(pstart_, name) = getsectdata("__DATA", \ + char *__cat(pstart_, name) = getsectdata("__DATA", \ #name, &__cat(name, _len)); \ + __cat(pstart_, name) += \ + _dyld_get_image_vmaddr_slide(0); \ char *__cat(pstop_, name) = __cat(pstart_, name) + \ __cat(name, _len); \ __cat(__start_, name) = (void *)__cat(pstart_, name); \ - __cat(__stop_, name) = (void *)__cat(pstop_, name); \ - } while (0) --#define SECTION(name) __attribute__((section("__TEXT, " #name))) -+#define SECTION(name) __attribute__((section("__DATA, " #name))) - - struct image_type_params **__start_image_type, **__stop_image_type; - #else -- 2.30.2