From 71dfe179cd3840f56bc812131b4031b0976efbc1 Mon Sep 17 00:00:00 2001 From: Oleksandr Suvorov Date: Thu, 31 Aug 2023 17:03:52 +0300 Subject: mach-imx: bootaux: fix building with disabled bootelf If CMD_ELF disabled and IMX_BOOTAUX enabled, the u-boot building ends up with a linking error [1]. Select LIB_ELF to fix the building issue. [1] ld: /tmp/ccaF1rpv.ltrans0.ltrans.o: in function `do_bootaux': arch/arm/mach-imx/imx_bootaux.c:108: undefined reference to `valid_elf_image' Fixes: c0f037f6a2a ("mach-imx: bootaux: elf firmware support") Signed-off-by: Oleksandr Suvorov --- arch/arm/mach-imx/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index d94b5828d0d..fda762426ef 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -32,6 +32,7 @@ config IMX_RDC config IMX_BOOTAUX bool "Support boot auxiliary core" depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610 || ARCH_IMX8 || ARCH_IMX8M + select LIB_ELF help bootaux [addr] to boot auxiliary core. -- cgit v1.2.3 From 2ec9ebc72a432f9b7b6631cb9666245f776cc256 Mon Sep 17 00:00:00 2001 From: Eduard Strehlau Date: Wed, 6 Sep 2023 22:47:25 -0300 Subject: imx: hab: Allow hab_auth_img_or_fail to be called without ivt_offset Since commit ea91031b2232 ("imx: hab: extend hab_auth_img to calculate ivt_offset"), it is possible to call the hab_auth_img command without the last ivt_offset argument. Currently, calling hab_auth_img_or_fail without the last ivt_offset parameter causes a failure and the command usage text is shown. Fix this problem by adjusting the argc logic to allow calling hab_auth_img_or_fail with only the address and size parameters. This way, both hab_auth_img and hab_auth_img_or_fail have the same behavior with respect to the allowed number of command parameters. Signed-off-by: Eduard Strehlau Signed-off-by: Fabio Estevam --- arch/arm/mach-imx/hab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index b3ef36c7973..8ba3c5ff8e5 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -662,7 +662,7 @@ static int do_authenticate_image_or_failover(struct cmd_tbl *cmdtp, int flag, { int ret = CMD_RET_FAILURE; - if (argc != 4) { + if (argc < 3) { ret = CMD_RET_USAGE; goto error; } -- cgit v1.2.3 From ade6e375c30d155b28c85da76f26eea9ae625773 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 6 Sep 2023 22:47:26 -0300 Subject: imx: hab: Improve the hab_auth_img_or_fail usage text Split the hab_auth_img_or_fail usage text in two sentences to make it clearer. Signed-off-by: Fabio Estevam --- arch/arm/mach-imx/hab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 8ba3c5ff8e5..e7b0388602f 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -715,7 +715,7 @@ U_BOOT_CMD( U_BOOT_CMD( hab_auth_img_or_fail, 4, 0, do_authenticate_image_or_failover, - "authenticate image via HAB on failure drop to USB BootROM mode", + "authenticate image via HAB. Switch to USB BootROM mode on failure", "addr length ivt_offset\n" "addr - image hex address\n" "length - image hex length\n" -- cgit v1.2.3 From 5ae4f74a1b9908fdde1d2b58fdb5d617bf41b51b Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 6 Sep 2023 22:47:27 -0300 Subject: imx: hab: Explain that ivt_offset is optional The ivt_offset parameter is optional for both hab_auth_img_or_fail and hab_auth_img commands. Document it in their usage texts to make it clearer. Signed-off-by: Fabio Estevam --- arch/arm/mach-imx/hab.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index e7b0388602f..27e053ef701 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -703,7 +703,7 @@ U_BOOT_CMD( "addr length ivt_offset\n" "addr - image hex address\n" "length - image hex length\n" - "ivt_offset - hex offset of IVT in the image" + "ivt_offset - hex offset of IVT in the image (optional)" ); U_BOOT_CMD( @@ -719,7 +719,7 @@ U_BOOT_CMD( "addr length ivt_offset\n" "addr - image hex address\n" "length - image hex length\n" - "ivt_offset - hex offset of IVT in the image" + "ivt_offset - hex offset of IVT in the image (optional)" ); U_BOOT_CMD( -- cgit v1.2.3 From 45651a3d6910b780095d2e31bf299acbf33b95bf Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 12 Sep 2023 12:11:00 -0300 Subject: imx7: Disable CAAM Job Ring 0 Trying to boot a fitImage after a successful hab_auth_img operation causes the following error: ## Loading kernel from FIT Image at 88000000 ... Using 'conf-imx7d-smegw01.dtb' configuration Trying 'kernel-1' kernel subimage Description: Linux kernel Type: Kernel Image Compression: uncompressed Data Start: 0x8800010c Data Size: 9901752 Bytes = 9.4 MiB Architecture: ARM OS: Linux Load Address: 0x80800000 Entry Point: 0x80800000 Hash algo: sha256 Hash value: 28f8779bbf010780f16dd3d84ecb9b604c44c5c2cf7acd098c264a2d3f68e969 Verifying Hash Integrity ... sha256Error in SEC deq CAAM was not setup properly or it is faulty error! The reason for this error is that the BootROM uses the CAAM Job Ring 0, so disable its node in U-Boot to avoid the resource conflict. imx8m dtsi files also have the Job Ring 0 disable since the following kernel commit: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch?h=v6.5&id=dc9c1ceb555ff661e6fc1081434600771f29657c For a temporary solution, disable the Job Ring 0 in imx7s-u-boot.dtsi. Reported-by: Eduard Strehlau Signed-off-by: Fabio Estevam --- arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi | 2 ++ arch/arm/dts/imx7d-pico-pi-u-boot.dtsi | 2 ++ arch/arm/dts/imx7d-sdb-qspi-u-boot.dtsi | 2 ++ arch/arm/dts/imx7d-sdb-u-boot.dtsi | 2 ++ arch/arm/dts/imx7d-smegw01-u-boot.dtsi | 3 +++ arch/arm/dts/imx7s-u-boot.dtsi | 7 +++++++ 6 files changed, 18 insertions(+) create mode 100644 arch/arm/dts/imx7d-smegw01-u-boot.dtsi create mode 100644 arch/arm/dts/imx7s-u-boot.dtsi diff --git a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi index 52aa8758701..57ca28edb70 100644 --- a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi +++ b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi @@ -3,6 +3,8 @@ * Copyright 2020-2022 Toradex */ +#include "imx7s-u-boot.dtsi" + &{/aliases} { /* SDHCI instance order: eMMC, SD/MMC */ mmc0 = &usdhc3; diff --git a/arch/arm/dts/imx7d-pico-pi-u-boot.dtsi b/arch/arm/dts/imx7d-pico-pi-u-boot.dtsi index 67b41ae1129..843b4583e53 100644 --- a/arch/arm/dts/imx7d-pico-pi-u-boot.dtsi +++ b/arch/arm/dts/imx7d-pico-pi-u-boot.dtsi @@ -1,3 +1,5 @@ +#include "imx7s-u-boot.dtsi" + /{ aliases { mmc0 = &usdhc3; diff --git a/arch/arm/dts/imx7d-sdb-qspi-u-boot.dtsi b/arch/arm/dts/imx7d-sdb-qspi-u-boot.dtsi index 62cdcbaeb67..896c8bcaa5a 100644 --- a/arch/arm/dts/imx7d-sdb-qspi-u-boot.dtsi +++ b/arch/arm/dts/imx7d-sdb-qspi-u-boot.dtsi @@ -3,6 +3,8 @@ * Copyright 2018 NXP */ +#include "imx7s-u-boot.dtsi" + &qspi { flash0: mx25l51245g@0 { compatible = "jedec,spi-nor"; diff --git a/arch/arm/dts/imx7d-sdb-u-boot.dtsi b/arch/arm/dts/imx7d-sdb-u-boot.dtsi index ac1d6e2e648..e4a27b8dd5a 100644 --- a/arch/arm/dts/imx7d-sdb-u-boot.dtsi +++ b/arch/arm/dts/imx7d-sdb-u-boot.dtsi @@ -1,3 +1,5 @@ +#include "imx7s-u-boot.dtsi" + &fec2 { status = "disable"; }; diff --git a/arch/arm/dts/imx7d-smegw01-u-boot.dtsi b/arch/arm/dts/imx7d-smegw01-u-boot.dtsi new file mode 100644 index 00000000000..90f7500ee34 --- /dev/null +++ b/arch/arm/dts/imx7d-smegw01-u-boot.dtsi @@ -0,0 +1,3 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +#include "imx7s-u-boot.dtsi" diff --git a/arch/arm/dts/imx7s-u-boot.dtsi b/arch/arm/dts/imx7s-u-boot.dtsi new file mode 100644 index 00000000000..c4c1da3c64f --- /dev/null +++ b/arch/arm/dts/imx7s-u-boot.dtsi @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT + +&crypto { + sec_jr0: jr@1000 { + status = "disabled"; + }; +}; -- cgit v1.2.3 From 62a3c66a7c1ee733695b46542c4a9034f3a663a4 Mon Sep 17 00:00:00 2001 From: Eduard Strehlau Date: Wed, 20 Sep 2023 07:49:08 -0300 Subject: smegw01: Use CONFIG_SYS_LOAD_ADDR for loading fitImage Set CONFIG_SYS_LOAD_ADDR=0x88000000 and use this address for loading fitImage. Also pass the standard CONFIG_BOOTFILE option to indicate the fitImage file. Signed-off-by: Eduard Strehlau Signed-off-by: Fabio Estevam --- board/storopack/smegw01/smegw01.env | 14 +++++++------- configs/smegw01_defconfig | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/board/storopack/smegw01/smegw01.env b/board/storopack/smegw01/smegw01.env index 1263ddac8ed..528310dd810 100644 --- a/board/storopack/smegw01/smegw01.env +++ b/board/storopack/smegw01/smegw01.env @@ -48,13 +48,8 @@ commit_mmc= saveenv; fi; console=ttymxc0 -fdt_addr=0x83000000 -fdtfile=imx7d-smegw01.dtb -fit_addr=0x88000000 -image=fitImage -loadaddr=0x80800000 loadbootpart=mmc partconf 1 boot_part -loadimage=load mmc ${mmcdev}:${gpt_partition_entry} ${fit_addr} boot/${image} +loadimage=load mmc ${mmcdev}:${gpt_partition_entry} loadpart=gpt setenv mmc ${mmcdev} rootfs-${mmcpart_committed} mmcargs= setenv bootargs console=${console},${baudrate} root=/dev/mmcblk${mmcdev}p${gpt_partition_entry} rootwait rw SM_ROOT_DEV=${mmcdev} SM_ROOT_PART=${gpt_partition_entry} SM_BOOT_PART=${boot_part} @@ -71,8 +66,13 @@ mmcboot= else run altbootcmd; fi; +#ifdef CONFIG_SYS_BOOT_LOCKED + hab_auth_img ${fileaddr} ${filesize}; +#else + hab_auth_img_or_fail ${fileaddr} ${filesize}; +#endif run mmcargs; - if bootm ${fit_addr}; then + if bootm; then ; else run altbootcmd; diff --git a/configs/smegw01_defconfig b/configs/smegw01_defconfig index 7f1b2bee8e1..616038387e2 100644 --- a/configs/smegw01_defconfig +++ b/configs/smegw01_defconfig @@ -14,6 +14,7 @@ CONFIG_ARMV7_BOOT_SEC_DEFAULT=y CONFIG_IMX_RDC=y CONFIG_IMX_BOOTAUX=y CONFIG_IMX_HAB=y +CONFIG_SYS_LOAD_ADDR=0x88000000 CONFIG_SYS_MEMTEST_START=0x80000000 CONFIG_SYS_MEMTEST_END=0xa0000000 CONFIG_FIT=y @@ -54,6 +55,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_ENV_WRITEABLE_LIST=y CONFIG_ENV_ACCESS_IGNORE_FORCE=y +CONFIG_USE_BOOTFILE=y +CONFIG_BOOTFILE="boot/fitImage" CONFIG_NET_RANDOM_ETHADDR=y CONFIG_BOUNCE_BUFFER=y CONFIG_BOOTCOUNT_LIMIT=y -- cgit v1.2.3