binman: Add nxp_imx8mcst etype for i.MX8M flash.bin signing
Subsystems (4)
PATCH v4 1/4 binman: Add nxp_imx8mcst etype for i.MX8M flash.bin signing
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
---
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Adam Ford <[email protected]>
Cc: Alper Nebi Yasak <[email protected]>
Cc: Andrejs Cainikovs <[email protected]>
Cc: Angus Ainslie <[email protected]>
Cc: Emanuele Ghidoli <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Eichenberger <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: - Use configparser module for generating the configuration INI file
- Use config template as an input, parse it, modify only keys of interest
- Pull magic values into top level variables
- Rename nxp,csf-key and nxp,img-key to nxp,csf-crt and nxp,img-crt
- Return unmodified data if signing unrecognized (non-SPL/non-FIT) section
V3: - Introduce SRK_TABLE/CSF_KEY/IMG_KEY env variables as alternative
option for specifying the key material paths
- Clean up imx8mimage and imx8mcsf files and add them to gitignore
V4: Add RB from Tim
--- .gitignore | 2 + Makefile | 2 +- tools/binman/btool/cst.py | 48 +++++++++ tools/binman/etype/nxp_imx8mcst.py | 164 +++++++++++++++++++++++++++++ 4 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 tools/binman/btool/cst.py create mode 100644 tools/binman/etype/nxp_imx8mcst.py
.gitignore +2 -0
@@ -73,6 +73,8 @@ fit-dtb.blob* /capsule.*.efi-capsule /capsule*.map /keep-syms-lto.* +/*imx8mimage* +/*imx8mcst* # # Generated include files
Makefile +1 -1
@@ -2210,7 +2210,7 @@ MRPROPER_DIRS += include/config include/generated spl tpl vpl \ # Remove include/asm symlink created by U-Boot before v2014.01 MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \ ctags etags tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ - drivers/video/fonts/*.S include/asm + drivers/video/fonts/*.S include/asm *imx8mimage* *imx8mcst* # clean - Delete most, but leave enough to build external modules #
tools/binman/btool/cst.py new file +48 -0
48 lines not on this page · raw message
tools/binman/etype/nxp_imx8mcst.py new file +164 -0
164 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v4 2/4 ARM: dts: imx: Introduce SPL and FIT labels to i.MX8M DTs binman nodes
Add binman_imx_spl and binman_imx_fit labels to nxp-imx8mimage {} and fit {} nodes respectively, so they can be referened in board DTs no matter how deep in the top level binman image description they are. Update current board DTs to use those labels.
---
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Adam Ford <[email protected]>
Cc: Alper Nebi Yasak <[email protected]>
Cc: Andrejs Cainikovs <[email protected]>
Cc: Angus Ainslie <[email protected]>
Cc: Emanuele Ghidoli <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Eichenberger <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: New patch
V3: No change
V4: Add RB from Tim
--- arch/arm/dts/imx8mm-u-boot.dtsi | 4 +- .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi | 8 +- arch/arm/dts/imx8mn-u-boot.dtsi | 4 +- arch/arm/dts/imx8mp-dhcom-u-boot.dtsi | 124 +++++++++--------- arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi | 26 ++-- arch/arm/dts/imx8mp-u-boot.dtsi | 4 +- arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi | 10 +- arch/arm/dts/imx8mq-u-boot.dtsi | 4 +- 8 files changed, 84 insertions(+), 100 deletions(-)
arch/arm/dts/imx8mm-u-boot.dtsi +2 -2
@@ -54,7 +54,7 @@ }; #endif - nxp-imx8mimage { + binman_imx_spl: nxp-imx8mimage { filename = "u-boot-spl-mkimage.bin"; nxp,boot-from = "sd"; nxp,rom-version = <1>;
@@ -98,7 +98,7 @@ }; }; - fit { + binman_imx_fit: fit { description = "Configuration to load ATF before U-Boot"; #ifndef CONFIG_IMX_HAB fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi +2 -6
@@ -35,12 +35,8 @@ bootph-pre-ram; }; -&binman { - section { - fit { - offset = <0x5fc00>; - }; - }; +&binman_imx_fit { + offset = <0x5fc00>; }; &gpio1 {
arch/arm/dts/imx8mn-u-boot.dtsi +2 -2
@@ -103,7 +103,7 @@ }; #endif - nxp-imx8mimage { + binman_imx_spl: nxp-imx8mimage { filename = "u-boot-spl-mkimage.bin"; nxp,boot-from = "sd"; nxp,rom-version = <2>;
@@ -169,7 +169,7 @@ }; }; - fit { + binman_imx_fit: fit { description = "Configuration to load ATF before U-Boot"; #ifndef CONFIG_IMX_HAB fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
arch/arm/dts/imx8mp-dhcom-u-boot.dtsi +60 -64
133 lines not on this page · raw message
arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi +11 -15
@@ -135,21 +135,17 @@ assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_400M>; }; -&binman { - section { - fit { - images { - fip { - description = "Trusted Firmware FIP"; - type = "firmware"; - arch = "arm64"; - compression = "none"; - load = <0x40310000>; - - fip_blob: blob-ext{ - filename = "fip.bin"; - }; - }; +&binman_imx_fit { + images { + fip { + description = "Trusted Firmware FIP"; + type = "firmware"; + arch = "arm64"; + compression = "none"; + load = <0x40310000>; + + fip_blob: blob-ext{ + filename = "fip.bin"; }; }; };
arch/arm/dts/imx8mp-u-boot.dtsi +2 -2
@@ -86,7 +86,7 @@ section { pad-byte = <0x00>; - nxp-imx8mimage { + binman_imx_spl: nxp-imx8mimage { filename = "u-boot-spl-mkimage.bin"; nxp,boot-from = "sd"; nxp,rom-version = <2>;
@@ -129,7 +129,7 @@ }; }; - fit { + binman_imx_fit: fit { description = "Configuration to load ATF before U-Boot"; #ifndef CONFIG_IMX_HAB fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi +3 -7
@@ -10,14 +10,10 @@ bootph-pre-ram; }; -&binman { +&binman_imx_spl { section { - nxp-imx8mimage { - section { - signed-hdmi-imx8m { - filename = "signed_dp_imx8m.bin"; - }; - }; + signed-hdmi-imx8m { + filename = "signed_dp_imx8m.bin"; }; }; };
arch/arm/dts/imx8mq-u-boot.dtsi +2 -2
@@ -38,7 +38,7 @@ section { pad-byte = <0x00>; - nxp-imx8mimage { + binman_imx_spl: nxp-imx8mimage { filename = "u-boot-spl-mkimage.bin"; nxp,boot-from = "sd"; nxp,rom-version = <1>;
@@ -87,7 +87,7 @@ }; }; - fit { + binman_imx_fit: fit { description = "Configuration to load ATF before U-Boot"; #ifndef CONFIG_IMX_HAB fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
Signature · 1 line
2.43.0
PATCH v4 3/4 ARM: dts: imx: Wrap i.MX8M binman SPL and FIT nodes in CST node if IMX_HAB enabled
In reply to Marek VasutIn case CONFIG_IMX_HAB is enabled, extend the binman image description for all of i.MX8M{Q,M,N,P} with CST wrapper node. This way, if CONFIG_IMX_HAB is enabled, binman will be automatically used to sign SPL and fitImage.
---
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Adam Ford <[email protected]>
Cc: Alper Nebi Yasak <[email protected]>
Cc: Andrejs Cainikovs <[email protected]>
Cc: Angus Ainslie <[email protected]>
Cc: Emanuele Ghidoli <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Eichenberger <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: New patch
V3: No change
V4: Add RB from Tim
--- arch/arm/dts/imx8mm-u-boot.dtsi | 195 ++++++++++++++++------------- arch/arm/dts/imx8mn-u-boot.dtsi | 209 ++++++++++++++++++-------------- arch/arm/dts/imx8mp-u-boot.dtsi | 172 ++++++++++++++------------ arch/arm/dts/imx8mq-u-boot.dtsi | 182 ++++++++++++++------------- 4 files changed, 424 insertions(+), 334 deletions(-)
arch/arm/dts/imx8mm-u-boot.dtsi +110 -85
@@ -54,126 +54,151 @@ }; #endif - binman_imx_spl: nxp-imx8mimage { - filename = "u-boot-spl-mkimage.bin"; - nxp,boot-from = "sd"; - nxp,rom-version = <1>; +#ifdef CONFIG_IMX_HAB + nxp-imx8mcst@0 { + filename = "u-boot-spl-mkimage.signed.bin"; nxp,loader-address = <CONFIG_SPL_TEXT_BASE>; + nxp,unlock; args; /* Needed by mkimage etype superclass */ +#endif - section { - align = <4>; - align-size = <4>; - filename = "u-boot-spl-ddr.bin"; - pad-byte = <0xff>; - - u-boot-spl { - align-end = <4>; - filename = "u-boot-spl.bin"; - }; + binman_imx_spl: nxp-imx8mimage { + filename = "u-boot-spl-mkimage.bin"; + nxp,boot-from = "sd"; + nxp,rom-version = <1>; + nxp,loader-address = <CONFIG_SPL_TEXT_BASE>; + args; /* Needed by mkimage etype superclass */ + + section { + align = <4>; + align-size = <4>; + filename = "u-boot-spl-ddr.bin"; + pad-byte = <0xff>; + + u-boot-spl { + align-end = <4>; + filename = "u-boot-spl.bin"; + }; - ddr-1d-imem-fw { - filename = "lpddr4_pmu_train_1d_imem.bin"; - align-end = <4>; - type = "blob-ext"; - }; + ddr-1d-imem-fw { + filename = "lpddr4_pmu_train_1d_imem.bin"; + align-end = <4>; + type = "blob-ext"; + }; - ddr-1d-dmem-fw { - filename = "lpddr4_pmu_train_1d_dmem.bin"; - align-end = <4>; - type = "blob-ext"; - }; + ddr-1d-dmem-fw { + filename = "lpddr4_pmu_train_1d_dmem.bin"; + align-end = <4>; + type = "blob-ext"; + }; - ddr-2d-imem-fw { - filename = "lpddr4_pmu_train_2d_imem.bin"; - align-end = <4>; - type = "blob-ext"; - }; + ddr-2d-imem-fw { + filename = "lpddr4_pmu_train_2d_imem.bin"; + align-end = <4>; + type = "blob-ext"; + }; - ddr-2d-dmem-fw { - filename = "lpddr4_pmu_train_2d_dmem.bin"; - align-end = <4>; - type = "blob-ext"; + ddr-2d-dmem-fw { + filename = "lpddr4_pmu_train_2d_dmem.bin"; + align-end = <4>; + type = "blob-ext"; + }; }; }; +#ifdef CONFIG_IMX_HAB }; - binman_imx_fit: fit { - description = "Configuration to load ATF before U-Boot"; -#ifndef CONFIG_IMX_HAB - fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>; -#endif - fit,fdt-list = "of-list"; - #address-cells = <1>; + nxp-imx8mcst@1 { + filename = "u-boot-fit.signed.bin"; + nxp,loader-address = <CONFIG_SPL_LOAD_FIT_ADDRESS>; #ifdef CONFIG_FSPI_CONF_HEADER offset = <0x58C00>; #else offset = <0x57c00>; #endif - images { - uboot { - arch = "arm64"; - compression = "none"; - description = "U-Boot (64-bit)"; - load = <CONFIG_TEXT_BASE>; - type = "standalone"; + args; /* Needed by mkimage etype superclass */ +#endif - uboot-blob { - filename = "u-boot-nodtb.bin"; - type = "blob-ext"; + binman_imx_fit: fit { + description = "Configuration to load ATF before U-Boot"; +#ifndef CONFIG_IMX_HAB + fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>; +#endif + fit,fdt-list = "of-list"; + #address-cells = <1>; +#ifdef CONFIG_FSPI_CONF_HEADER + offset = <0x58C00>; +#else + offset = <0x57c00>; +#endif + + images { + uboot { + arch = "arm64"; + compression = "none"; + description = "U-Boot (64-bit)"; + load = <CONFIG_TEXT_BASE>; + type = "standalone"; + + uboot-blob { + filename = "u-boot-nodtb.bin"; + type = "blob-ext"; + }; }; - }; #ifndef CONFIG_ARMV8_PSCI - atf { - arch = "arm64"; - compression = "none"; - description = "ARM Trusted Firmware"; - entry = <0x920000>; - load = <0x920000>; - type = "firmware"; - - atf-blob { - filename = "bl31.bin"; - type = "atf-bl31"; + atf { + arch = "arm64"; + compression = "none"; + description = "ARM Trusted Firmware"; + entry = <0x920000>; + load = <0x920000>; + type = "firmware"; + + atf-blob { + filename = "bl31.bin"; + type = "atf-bl31"; + }; }; - }; #endif - binman_fip: fip { - arch = "arm64"; - compression = "none"; - description = "Trusted Firmware FIP"; - load = <0x40310000>; - type = "firmware"; - }; + binman_fip: fip { + arch = "arm64"; + compression = "none"; + description = "Trusted Firmware FIP"; + load = <0x40310000>; + type = "firmware"; + }; - @fdt-SEQ { - compression = "none"; - description = "NAME"; - type = "flat_dt"; + @fdt-SEQ { + compression = "none"; + description = "NAME"; + type = "flat_dt"; - uboot-fdt-blob { - filename = "u-boot.dtb"; - type = "blob-ext"; + uboot-fdt-blob { + filename = "u-boot.dtb"; + type = "blob-ext"; + }; }; }; - }; - configurations { - default = "@config-DEFAULT-SEQ"; + configurations { + default = "@config-DEFAULT-SEQ"; - @config-SEQ { - description = "NAME"; - fdt = "fdt-SEQ"; - firmware = "uboot"; + @config-SEQ { + description = "NAME"; + fdt = "fdt-SEQ"; + firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI - loadables = "atf"; + loadables = "atf"; #endif + }; }; }; +#ifdef CONFIG_IMX_HAB }; +#endif }; };
arch/arm/dts/imx8mn-u-boot.dtsi +117 -92
264 lines not on this page · raw message
arch/arm/dts/imx8mp-u-boot.dtsi +96 -76
206 lines not on this page · raw message
arch/arm/dts/imx8mq-u-boot.dtsi +101 -81
217 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v4 4/4 imx: hab: Use nxp_imx8mcst etype for i.MX8M flash.bin signing
In reply to Marek VasutUpdate documentation and use nxp_imx8mcst binman etype for signing of flash.bin instead of previous horrible shell scripting.
---
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Adam Ford <[email protected]>
Cc: Alper Nebi Yasak <[email protected]>
Cc: Andrejs Cainikovs <[email protected]>
Cc: Angus Ainslie <[email protected]>
Cc: Emanuele Ghidoli <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Eichenberger <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: Document the automatic signing in case CONFIG_IMX_HAB is enabled
V3: Document configuration of imx8mcst
V4: - Restore CST_DIR/CSF_KEY/IMG_KEY/SRK_TABLE use in documentation
- Add RB from Tim
--- doc/imx/habv4/csf_examples/mx8m/csf.sh | 92 -------------- doc/imx/habv4/csf_examples/mx8m/csf_fit.txt | 30 ----- doc/imx/habv4/csf_examples/mx8m/csf_spl.txt | 33 ----- doc/imx/habv4/guides/mx8m_spl_secure_boot.txt | 114 ++++++------------ 4 files changed, 34 insertions(+), 235 deletions(-) delete mode 100644 doc/imx/habv4/csf_examples/mx8m/csf.sh delete mode 100644 doc/imx/habv4/csf_examples/mx8m/csf_fit.txt delete mode 100644 doc/imx/habv4/csf_examples/mx8m/csf_spl.txt
doc/imx/habv4/csf_examples/mx8m/csf.sh deleted +0 -92
@@ -1,92 +0,0 @@ -#!/bin/sh - -# 0) Generate keys -# -# WARNING: ECDSA keys are only supported by HAB 4.5 and newer (i.e. i.MX8M Plus) -# -# cd /path/to/cst-3.3.1/keys/ -# ./hab4_pki_tree.sh -existing-ca n -use-ecc n -kl 4096 -duration 10 -num-srk 4 -srk-ca y -# cd /path/to/cst-3.3.1/crts/ -# ../linux64/bin/srktool -h 4 -t SRK_1_2_3_4_table.bin -e SRK_1_2_3_4_fuse.bin -d sha256 -c ./SRK1_sha256_4096_65537_v3_ca_crt.pem,./SRK2_sha256_4096_65537_v3_ca_crt.pem,./SRK3_sha256_4096_65537_v3_ca_crt.pem,./SRK4_sha256_4096_65537_v3_ca_crt.pem -f 1 - -# 1) Build U-Boot (e.g. for i.MX8MM) -# -# cp -Lv /path/to/arm-trusted-firmware/build/imx8mm/release/bl31.bin . -# cp -Lv /path/to/firmware-imx-8.14/firmware/ddr/synopsys/ddr3* . -# make -j imx8mm_board_defconfig -# make -j`nproc` flash.bin - -# 2) Sign SPL and DRAM blobs - -cp doc/imx/habv4/csf_examples/mx8m/csf_spl.txt csf_spl.tmp -cp doc/imx/habv4/csf_examples/mx8m/csf_fit.txt csf_fit.tmp - -# update File Paths from env vars -if ! [ -r $CSF_KEY ]; then - echo "Error: \$CSF_KEY not found" - exit 1 -fi -if ! [ -r $IMG_KEY ]; then - echo "Error: \$IMG_KEY not found" - exit 1 -fi -if ! [ -r $SRK_TABLE ]; then - echo "Error: \$SRK_TABLE not found" - exit 1 -fi -sed -i "s:\$CSF_KEY:$CSF_KEY:" csf_spl.tmp -sed -i "s:\$IMG_KEY:$IMG_KEY:" csf_spl.tmp -sed -i "s:\$SRK_TABLE:$SRK_TABLE:" csf_spl.tmp -sed -i "s:\$CSF_KEY:$CSF_KEY:" csf_fit.tmp -sed -i "s:\$IMG_KEY:$IMG_KEY:" csf_fit.tmp -sed -i "s:\$SRK_TABLE:$SRK_TABLE:" csf_fit.tmp - -# update SPL Blocks -spl_block_base=$(printf "0x%x" $(( $(sed -n "/CONFIG_SPL_TEXT_BASE=/ s@.*=@@p" .config) - 0x40)) ) -spl_block_size=$(printf "0x%x" $(stat -tc %s u-boot-spl-ddr.bin)) -sed -i "/Blocks = / s@.*@ Blocks = $spl_block_base 0x0 $spl_block_size \"flash.bin\"@" csf_spl.tmp - -# Generate CSF blob -cst -i csf_spl.tmp -o csf_spl.bin - -# Patch CSF blob into flash.bin -spl_csf_offset=$(xxd -s 24 -l 4 -e flash.bin | cut -d " " -f 2 | sed "s@^@0x@") -spl_bin_offset=$(xxd -s 4 -l 4 -e flash.bin | cut -d " " -f 2 | sed "s@^@0x@") -spl_dd_offset=$((${spl_csf_offset} - ${spl_bin_offset} + 0x40)) -dd if=csf_spl.bin of=flash.bin bs=1 seek=${spl_dd_offset} conv=notrunc - -# 3) Sign u-boot.itb - -# fitImage -fit_block_base=$(printf "0x%x" $(sed -n "/CONFIG_SPL_LOAD_FIT_ADDRESS=/ s@.*=@@p" .config) ) -fit_block_offset=$(printf "0x%s" $(fdtget -t x u-boot.dtb /binman/imx-boot/uboot offset)) -fit_block_size=$(printf "0x%x" $(( ( ( $(stat -tc %s u-boot.itb) + 0x1000 - 0x1 ) & ~(0x1000 - 0x1)) + 0x20 )) ) -sed -i "/Blocks = / s@.*@ Blocks = $fit_block_base $fit_block_offset $fit_block_size \"flash.bin\"@" csf_fit.tmp - -# IVT -ivt_ptr_base=$(printf "%08x" ${fit_block_base} | sed "s@\(..\)\(..\)\(..\)\(..\)@0x\4\3\2\1@") -ivt_block_base=$(printf "%08x" $(( ${fit_block_base} + ${fit_block_size} - 0x20 )) | sed "s@\(..\)\(..\)\(..\)\(..\)@0x\4\3\2\1@") -csf_block_base=$(printf "%08x" $(( ${fit_block_base} + ${fit_block_size} )) | sed "s@\(..\)\(..\)\(..\)\(..\)@0x\4\3\2\1@") -ivt_block_offset=$((${fit_block_offset} + ${fit_block_size} - 0x20)) -csf_block_offset=$((${ivt_block_offset} + 0x20)) - -echo "0xd1002041 ${ivt_block_base} 0x00000000 0x00000000 0x00000000 ${ivt_block_base} ${csf_block_base} 0x00000000" | xxd -r -p > ivt.bin -dd if=ivt.bin of=flash.bin bs=1 seek=${ivt_block_offset} conv=notrunc - -# Generate CSF blob -cst -i csf_fit.tmp -o csf_fit.bin - -# When loading flash.bin via USB, we must ensure that the file being -# served is as large as the target expects (see -# board_spl_fit_size_align()), otherwise the target will hang in -# rom_api_download_image() waiting for the remaining bytes. -# -# Note that in order for dd to actually extend the file, one must not -# pass conv=notrunc here. With a non-zero seek= argument, dd is -# documented to preserve the contents of the file seeked past; in -# particular, dd does not open the file with O_TRUNC. -CSF_SIZE=$(sed -n "/CONFIG_CSF_SIZE=/ s@.*=@@p" .config) -dd if=/dev/null of=csf_fit.bin bs=1 seek=$((CSF_SIZE - 0x20)) count=0 - -# Patch CSF blob into flash.bin -dd if=csf_fit.bin of=flash.bin bs=1 seek=${csf_block_offset} conv=notrunc
doc/imx/habv4/csf_examples/mx8m/csf_fit.txt deleted +0 -30
@@ -1,30 +0,0 @@ -[Header] - Version = 4.3 - Hash Algorithm = sha256 - Engine = CAAM - Engine Configuration = 0 - Certificate Format = X509 - Signature Format = CMS - -[Install SRK] - # SRK_TABLE is full path to SRK_1_2_3_4_table.bin - File = "$SRK_TABLE" - Source index = 0 - -[Install CSFK] - # CSF_KEY is full path to CSF1_1_sha256_4096_65537_v3_usr_crt.pem - File = "$CSF_KEY" - -[Authenticate CSF] - -[Install Key] - Verification index = 0 - Target Index = 2 - # IMG_KEY is full path to IMG1_1_sha256_4096_65537_v3_usr_crt.pem - File = "$IMG_KEY" - -[Authenticate Data] - Verification index = 2 - # FIXME: - # Line 1 -- fitImage - Blocks = CONFIG_SPL_LOAD_FIT_ADDRESS 0x57c00 0xffff "flash.bin"
doc/imx/habv4/csf_examples/mx8m/csf_spl.txt deleted +0 -33
@@ -1,33 +0,0 @@ -[Header] - Version = 4.3 - Hash Algorithm = sha256 - Engine = CAAM - Engine Configuration = 0 - Certificate Format = X509 - Signature Format = CMS - -[Install SRK] - # SRK_TABLE is full path to SRK_1_2_3_4_table.bin - File = "$SRK_TABLE" - Source index = 0 - -[Install CSFK] - # CSF_KEY is full path to CSF1_1_sha256_4096_65537_v3_usr_crt.pem - File = "$CSF_KEY" - -[Authenticate CSF] - -[Unlock] - Engine = CAAM - Features = MID - -[Install Key] - Verification index = 0 - Target Index = 2 - # IMG_KEY is full path to IMG1_1_sha256_4096_65537_v3_usr_crt.pem - File = "$IMG_KEY" - -[Authenticate Data] - Verification index = 2 - # FIXME: Adjust start (first column) and size (third column) here - Blocks = 0x7e0fc0 0x0 0x306f0 "flash.bin"
doc/imx/habv4/guides/mx8m_spl_secure_boot.txt +34 -80
131 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 10 lines · Marek Vasut
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Quoted 2 lines
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>
Applied the series, thanks.
Hi,
Quoted 12 lines · Fabio Estevam
Quoted 10 lines · Marek Vasut
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Quoted 4 lines
Quoted 2 lines
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Applied the series, thanks.
This lacks tests - can you please add sufficient tests in ftest.py to get the cover coverage back to 100%? Please try 'binman test -T' to see this.
Regards,
Simon
Hi again,
Quoted 16 lines · Simon Glass
Hi,
Quoted 12 lines · Fabio Estevam
Quoted 10 lines · Marek Vasut
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.
Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
master:tools/binman/etype/nxp_imx8mimage.py 38 26 32%
next:
tools/binman/btool/cst.py 15 4 73% tools/binman/etype/nxp_imx8mcst.py 78 59 24% tools/binman/etype/nxp_imx8mimage.py 38 26 32%
All the others are 100%.
This is clearly covered in the Binman documentation[1].
I will see if I can add this to CI.
Regards,
Simon
[1] https://docs.u-boot.org/en/latest/develop/package/binman.html#code-coverage
Quoted 22 lines · Simon Glass
Hi again,
Quoted 19 lines · Simon Glass
Hi,
Quoted 15 lines · Fabio Estevam
Quoted 12 lines · Marek Vasut
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
It is in the pipeline.
What exactly is the error you observe ?
When I run binman test -T , I get a lot of output, but no error reports?
Hi Marek,
Quoted 30 lines · Marek Vasut
Quoted 28 lines · Simon Glass
Hi again,
Quoted 24 lines · Simon Glass
Hi,
Quoted 12 lines · Fabio Estevam
Quoted 10 lines · Marek Vasut
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Quoted 4 lines
Quoted 2 lines
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.
Quoted 8 lines
Quoted 2 lines
Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
It is in the pipeline.
What exactly is the error you observe ?
When I run binman test -T , I get a lot of output, but no error reports?
Sorry I somehow missed this email.
The tests are in ftest.py - there are lots of examples, e.g. testXilinxBootgenSigning() - commit d8a2d3b29
Basically you need to create a test .dts file that uses your entry type, then use it in the test code. You can check error handling as well, e.g. by having an invalid dts too if needed.
If you run 'binman test -T' you will see the code-coverage problem. You may need to fetch tools with 'binman tool -f missing' to get all the tools*:
Coverage error: 96%, but should be 100%
ValueError: Test coverage failure
It is normally much easier to add an etype using a test than to test it by using it 'for real', since you don't need to worry about the U-Boot integration.
* There are some annoying things though, such as mkeficapsule being old in the u-boot-tools package so not supporting the tests properly. Also testTIBoardConfigLint needs 'pip install yamllint'
Regards,
Simon
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
Quoted 23 lines
Quoted 23 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
It is in the pipeline.
Quoted 8 lines
Quoted 3 lines
What exactly is the error you observe ?
When I run binman test -T , I get a lot of output, but no error reports?
Sorry I somehow missed this email.
The tests are in
ftest.py- there are lots of examples, e.g.testXilinxBootgenSigning()- commitd8a2d3b29
This seems to be testing some out-of-tree tool , not binman ?
Quoted 8 lines
Basically you need to create a test .dts file that uses your entry type, then use it in the test code. You can check error handling as well, e.g. by having an invalid dts too if needed.
If you run 'binman test -T' you will see the code-coverage problem. You may need to fetch tools with 'binman tool -f missing' to get all the tools*:
Quoted 6 lines
Coverage error: 96%, but should be 100%
ValueError: Test coverage failureIt is normally much easier to add an etype using a test than to test it by using it 'for real', since you don't need to worry about the U-Boot integration.
Huh ...
Hi Marek,
Quoted 31 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
Quoted 25 lines
Quoted 25 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
It is in the pipeline.
What exactly is the error you observe ?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
When I run binman test -T , I get a lot of output, but no error reports?
Sorry I somehow missed this email.
The tests are in
ftest.py- there are lots of examples, e.g.testXilinxBootgenSigning()- commitd8a2d3b29This seems to be testing some out-of-tree tool , not binman ?
It is testing the etype, which needs the tool to be present, yes, You can use 'binman tool -f' to fetch tools if you want to try that one.
Quoted 9 lines
Quoted 9 lines
Basically you need to create a test .dts file that uses your entry type, then use it in the test code. You can check error handling as well, e.g. by having an invalid dts too if needed.
If you run 'binman test -T' you will see the code-coverage problem. You may need to fetch tools with 'binman tool -f missing' to get all the tools*:
Quoted 8 lines
Quoted 6 lines
Coverage error: 96%, but should be 100%
ValueError: Test coverage failureIt is normally much easier to add an etype using a test than to test it by using it 'for real', since you don't need to worry about the U-Boot integration.
Huh ...
Regards,
Simon
Hi Marek,
Quoted 39 lines · Simon Glass
Hi Marek,
Quoted 35 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
Quoted 29 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Quoted 4 lines
Quoted 2 lines
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.Quoted 8 lines
Quoted 2 lines
Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
It is in the pipeline.
What exactly is the error you observe ?
When I run binman test -T , I get a lot of output, but no error reports?
Sorry I somehow missed this email.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
The tests are in
ftest.py- there are lots of examples, e.g.testXilinxBootgenSigning()- commitd8a2d3b29This seems to be testing some out-of-tree tool , not binman ?
It is testing the etype, which needs the tool to be present, yes, You can use 'binman tool -f' to fetch tools if you want to try that one.
We have gone past RC1, so I'm just checking how this is going?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Basically you need to create a test .dts file that uses your entry type, then use it in the test code. You can check error handling as well, e.g. by having an invalid dts too if needed.
If you run 'binman test -T' you will see the code-coverage problem. You may need to fetch tools with 'binman tool -f missing' to get all the tools*:
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Coverage error: 96%, but should be 100%
ValueError: Test coverage failureIt is normally much easier to add an etype using a test than to test it by using it 'for real', since you don't need to worry about the U-Boot integration.
Huh ...
Regards,
Simon
Hi Marek,
Quoted 46 lines · Simon Glass
Hi Marek,
Quoted 42 lines · Simon Glass
Hi Marek,
Quoted 38 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
Quoted 31 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Quoted 4 lines
Quoted 2 lines
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.Quoted 8 lines
Quoted 2 lines
Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
It is in the pipeline.
What exactly is the error you observe ?
When I run binman test -T , I get a lot of output, but no error reports?
Sorry I somehow missed this email.
The tests are in
ftest.py- there are lots of examples, e.g.testXilinxBootgenSigning()- commitd8a2d3b29
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
This seems to be testing some out-of-tree tool , not binman ?
It is testing the etype, which needs the tool to be present, yes, You can use 'binman tool -f' to fetch tools if you want to try that one.
We have gone past RC1, so I'm just checking how this is going?
Are you going to be able to get this test in soon?
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Basically you need to create a test .dts file that uses your entry type, then use it in the test code. You can check error handling as well, e.g. by having an invalid dts too if needed.
If you run 'binman test -T' you will see the code-coverage problem. You may need to fetch tools with 'binman tool -f missing' to get all the tools*:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Coverage error: 96%, but should be 100%
ValueError: Test coverage failureIt is normally much easier to add an etype using a test than to test it by using it 'for real', since you don't need to worry about the U-Boot integration.
Huh ...
Regards,
Simon
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
Quoted 36 lines · Marek Vasut
Quoted 35 lines · Simon Glass
Quoted 1 line
Hi Marek,
Hi,
Quoted 29 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Quoted 4 lines
Quoted 2 lines
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.Quoted 8 lines
Quoted 2 lines
Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
It is in the pipeline.
What exactly is the error you observe ?
When I run binman test -T , I get a lot of output, but no error reports?
Sorry I somehow missed this email.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
The tests are in
ftest.py- there are lots of examples, e.g.testXilinxBootgenSigning()- commitd8a2d3b29This seems to be testing some out-of-tree tool , not binman ?
It is testing the etype, which needs the tool to be present, yes, You can use 'binman tool -f' to fetch tools if you want to try that one.
I'm not getting anywhere with this, can you please draft some example patch how the fix should look like? Otherwise, this is not going to move anywhere I'm afraid.
Thanks
Hi Marek,
Quoted 45 lines · Marek Vasut
Quoted 1 line · Simon Glass
Hi Marek,
Hi,
Quoted 39 lines · Marek Vasut
Quoted 38 lines · Simon Glass
Quoted 1 line
Hi Marek,
Hi,
Quoted 31 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Add new binman etype which allows signing both the SPL and fitImage sections of i.MX8M flash.bin using CST. There are multiple DT properties which govern the signing process, nxp,loader-address is the only mandatory one which sets the SPL signature start address without the imx8mimage header, this should be SPL text base. The key material can be configured using optional DT properties nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material names generated by CST tool scripts. The nxp,unlock property can be used to unlock CAAM access in SPL section.
Quoted 4 lines
Quoted 2 lines
Reviewed-by Tim Harvey <[email protected]>Signed-off-by Marek Vasut <[email protected]>Applied the series, thanks.
This lacks tests - can you please add sufficient tests in
ftest.pyto get the cover coverage back to 100%? Please try 'binman test -T' to see this.Quoted 8 lines
Quoted 2 lines
Any thoughts on this, please? At present -master is broken for one file and -next has three problems.
It is in the pipeline.
What exactly is the error you observe ?
When I run binman test -T , I get a lot of output, but no error reports?
Sorry I somehow missed this email.
The tests are in
ftest.py- there are lots of examples, e.g.testXilinxBootgenSigning()- commitd8a2d3b29
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This seems to be testing some out-of-tree tool , not binman ?
It is testing the etype, which needs the tool to be present, yes, You can use 'binman tool -f' to fetch tools if you want to try that one.
I'm not getting anywhere with this, can you please draft some example patch how the fix should look like? Otherwise, this is not going to move anywhere I'm afraid.
Please see [1]
Regards,
Simon
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/