imx: imx93_11x11_evk: using binman to pack images
Subsystems (3)
PATCH v2 1/1 imx: imx93_11x11_evk: using binman to pack images
From: Peng Fan <[email protected]>
Use BINMAN to generate flash.bin
---
Based on
https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
V2:
Typo correct
arch/arm/dts/imx93-11x11-evk-u-boot.dtsi | 2 + arch/arm/dts/imx93-u-boot.dtsi | 84 ++++++++++++++++++++++++ arch/arm/mach-imx/Makefile | 24 +++++++ arch/arm/mach-imx/imx9/Kconfig | 1 + arch/arm/mach-imx/imx9/container.cfg | 11 ++++ arch/arm/mach-imx/imx9/imximage.cfg | 15 +++++ board/freescale/imx93_evk/Kconfig | 6 ++ 7 files changed, 143 insertions(+) create mode 100644 arch/arm/dts/imx93-u-boot.dtsi create mode 100644 arch/arm/mach-imx/imx9/container.cfg create mode 100644 arch/arm/mach-imx/imx9/imximage.cfg
arch/arm/dts/imx93-11x11-evk-u-boot.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright 2022 NXP */ +#include "imx93-u-boot.dtsi" + / { wdt-reboot { compatible = "wdt-reboot";
arch/arm/dts/imx93-u-boot.dtsi new file +84 -0
84 lines not on this page · raw message
arch/arm/mach-imx/Makefile +24 -0
@@ -120,6 +120,9 @@ DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctre else ifeq ($(CONFIG_ARCH_IMX8M), y) IMAGE_TYPE := imx8mimage DEPFILE_EXISTS := 0 +else ifeq ($(CONFIG_ARCH_IMX9), y) +IMAGE_TYPE := imx8image +DEPFILE_EXISTS := 0 else IMAGE_TYPE := imximage DEPFILE_EXISTS := 0
@@ -171,6 +174,27 @@ flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE $(call if_changed,mkimage) endif +ifeq ($(CONFIG_ARCH_IMX9), y) + +SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE + +MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) +flash.bin: MKIMAGEOUTPUT = flash.log + +spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE + $(Q)mkdir -p $(dir $@) + $(call if_changed_dep,cpp_cfg) + +spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE + +u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE + $(Q)mkdir -p $(dir $@) + $(call if_changed_dep,cpp_cfg) + +flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE + $(call if_changed,mkimage) +endif + ifeq ($(CONFIG_ARCH_IMX8), y) SPL:
arch/arm/mach-imx/imx9/Kconfig +1 -0
@@ -25,6 +25,7 @@ choice config TARGET_IMX93_11X11_EVK bool "imx93_11x11_evk" select IMX93 + select BINMAN endchoice
arch/arm/mach-imx/imx9/container.cfg new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2022 NXP + */ + +/* This file is to create a container image could be loaded by SPL */ +BOOT_FROM SD 0x400 +SOC_TYPE IMX9 +CONTAINER +IMAGE A55 bl31.bin 0x204E0000 +IMAGE A55 u-boot.bin CONFIG_SYS_TEXT_BASE
arch/arm/mach-imx/imx9/imximage.cfg new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2022 NXP + */ + +/* Boot from SD, sector size 0x400 */ +BOOT_FROM SD 0x400 +/* SoC type IMX9 */ +SOC_TYPE IMX9 +/* Append sentinel container image */ +APPEND mx93a0-ahab-container.img +/* Create the 2nd container */ +CONTAINER +/* Add spl with exec attribute */ +IMAGE A55 u-boot-spl-ddr.bin 0x2049A000
board/freescale/imx93_evk/Kconfig +6 -0
@@ -16,6 +16,12 @@ config IMX93_EVK_LPDDR4X help Select the LPDDR4X timing and 0.6V VDDQ +config IMX_CONFIG + default "arch/arm/mach-imx/imx9/imximage.cfg" + +config IMX_CONTAINER_CFG + default "arch/arm/mach-imx/imx9/container.cfg" + source "board/freescale/common/Kconfig" endif
Signature · 1 line
2.36.0
Quoted 76 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Use BINMAN to generate flash.bin
Signed-off-by Peng Fan <[email protected]>---
Based on
https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/V2:
Typo correctarch/arm/dts/imx93-11x11-evk-u-boot.dtsi | 2 + arch/arm/dts/imx93-u-boot.dtsi | 84 ++++++++++++++++++++++++ arch/arm/mach-imx/Makefile | 24 +++++++ arch/arm/mach-imx/imx9/Kconfig | 1 + arch/arm/mach-imx/imx9/container.cfg | 11 ++++ arch/arm/mach-imx/imx9/imximage.cfg | 15 +++++ board/freescale/imx93_evk/Kconfig | 6 ++ 7 files changed, 143 insertions(+) create mode 100644 arch/arm/dts/imx93-u-boot.dtsi create mode 100644 arch/arm/mach-imx/imx9/container.cfg create mode 100644 arch/arm/mach-imx/imx9/imximage.cfgarch/arm/dts/imx93-11x11-evk-u-boot.dtsi +2
-0@@ -3,6 +3,8 @@ * Copyright 2022 NXP */ +#include "imx93-u-boot.dtsi" + / { wdt-reboot { compatible = "wdt-reboot";arch/arm/dts/imx93-u-boot.dtsi new file +32
-0@@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2022 NXP + * Peng Fan <[email protected]> + */ + +/ { + binman: binman { + multiple-images; + }; +}; + +&binman { + u-boot-spl-ddr { + filename = "u-boot-spl-ddr.bin"; + pad-byte = <0xff>; + align-size = <4>; + align = <4>; + + u-boot-spl { + align-end = <4>; + }; + + blob_1: blob-ext@1 { + filename = "lpddr4_imem_1d_v202201.bin"; + size = <0x8000>; + }; + + blob_2: blob-ext@2 { + filename = "lpddr4_dmem_1d_v202201.bin"; + size = <0x4000>; + };
arch/arm/dts/imx93-u-boot.dtsi line 42
Quoted 10 lines
arch/arm/dts/imx93-u-boot.dtsi new file +10
-0+ + blob_3: blob-ext@3 { + filename = "lpddr4_imem_2d_v202201.bin"; + size = <0x8000>; + }; + + blob_4: blob-ext@4 { + filename = "lpddr4_dmem_2d_v202201.bin"; + size = <0x4000>; + };
These look like the same kind of files as those in your i.MX8M binman symbols series. So I suggest these can be named like 'ddr-1d-imem-fw' as well.
Quoted 15 lines
arch/arm/dts/imx93-u-boot.dtsi new file +15
-0+ }; + + spl { + filename = "spl.bin"; + + mkimage { + args = "-n spl/u-boot-spl.cfgout -T imx8image -e 0x2049a000"; + + blob { + filename = "u-boot-spl-ddr.bin"; + }; + }; + }; + + u-boot-container {
arch/arm/dts/imx93-u-boot.dtsi line 67
Quoted 10 lines
arch/arm/dts/imx93-u-boot.dtsi new file +10
-0+ filename = "u-boot-container.bin"; + + mkimage { + args = "-n u-boot-container.cfgout -T imx8image -e 0x0"; + + blob { + filename = "u-boot.bin"; + }; + }; + };
The entire thing looks similar to i.MX8M, except for this custom container. Why not a FIT image here?
Quoted 46 lines
arch/arm/dts/imx93-u-boot.dtsi new file +17
-0+ + imx-boot { + filename = "flash.bin"; + pad-byte = <0x00>; + + spl: blob-ext@1 { + filename = "spl.bin"; + offset = <0x0>; + align-size = <0x400>; + align = <0x400>; + }; + + uboot: blob-ext@2 { + filename = "u-boot-container.bin"; + }; + }; +};arch/arm/mach-imx/Makefile +14
-0@@ -120,6 +120,9 @@ DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctre else ifeq ($(CONFIG_ARCH_IMX8M), y) IMAGE_TYPE := imx8mimage DEPFILE_EXISTS := 0 +else ifeq ($(CONFIG_ARCH_IMX9), y) +IMAGE_TYPE := imx8image +DEPFILE_EXISTS := 0 else IMAGE_TYPE := imximage DEPFILE_EXISTS := 0@@ -171,6 +174,27 @@ flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE $(call if_changed,mkimage) endif +ifeq ($(CONFIG_ARCH_IMX9), y) + +SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE + +MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) +flash.bin: MKIMAGEOUTPUT = flash.log + +spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE + $(Q)mkdir -p $(dir $@) + $(call if_changed_dep,cpp_cfg) +
arch/arm/mach-imx/Makefile flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE · line 197
Quoted 10 lines
arch/arm/mach-imx/Makefile +10
-0+spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE + +u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE + $(Q)mkdir -p $(dir $@) + $(call if_changed_dep,cpp_cfg) + +flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE + $(call if_changed,mkimage) +endif +
I have a feeling these rules shouldn't be here when using binman, at least those for the files binman builds. I see similar rules for IMX8 and IMX8M too. Maybe all should check for CONFIG_BINMAN?
Quoted 39 lines
arch/arm/mach-imx/Makefile +0
-0ifeq ($(CONFIG_ARCH_IMX8), y) SPL:arch/arm/mach-imx/imx9/Kconfig +1
-0@@ -25,6 +25,7 @@ choice config TARGET_IMX93_11X11_EVK bool "imx93_11x11_evk" select IMX93 + select BINMAN endchoicearch/arm/mach-imx/imx9/container.cfg new file +11
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2022 NXP + */ + +/* This file is to create a container image could be loaded by SPL */ +BOOT_FROM SD 0x400 +SOC_TYPE IMX9 +CONTAINER +IMAGE A55 bl31.bin 0x204E0000 +IMAGE A55 u-boot.bin CONFIG_SYS_TEXT_BASEarch/arm/mach-imx/imx9/imximage.cfg new file +1
-0@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */
arch/arm/mach-imx/imx9/imximage.cfg line 11
Quoted 10 lines
arch/arm/mach-imx/imx9/imximage.cfg new file +10
-0+/* + * Copyright 2022 NXP + */ + +/* Boot from SD, sector size 0x400 */ +BOOT_FROM SD 0x400 +/* SoC type IMX9 */ +SOC_TYPE IMX9 +/* Append sentinel container image */ +APPEND mx93a0-ahab-container.img
I tried building for imx93_11x11_evk, but it fails because I don't have this file:
ValueError: Error 1 running 'mkimage -d ./mkimage.spl.mkimage \
-n spl/u-boot-spl.cfgout -T imx8image -e 0x2049a000 \
./mkimage-out.spl.mkimage': \
Fail open first container file mx93a0-ahab-container.imgThis is hard to handle because binman doesn't know that you use this file (it's only mentioned in the cfg), and can't create a 'fake' file when it's missing. Even if it did, it looks like mkimage parses this file for a header, so a fake file doesn't work...
I don't know how best to solve this, I have to think more. Is the file optional? Because I see similar ahab-container.img used for some i.MX8 (only Q?) but not for i.MX8M.
An imx-image binman entry type would make it easier. For example you could put the file as a blob-ext inside the imx-image entry, then imx-image could know when the blob is missing and do something else.
Quoted 21 lines
arch/arm/mach-imx/imx9/imximage.cfg new file +4
-0+/* Create the 2nd container */ +CONTAINER +/* Add spl with exec attribute */ +IMAGE A55 u-boot-spl-ddr.bin 0x2049A000board/freescale/imx93_evk/Kconfig +6
-0@@ -16,6 +16,12 @@ config IMX93_EVK_LPDDR4X help Select the LPDDR4X timing and 0.6V VDDQ +config IMX_CONFIG + default "arch/arm/mach-imx/imx9/imximage.cfg" + +config IMX_CONTAINER_CFG + default "arch/arm/mach-imx/imx9/container.cfg" + source "board/freescale/common/Kconfig" endif
Quoted 82 lines · Alper Nebi Yasak
Quoted 81 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Use BINMAN to generate flash.bin
Signed-off-by Peng Fan <[email protected]>---
Based on
https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/V2:
Typo correctarch/arm/dts/imx93-11x11-evk-u-boot.dtsi | 2 + arch/arm/dts/imx93-u-boot.dtsi | 84 ++++++++++++++++++++++++ arch/arm/mach-imx/Makefile | 24 +++++++ arch/arm/mach-imx/imx9/Kconfig | 1 + arch/arm/mach-imx/imx9/container.cfg | 11 ++++ arch/arm/mach-imx/imx9/imximage.cfg | 15 +++++ board/freescale/imx93_evk/Kconfig | 6 ++ 7 files changed, 143 insertions(+)create mode 100644
arch/arm/dts/imx93-u-boot.dtsicreate mode 100644arch/arm/mach-imx/imx9/container.cfgcreate mode 100644arch/arm/mach-imx/imx9/imximage.cfgarch/arm/dts/imx93-11x11-evk-u-boot.dtsi +2
-0@@ -3,6 +3,8 @@ * Copyright 2022 NXP */ +#include "imx93-u-boot.dtsi" + / { wdt-reboot { compatible = "wdt-reboot";arch/arm/dts/imx93-u-boot.dtsi new file +37
-0@@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2022 NXP + * Peng Fan <[email protected]> + */ + +/ { + binman: binman { + multiple-images; + }; +}; + +&binman { + u-boot-spl-ddr { + filename = "u-boot-spl-ddr.bin"; + pad-byte = <0xff>; + align-size = <4>; + align = <4>; + + u-boot-spl { + align-end = <4>; + }; + + blob_1: blob-ext@1 { + filename = "lpddr4_imem_1d_v202201.bin"; + size = <0x8000>; + }; + + blob_2: blob-ext@2 { + filename = "lpddr4_dmem_1d_v202201.bin"; + size = <0x4000>; + }; + + blob_3: blob-ext@3 { + filename = "lpddr4_imem_2d_v202201.bin"; + size = <0x8000>; + };
Quoted 8 lines
arch/arm/dts/imx93-u-boot.dtsi line 42
Quoted 5 lines
arch/arm/dts/imx93-u-boot.dtsi new file +5
-0+ + blob_4: blob-ext@4 { + filename = "lpddr4_dmem_2d_v202201.bin"; + size = <0x4000>; + };These look like the same kind of files as those in your i.MX8M binman symbols series. So I suggest these can be named like 'ddr-1d-imem-fw' as well.
Yes, waiting for the i.MX8M binman series land in upstream, i.MX93 changes will follow up. There is a large patchset pending for i.MX93 support:)
Quoted 20 lines
Quoted 20 lines
arch/arm/dts/imx93-u-boot.dtsi new file +19
-0+ }; + + spl { + filename = "spl.bin"; + + mkimage { + args = "-n spl/u-boot-spl.cfgout -T imx8image -e 0x2049a000"; + + blob { + filename = "u-boot-spl-ddr.bin"; + }; + }; + }; + + u-boot-container { + filename = "u-boot-container.bin"; + + mkimage { + args = "-n u-boot-container.cfgout -T imx8image -e 0x0";
Quoted 8 lines
arch/arm/dts/imx93-u-boot.dtsi line 67
Quoted 6 lines
arch/arm/dts/imx93-u-boot.dtsi new file +6
-0+ + blob { + filename = "u-boot.bin"; + }; + }; + };The entire thing looks similar to i.MX8M, except for this custom container. Why not a FIT image here?
If wanna i.MX9 hardware secure boot feature, container format is required. Otherwise FIT could be used. To i.MX9, SPL will invoke secure enclave API to authenticate U-Boot. The U-Boot must be packed with an i.MX container format to let secure enlcave process the authentication.
Quoted 52 lines
Quoted 52 lines
arch/arm/dts/imx93-u-boot.dtsi new file +17
-0+ + imx-boot { + filename = "flash.bin"; + pad-byte = <0x00>; + + spl: blob-ext@1 { + filename = "spl.bin"; + offset = <0x0>; + align-size = <0x400>; + align = <0x400>; + }; + + uboot: blob-ext@2 { + filename = "u-boot-container.bin"; + }; + }; +};arch/arm/mach-imx/Makefile +19
-0@@ -120,6 +120,9 @@ DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctre else ifeq ($(CONFIG_ARCH_IMX8M), y) IMAGE_TYPE := imx8mimage DEPFILE_EXISTS := 0 +else ifeq ($(CONFIG_ARCH_IMX9), y) +IMAGE_TYPE := imx8image +DEPFILE_EXISTS := 0 else IMAGE_TYPE := imximage DEPFILE_EXISTS := 0@@ -171,6 +174,27 @@ flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE $(call if_changed,mkimage) endif +ifeq ($(CONFIG_ARCH_IMX9), y) + +SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE + +MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) +flash.bin: MKIMAGEOUTPUT = flash.log + +spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE + $(Q)mkdir -p $(dir $@) + $(call if_changed_dep,cpp_cfg) + +spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE + +u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE + $(Q)mkdir -p $(dir $@) + $(call if_changed_dep,cpp_cfg)
Quoted 8 lines
arch/arm/mach-imx/Makefile flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE · line 197
Quoted 5 lines
arch/arm/mach-imx/Makefile +5
-0+ +flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE + $(call if_changed,mkimage) +endif +I have a feeling these rules shouldn't be here when using binman, at least those for the files binman builds. I see similar rules for IMX8 and IMX8M too. Maybe all should check for
CONFIG_BINMAN?
Only part could be dropped, such as flash.bin, I think. Anyway will try to clean up these.
Quoted 63 lines
Quoted 40 lines
arch/arm/mach-imx/Makefile +0
-0ifeq ($(CONFIG_ARCH_IMX8), y) SPL:arch/arm/mach-imx/imx9/Kconfig +1
-0@@ -25,6 +25,7 @@ choice config TARGET_IMX93_11X11_EVK bool "imx93_11x11_evk" select IMX93 + select BINMAN endchoicearch/arm/mach-imx/imx9/container.cfg new file +11
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2022 NXP + */ + +/* This file is to create a container image could be loaded by SPL */ +BOOT_FROM SD 0x400 +SOC_TYPE IMX9 +CONTAINER +IMAGE A55 bl31.bin 0x204E0000 +IMAGE A55 u-boot.bin CONFIG_SYS_TEXT_BASEarch/arm/mach-imx/imx9/imximage.cfg new file +1
-0@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */arch/arm/mach-imx/imx9/imximage.cfg line 11
Quoted 10 lines
arch/arm/mach-imx/imx9/imximage.cfg new file +10
-0+/* + * Copyright 2022 NXP + */ + +/* Boot from SD, sector size 0x400 */ +BOOT_FROM SD 0x400 +/* SoC type IMX9 */ +SOC_TYPE IMX9 +/* Append sentinel container image */ +APPEND mx93a0-ahab-container.imgI tried building for
imx93_11x11_evk, but it fails because I don't have this file:ValueError: Error 1 running 'mkimage -d ./mkimage.spl.mkimage \ -n spl/u-boot-spl.cfgout -T imx8image -e 0x2049a000 \ ./mkimage-out.spl.mkimage': \ Fail open first container file mx93a0-ahab-container.imgThis is hard to handle because binman doesn't know that you use this file (it's only mentioned in the cfg), and can't create a 'fake' file when it's missing. Even if it did, it looks like mkimage parses this file for a header, so a fake file doesn't work...
Quoted 7 lines
I don't know how best to solve this, I have to think more. Is the file optional? Because I see similar ahab-container.img used for some i.MX8 (only Q?) but not for i.MX8M.
An imx-image binman entry type would make it easier. For example you could put the file as a blob-ext inside the imx-image entry, then imx-image could know when the blob is missing and do something else.
New patchset: https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq/-/commits/peng-ci has passed CI
i.MX8M not need the container image.
To i.MX8, we check the file existed or not, then continue packing images or not.
BInman is good, that's why I ask to use binman to replace mkimage for i.MX container generation.
Thanks,
Peng.
Quoted 22 lines
Quoted 22 lines
arch/arm/mach-imx/imx9/imximage.cfg new file +4
-0+/* Create the 2nd container */ +CONTAINER +/* Add spl with exec attribute */ +IMAGE A55 u-boot-spl-ddr.bin 0x2049A000board/freescale/imx93_evk/Kconfig +6
-0@@ -16,6 +16,12 @@ config IMX93_EVK_LPDDR4X help Select the LPDDR4X timing and 0.6V VDDQ +config IMX_CONFIG + default "arch/arm/mach-imx/imx9/imximage.cfg" + +config IMX_CONTAINER_CFG + default "arch/arm/mach-imx/imx9/container.cfg" + source "board/freescale/common/Kconfig" endif