Skip to contentSkip to conversation

binman: Add nxp_imx8mimage etype

PATCH Superseded Marek Vasut 5 participants 9 messages Apr 23, 2024 – Nov 8, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 binman: Add nxp_imx8mimage etype

Add new binman etype derived from mkimage etype which generates configuration input file for mkimage -T imx8mimage, and runs the mkimage on input data. The mkimage -T imx8mimage is used to generate combined image with SPL and DDR PHY blobs which is bootable on i.MX8M.

The configuration file generated here is equivalent of imx8mimage.cfg, which is the file passed to '$ mkimage -T imx8mimage -n imx8mimage.cfg ...' . The settings generated into the imx8mimage.cfg file are configured via supported binman DT properties, nxp,boot-from, nxp,loader-address, nxp,rom-version.

---
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]

---
 tools/binman/etype/nxp_imx8mimage.py | 73 ++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 tools/binman/etype/nxp_imx8mimage.py
tools/binman/etype/nxp_imx8mimage.py new file +73 -0
new file mode 100644
index 00000000000..5a106e0a76e
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2023-2024 Marek Vasut <[email protected]>
+# Written with much help from Simon Glass <[email protected]>
+#
+# Entry-type module for generating the i.MX8M mkimage -T imx8mimage
+# configuration file and invocation of mkimage -T imx8mimage on the
+# configuration file and input data.
+#
+
+from collections import OrderedDict
+
+from binman.entry import Entry
+from binman.etype.mkimage import Entry_mkimage
+from binman import elf
+from dtoc import fdt_util
+from u_boot_pylib import tools
+
+class Entry_nxp_imx8mimage(Entry_mkimage):
+    """NXP i.MX8M imx8mimage .cfg file generator and mkimage invoker
+
+    Properties / Entry arguments:
+        - nxp,boot-from - device to boot from (e.g. 'sd')
+        - nxp,loader-address - loader address (SPL text base)
+        - nxp,rom-version - BootROM version ('2' for i.MX8M Nano and Plus)
+    """
+
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node)
+        self.required_props = ['nxp,boot-from', 'nxp,rom-version', 'nxp,loader-address']
+
+    def ReadNode(self):
+        super().ReadNode()
+        self.boot_from = fdt_util.GetString(self._node, 'nxp,boot-from')
+        self.loader_address = fdt_util.GetInt(self._node, 'nxp,loader-address')
+        self.rom_version = fdt_util.GetInt(self._node, 'nxp,rom-version')
+        self.ReadEntries()
+
+    def BuildSectionData(self, required):
+        _, input_fname, uniq = self.collect_contents_to_file(
+            self._entries.values(), 'input')
+        # Generate mkimage configuration file similar to imx8mimage.cfg
+        # and pass it to mkimage to generate SPL image for us here.
+        cfg_fname = tools.get_output_filename('nxp.imx8mimage.cfg.%s' % uniq)
+        with open(cfg_fname, 'w') as outf:
+            print('ROM_VERSION v%d' % self.rom_version, file=outf)
+            print('BOOT_FROM %s' % self.boot_from, file=outf)
+            print('LOADER %s %#x' % (input_fname, self.loader_address), file=outf)
+
+        output_fname = tools.get_output_filename(f'cfg-out.{uniq}')
+        args = ['-d', input_fname, '-n', cfg_fname, '-T', 'imx8mimage',
+                output_fname]
+        if self.mkimage.run_cmd(*args) is not None:
+            return tools.read_file(output_fname)
+        else:
+            # Bintool is missing; just use the input data as the output
+            self.record_missing_bintool(self.mkimage)
+            return data
+
+    def SetImagePos(self, image_pos):
+        # Customized SoC specific SetImagePos which skips the mkimage etype
+        # implementation and removes the 0x48 offset introduced there. That
+        # offset is only used for uImage/fitImage, which is not the case in
+        # here.
+        upto = 0x00
+        for entry in super().GetEntries().values():
+            entry.SetOffsetSize(upto, None)
+
+            # Give up if any entries lack a size
+            if entry.size is None:
+                return
+            upto += entry.size
+
+        super(Entry_mkimage, self).SetImagePos(image_pos)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/3 ARM: dts: imx: Switch Ronetix iMX8MQ-CM to imx8mq-u-boot.dtsi

Include imx8mq-u-boot.dtsi in the board -u-boot.dtsi to pull in binman configuration instead of duplicating it in the board -u-boot.dtsi again. Drop the duplicate binman configuration.

---
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]

---
 arch/arm/dts/imx8mq-cm-u-boot.dtsi | 111 +----------------------------
 1 file changed, 1 insertion(+), 110 deletions(-)
arch/arm/dts/imx8mq-cm-u-boot.dtsi +1 -110
index e23998f5aba..819501337e9 100644
@@ -3,11 +3,7 @@
  * Copyright 2019 NXP
  */
 
-/ {
-	binman: binman {
-		multiple-images;
-	};
-};
+#include "imx8mq-u-boot.dtsi"
 
 &pinctrl_uart1 {
 	bootph-pre-ram;
@@ -16,108 +12,3 @@
 &uart1 {
 	bootph-pre-ram;
 };
-
-&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>;
-		};
-
-		ddr-1d-imem-fw {
-			filename = "lpddr4_pmu_train_1d_imem.bin";
-			type = "blob-ext";
-			align-end = <4>;
-		};
-
-		ddr-1d-dmem-fw {
-			filename = "lpddr4_pmu_train_1d_dmem.bin";
-			type = "blob-ext";
-			align-end = <4>;
-		};
-
-		ddr-2d-imem-fw {
-			filename = "lpddr4_pmu_train_2d_imem.bin";
-			type = "blob-ext";
-			align-end = <4>;
-		};
-
-		ddr-2d-dmem-fw {
-			filename = "lpddr4_pmu_train_2d_dmem.bin";
-			type = "blob-ext";
-			align-end = <4>;
-		};
-	};
-
-	flash {
-		mkimage {
-			args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
-
-			blob {
-				filename = "u-boot-spl-ddr.bin";
-			};
-		};
-	};
-
-	itb {
-		filename = "u-boot.itb";
-
-		fit {
-			description = "Configuration to load ATF before U-Boot";
-			#address-cells = <1>;
-			fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
-
-			images {
-				uboot {
-					description = "U-Boot (64-bit)";
-					type = "standalone";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-
-					uboot_blob: blob-ext {
-						filename = "u-boot-nodtb.bin";
-					};
-				};
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					load = <0x910000>;
-					entry = <0x910000>;
-
-					atf_blob: blob-ext {
-						filename = "bl31.bin";
-					};
-				};
-
-				fdt {
-					description = "NAME";
-					type = "flat_dt";
-					compression = "none";
-
-					uboot_fdt_blob: blob-ext {
-						filename = "u-boot.dtb";
-					};
-				};
-			};
-
-			configurations {
-				default = "conf";
-
-				conf {
-					description = "NAME";
-					firmware = "uboot";
-					loadables = "atf";
-					fdt = "fdt";
-				};
-			};
-		};
-	};
-};
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/3 ARM: dts: imx: Convert i.MX8M flash.bin image generation to binman

In reply to Marek Vasut

Rework the flash.bin image generation such that it uses the new binman nxp_imx8mimage etype. This way, the flash.bin is assembled in correct order using plain binman, without any workarounds or sections assembled in special DT node order.

---
WARNING: This is very likely to break corner case uses, so please do
test this on your platform.
NOTE: This also opens the implementation for proper CST signing etype,
the CST signing would look similar to nxp-imx8mimage section, and it would likely wrap the whole topmost section {} in the binman node.
---
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]

---
 arch/arm/dts/imx8mm-u-boot.dtsi               | 126 ++++++---------
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi    |   8 +-
 arch/arm/dts/imx8mn-u-boot.dtsi               | 147 +++++++-----------
 arch/arm/dts/imx8mp-dhcom-u-boot.dtsi         |   2 +-
 arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi    |   2 +-
 arch/arm/dts/imx8mp-u-boot.dtsi               |  96 +++++-------
 arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi    |  15 +-
 arch/arm/dts/imx8mq-u-boot.dtsi               | 109 +++++--------
 8 files changed, 203 insertions(+), 302 deletions(-)
arch/arm/dts/imx8mm-u-boot.dtsi +49 -77
index 06f2f73a03f..6ab8f66256e 100644
@@ -5,7 +5,6 @@
 
 / {
 	binman: binman {
-		multiple-images;
 	};
 
 #ifdef CONFIG_OPTEE
@@ -43,56 +42,61 @@
 };
 
 &binman {
-	u-boot-spl-ddr {
-		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";
-		};
+	filename = "flash.bin";
+	section {
+		pad-byte = <0x00>;
 
-		ddr-1d-imem-fw {
-			filename = "lpddr4_pmu_train_1d_imem.bin";
-			align-end = <4>;
+#ifdef CONFIG_FSPI_CONF_HEADER
+		fspi_conf_block {
+			filename = CONFIG_FSPI_CONF_FILE;
 			type = "blob-ext";
+			size = <0x1000>;
 		};
+#endif
 
-		ddr-1d-dmem-fw {
-			filename = "lpddr4_pmu_train_1d_dmem.bin";
-			align-end = <4>;
-			type = "blob-ext";
-		};
+		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 */
 
-		ddr-2d-imem-fw {
-			filename = "lpddr4_pmu_train_2d_imem.bin";
-			align-end = <4>;
-			type = "blob-ext";
-		};
+			section {
+				align = <4>;
+				align-size = <4>;
+				filename = "u-boot-spl-ddr.bin";
+				pad-byte = <0xff>;
 
-		ddr-2d-dmem-fw {
-			filename = "lpddr4_pmu_train_2d_dmem.bin";
-			align-end = <4>;
-			type = "blob-ext";
-		};
-	};
+				u-boot-spl {
+					align-end = <4>;
+					filename = "u-boot-spl.bin";
+				};
 
-	spl {
-		filename = "spl.bin";
+				ddr-1d-imem-fw {
+					filename = "lpddr4_pmu_train_1d_imem.bin";
+					align-end = <4>;
+					type = "blob-ext";
+				};
 
-		mkimage {
-			args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
+				ddr-1d-dmem-fw {
+					filename = "lpddr4_pmu_train_1d_dmem.bin";
+					align-end = <4>;
+					type = "blob-ext";
+				};
 
-			blob {
-				filename = "u-boot-spl-ddr.bin";
+				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";
+				};
 			};
 		};
-	};
-
-	itb {
-		filename = "u-boot.itb";
 
 		fit {
 			description = "Configuration to load ATF before U-Boot";
@@ -101,6 +105,11 @@
 #endif
 			fit,fdt-list = "of-list";
 			#address-cells = <1>;
+#ifdef CONFIG_FSPI_CONF_HEADER
+			offset = <0x58C00>;
+#else
+			offset = <0x57c00>;
+#endif
 
 			images {
 				uboot {
@@ -166,43 +175,6 @@
 			};
 		};
 	};
-
-	imx-boot {
-		filename = "flash.bin";
-		pad-byte = <0x00>;
-
-#ifdef CONFIG_FSPI_CONF_HEADER
-		fspi_conf_block {
-			filename = CONFIG_FSPI_CONF_FILE;
-			type = "blob-ext";
-			size = <0x1000>;
-		};
-
-		spl {
-			filename = "spl.bin";
-			offset = <0x1000>;
-			type = "blob-ext";
-		};
-
-		binman_uboot: uboot {
-			filename = "u-boot.itb";
-			offset = <0x58C00>;
-			type = "blob-ext";
-		};
-#else
-		spl {
-			filename = "spl.bin";
-			offset = <0x0>;
-			type = "blob-ext";
-		};
-
-		binman_uboot: uboot {
-			filename = "u-boot.itb";
-			offset = <0x57c00>;
-			type = "blob-ext";
-		};
-#endif
-	};
 };
 
 &clk {
arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi +6 -2
index 8b397f535c1..90183aff8bc 100644
@@ -35,8 +35,12 @@
 	bootph-pre-ram;
 };
 
-&binman_uboot {
-	offset = <0x5fc00>;
+&binman {
+	section {
+		fit {
+			offset = <0x5fc00>;
+		};
+	};
 };
 
 &gpio1 {
arch/arm/dts/imx8mn-u-boot.dtsi +59 -88

192 lines not on this page · raw message

arch/arm/dts/imx8mp-dhcom-u-boot.dtsi +1 -1
index b05be57e71b..cb37e28f28f 100644
@@ -136,7 +136,7 @@
 };
 
 &binman {
-	itb {
+	section {
 		fit {
 			images {
 				fdt-dto-imx8mp-dhcom-som-overlay-eth1xfast {
arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi +1 -1
index 22171bd344e..aff5dcf615d 100644
@@ -136,7 +136,7 @@
 };
 
 &binman {
-	itb {
+	section {
 		fit {
 			images {
 				fip {
arch/arm/dts/imx8mp-u-boot.dtsi +38 -58

127 lines not on this page · raw message

arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi +7 -8
index e3341a46d63..1a4568dac65 100644
@@ -11,14 +11,13 @@
 };
 
 &binman {
-	/delete-node/ signed-hdmi;
-
-	signed-hdmi {
-		filename = "signed_hdmi.bin";
-
-		signed-dp-imx8m {
-			filename = "signed_dp_imx8m.bin";
-			type = "blob-ext";
+	section {
+		nxp-imx8mimage {
+			section {
+				signed-hdmi-imx8m {
+					filename = "signed_dp_imx8m.bin";
+				};
+			};
 		};
 	};
 };
arch/arm/dts/imx8mq-u-boot.dtsi +42 -67

135 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by Tested-by on v1 3/3
#3 lore raw

Re: [PATCH 3/3] ARM: dts: imx: Convert i.MX8M flash.bin image generation to binman

Quoted 6 lines · Marek Vasut

Rework the flash.bin image generation such that it uses the new binman nxp_imx8mimage etype. This way, the flash.bin is assembled in correct order using plain binman, without any workarounds or sections assembled in special DT node order.

Quoted 8 lines

---
WARNING: This is very likely to break corner case uses, so please do
test this on your platform.
NOTE: This also opens the implementation for proper CST signing etype,
the CST signing would look similar to nxp-imx8mimage section, and it would likely wrap the whole topmost section {} in the binman node.

Marek,

Thanks - this is neat and I look forward to seeing a CST signing etype!

I did test this on imx8mm_venice_defconfig and it worked great:

This likely paves the way for removing IMX_CONFIG

Best Regards,

Tim

reviewer Tested-by
#4 lore raw

Re: [PATCH 3/3] ARM: dts: imx: Convert i.MX8M flash.bin image generation to binman

Quoted 8 lines · Tim Harvey

Marek,

Thanks - this is neat and I look forward to seeing a CST signing etype!

I did test this on imx8mm_venice_defconfig and it worked great:

I tested on imx8mm-evk and imx8mn-evk, thanks!

#5 lore raw

Re: [PATCH 3/3] ARM: dts: imx: Convert i.MX8M flash.bin image generation to binman

In reply to Tim Harvey
Quoted 16 lines · Tim Harvey
Quoted 6 lines · Marek Vasut

Rework the flash.bin image generation such that it uses the new binman nxp_imx8mimage etype. This way, the flash.bin is assembled in correct order using plain binman, without any workarounds or sections assembled in special DT node order.

Quoted 8 lines

---
WARNING: This is very likely to break corner case uses, so please do
test this on your platform.
NOTE: This also opens the implementation for proper CST signing etype,
the CST signing would look similar to nxp-imx8mimage section, and it would likely wrap the whole topmost section {} in the binman node.

Quoted 3 lines

Marek,

Thanks - this is neat and I look forward to seeing a CST signing etype!

The whole collected batch of patches is here:

https://source.denx.de/u-boot/custodians/u-boot-usb/-/commits/test-cst?ref_type=heads

I believe this will need tweaking, we will probably need more DT properties to configure the content of the CST config file more precisely. But this could be a start.

#6 lore raw

Re: [PATCH 3/3] ARM: dts: imx: Convert i.MX8M flash.bin image generation to binman

In reply to Marek Vasut
Quoted 8 lines · Marek Vasut

Rework the flash.bin image generation such that it uses the new binman nxp_imx8mimage etype. This way, the flash.bin is assembled in correct order using plain binman, without any workarounds or sections assembled in special DT node order.

---

This introduced a regression on the 8M Nano with CONFIG_FSPI_CONF_HEADER set. As is, the board doesn't appear to do anything.

Looking at the binary blob that is generated, the offset for the SPL phase is missing, so SPL starts at 0x5c0 instead of 0x1000, but adding offset = <0x1000> isn't sufficient.

Adding the offset = <0x1000> starts the SPL phase, but it hangs right away and doesn't past the version message:
U-Boot SPL 2024.07-rc1-00155-g37e50627ef-dirty (Nov 06 2024 - 19:16:52 -0600)

<hangs here>

I have only tested this on a Nano, but I think the issue would likely affect Plus since their boot ROM is similar. I currently don't have a Mini in my possession right now, so I cannot verify the behavior on it.

From what I can tell, reverting this patch appears to restore boot
operation. I don't know enough about the mkimage tool, but I have
tried changing nxp,boot-from and that doesn't seem to fix it either.

When I diff the binaries, it looks like a fairly significant about of the values have changed, but the various magic numbers and offets appear correct. This makes me wonder if setting the offsets being passed to mkimage are getting in the way.

If remove the references to CONFIG_FSPI_CONF_HEADER in the device tree, a regular image is built. I then use dd to create a new file which has the FSPI header at 0x400, and moves the beginning of the rest of the image to 0x1000. This process boots the board just fine. This leads me to believe that something in the imx8 mkimage tool is doing something different when fspi is enabled.

U-Boot SPL 2024.07-rc1-00155-g37e50627ef-dirty (Nov 06 2024 - 19:43:47 -0600)
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout)
Trying to boot from BOOTROM
Boot Stage: Primary boot
image offset 0x1000, pagesize 0x1, ivt offset 0x0

NOTICE:  Do not release JR0 to NS as it can be used by HAB
NOTICE:  BL31: lts-v2.8.10(release):lts-v2.8.10-327-g0d8623944
NOTICE:  BL31: Built : 21:43:36, Nov 13 2023

U-Boot 2024.07-rc1-00155-g37e50627ef-dirty (Nov 06 2024 - 19:43:47 -0600)

CPU:   Freescale i.MX8MNano Solo rev1.0 at 1200 MHz
Reset cause: POR
Model: Beacon EmbeddedWorks i.MX8M Nano Development Kit
DRAM:  1 GiB
Core:  110 devices, 26 uclasses, devicetree: separate
WDT:   Started watchdog@30280000 with servicing every 1000ms (60s timeout)
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from nowhere... OK
In:    serial@30890000
Out:   serial@30890000
Err:   serial@30890000
SEC0:  RNG instantiated

Net:
Warning: ethernet@30be0000 (eth0) using random MAC address - de:2b:92:7d:8d:fe
eth0: ethernet@30be0000
Hit any key to stop autoboot: 0
u-boot=>

I'd like to rework the binman to build a standard flash.bin without the Flexspi stuff, then create a second file like fspi.bin (or something similar) which inserts the FSPI header at 0x400 and then just places the entirely of flash.bin contents placed at 0x1000 in a way that doesn't pass these offsets to imx8 mkimage tool.

Any ideas how to do this? I am not all that familiar with binman. A similar question was asked before on another thread too.

adam

adam

Quoted 756 lines

WARNING: This is very likely to break corner case uses, so please do
test this on your platform.
NOTE: This also opens the implementation for proper CST signing etype,
the CST signing would look similar to nxp-imx8mimage section, and it would likely wrap the whole topmost section {} in the binman node.
---
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]

---
 arch/arm/dts/imx8mm-u-boot.dtsi               | 126 ++++++---------
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi    |   8 +-
 arch/arm/dts/imx8mn-u-boot.dtsi               | 147 +++++++-----------
 arch/arm/dts/imx8mp-dhcom-u-boot.dtsi         |   2 +-
 arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi    |   2 +-
 arch/arm/dts/imx8mp-u-boot.dtsi               |  96 +++++-------
 arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi    |  15 +-
 arch/arm/dts/imx8mq-u-boot.dtsi               | 109 +++++--------
 8 files changed, 203 insertions(+), 302 deletions(-)
arch/arm/dts/imx8mm-u-boot.dtsi +49 -77
index 06f2f73a03f..6ab8f66256e 100644
@@ -5,7 +5,6 @@
 
 / {
        binman: binman {
-               multiple-images;
        };
 
 #ifdef CONFIG_OPTEE
@@ -43,56 +42,61 @@
 };
 
 &binman {
-       u-boot-spl-ddr {
-               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";
-               };
+       filename = "flash.bin";
+       section {
+               pad-byte = <0x00>;
 
-               ddr-1d-imem-fw {
-                       filename = "lpddr4_pmu_train_1d_imem.bin";
-                       align-end = <4>;
+#ifdef CONFIG_FSPI_CONF_HEADER
+               fspi_conf_block {
+                       filename = CONFIG_FSPI_CONF_FILE;
                        type = "blob-ext";
+                       size = <0x1000>;
                };
+#endif
 
-               ddr-1d-dmem-fw {
-                       filename = "lpddr4_pmu_train_1d_dmem.bin";
-                       align-end = <4>;
-                       type = "blob-ext";
-               };
+               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 */
 
-               ddr-2d-imem-fw {
-                       filename = "lpddr4_pmu_train_2d_imem.bin";
-                       align-end = <4>;
-                       type = "blob-ext";
-               };
+                       section {
+                               align = <4>;
+                               align-size = <4>;
+                               filename = "u-boot-spl-ddr.bin";
+                               pad-byte = <0xff>;
 
-               ddr-2d-dmem-fw {
-                       filename = "lpddr4_pmu_train_2d_dmem.bin";
-                       align-end = <4>;
-                       type = "blob-ext";
-               };
-       };
+                               u-boot-spl {
+                                       align-end = <4>;
+                                       filename = "u-boot-spl.bin";
+                               };
 
-       spl {
-               filename = "spl.bin";
+                               ddr-1d-imem-fw {
+                                       filename = "lpddr4_pmu_train_1d_imem.bin";
+                                       align-end = <4>;
+                                       type = "blob-ext";
+                               };
 
-               mkimage {
-                       args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
+                               ddr-1d-dmem-fw {
+                                       filename = "lpddr4_pmu_train_1d_dmem.bin";
+                                       align-end = <4>;
+                                       type = "blob-ext";
+                               };
 
-                       blob {
-                               filename = "u-boot-spl-ddr.bin";
+                               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";
+                               };
                        };
                };
-       };
-
-       itb {
-               filename = "u-boot.itb";
 
                fit {
                        description = "Configuration to load ATF before U-Boot";
@@ -101,6 +105,11 @@
 #endif
                        fit,fdt-list = "of-list";
                        #address-cells = <1>;
+#ifdef CONFIG_FSPI_CONF_HEADER
+                       offset = <0x58C00>;
+#else
+                       offset = <0x57c00>;
+#endif
 
                        images {
                                uboot {
@@ -166,43 +175,6 @@
                        };
                };
        };
-
-       imx-boot {
-               filename = "flash.bin";
-               pad-byte = <0x00>;
-
-#ifdef CONFIG_FSPI_CONF_HEADER
-               fspi_conf_block {
-                       filename = CONFIG_FSPI_CONF_FILE;
-                       type = "blob-ext";
-                       size = <0x1000>;
-               };
-
-               spl {
-                       filename = "spl.bin";
-                       offset = <0x1000>;
-                       type = "blob-ext";
-               };
-
-               binman_uboot: uboot {
-                       filename = "u-boot.itb";
-                       offset = <0x58C00>;
-                       type = "blob-ext";
-               };
-#else
-               spl {
-                       filename = "spl.bin";
-                       offset = <0x0>;
-                       type = "blob-ext";
-               };
-
-               binman_uboot: uboot {
-                       filename = "u-boot.itb";
-                       offset = <0x57c00>;
-                       type = "blob-ext";
-               };
-#endif
-       };
 };
 
 &clk {
arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi +6 -2
index 8b397f535c1..90183aff8bc 100644
@@ -35,8 +35,12 @@
        bootph-pre-ram;
 };
 
-&binman_uboot {
-       offset = <0x5fc00>;
+&binman {
+       section {
+               fit {
+                       offset = <0x5fc00>;
+               };
+       };
 };
 
 &gpio1 {
arch/arm/dts/imx8mn-u-boot.dtsi +59 -88
index 96b1a1bc802..ba9967dbe4a 100644
@@ -5,7 +5,6 @@
 
 / {
        binman: binman {
-               multiple-images;
        };
 
 #ifdef CONFIG_OPTEE
@@ -92,78 +91,83 @@
 };
 
 &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>;
-                       filename = "u-boot-spl.bin";
+       filename = "flash.bin";
+       section {
+               pad-byte = <0x00>;
+
+#ifdef CONFIG_FSPI_CONF_HEADER
+               fspi_conf_block {
+                       filename = CONFIG_FSPI_CONF_FILE;
+                       type = "blob-ext";
+                       offset = <0x400>;
                };
+#endif
 
-               ddr-1d-imem-fw {
+               nxp-imx8mimage {
+                       filename = "u-boot-spl-mkimage.bin";
+                       nxp,boot-from = "sd";
+                       nxp,rom-version = <2>;
+                       nxp,loader-address = <CONFIG_SPL_TEXT_BASE>;
+                       args;   /* Needed by mkimage etype superclass */
+
+                       section {
+                               filename = "u-boot-spl-ddr.bin";
+                               pad-byte = <0xff>;
+                               align-size = <4>;
+                               align = <4>;
+
+                               u-boot-spl {
+                                       align-end = <4>;
+                                       filename = "u-boot-spl.bin";
+                               };
+
+                               ddr-1d-imem-fw {
 #ifdef CONFIG_IMX8M_LPDDR4
-                       filename = "lpddr4_pmu_train_1d_imem.bin";
+                                       filename = "lpddr4_pmu_train_1d_imem.bin";
 #elif CONFIG_IMX8M_DDR4
-                       filename = "ddr4_imem_1d_201810.bin";
+                                       filename = "ddr4_imem_1d_201810.bin";
 #else
-                       filename = "ddr3_imem_1d.bin";
+                                       filename = "ddr3_imem_1d.bin";
 #endif
-                       type = "blob-ext";
-                       align-end = <4>;
-               };
+                                       type = "blob-ext";
+                                       align-end = <4>;
+                               };
 
-               ddr-1d-dmem-fw {
+                               ddr-1d-dmem-fw {
 #ifdef CONFIG_IMX8M_LPDDR4
-                       filename = "lpddr4_pmu_train_1d_dmem.bin";
+                                       filename = "lpddr4_pmu_train_1d_dmem.bin";
 #elif CONFIG_IMX8M_DDR4
-                       filename = "ddr4_dmem_1d_201810.bin";
+                                       filename = "ddr4_dmem_1d_201810.bin";
 #else
-                       filename = "ddr3_dmem_1d.bin";
+                                       filename = "ddr3_dmem_1d.bin";
 #endif
-                       type = "blob-ext";
-                       align-end = <4>;
-               };
+                                       type = "blob-ext";
+                                       align-end = <4>;
+                               };
 
 #if defined(CONFIG_IMX8M_LPDDR4) || defined(CONFIG_IMX8M_DDR4)
-               ddr-2d-imem-fw {
+                               ddr-2d-imem-fw {
 #ifdef CONFIG_IMX8M_LPDDR4
-                       filename = "lpddr4_pmu_train_2d_imem.bin";
+                                       filename = "lpddr4_pmu_train_2d_imem.bin";
 #else
-                       filename = "ddr4_imem_2d_201810.bin";
+                                       filename = "ddr4_imem_2d_201810.bin";
 #endif
-                       type = "blob-ext";
-                       align-end = <4>;
-               };
+                                       type = "blob-ext";
+                                       align-end = <4>;
+                               };
 
-               ddr-2d-dmem-fw {
+                               ddr-2d-dmem-fw {
 #ifdef CONFIG_IMX8M_LPDDR4
-                       filename = "lpddr4_pmu_train_2d_dmem.bin";
+                                       filename = "lpddr4_pmu_train_2d_dmem.bin";
 #else
-                       filename = "ddr4_dmem_2d_201810.bin";
+                                       filename = "ddr4_dmem_2d_201810.bin";
 #endif
-                       type = "blob-ext";
-                       align-end = <4>;
-               };
+                                       type = "blob-ext";
+                                       align-end = <4>;
+                               };
 #endif
-       };
-
-       spl {
-               filename = "spl.bin";
-
-               mkimage {
-                       args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x912000";
-
-                       blob {
-                               filename = "u-boot-spl-ddr.bin";
                        };
                };
-       };
-
-       itb {
-               filename = "u-boot.itb";
 
                fit {
                        description = "Configuration to load ATF before U-Boot";
@@ -172,6 +176,11 @@
 #endif
                        fit,fdt-list = "of-list";
                        #address-cells = <1>;
+#ifdef CONFIG_FSPI_CONF_HEADER
+                       offset = <0x59000>;
+#else
+                       offset = <0x58000>;
+#endif
 
                        images {
                                uboot {
@@ -237,42 +246,4 @@
                        };
                };
        };
-
-       imx-boot {
-               filename = "flash.bin";
-               pad-byte = <0x00>;
-
-#ifdef CONFIG_FSPI_CONF_HEADER
-               fspi_conf_block {
-                       filename = CONFIG_FSPI_CONF_FILE;
-                       type = "blob-ext";
-                       offset = <0x400>;
-               };
-
-               spl {
-                       filename = "spl.bin";
-                       offset = <0x1000>;
-                       type = "blob-ext";
-               };
-
-               binman_uboot: uboot {
-                       filename = "u-boot.itb";
-                       offset = <0x59000>;
-                       type = "blob-ext";
-               };
-#else
-
-               spl {
-                       offset = <0x0>;
-                       filename = "spl.bin";
-                       type = "blob-ext";
-               };
-
-               binman_uboot: uboot {
-                       offset = <0x58000>;
-                       filename = "u-boot.itb";
-                       type = "blob-ext";
-               };
-#endif
-       };
 };
arch/arm/dts/imx8mp-dhcom-u-boot.dtsi +1 -1
index b05be57e71b..cb37e28f28f 100644
@@ -136,7 +136,7 @@
 };
 
 &binman {
-       itb {
+       section {
                fit {
                        images {
                                fdt-dto-imx8mp-dhcom-som-overlay-eth1xfast {
arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi +1 -1
index 22171bd344e..aff5dcf615d 100644
@@ -136,7 +136,7 @@
 };
 
 &binman {
-       itb {
+       section {
                fit {
                        images {
                                fip {
arch/arm/dts/imx8mp-u-boot.dtsi +38 -58
index 4fadcaea509..c4c1a177102 100644
@@ -6,7 +6,6 @@
 
 / {
        binman: binman {
-               multiple-images;
        };
 
 #ifdef CONFIG_OPTEE
@@ -83,55 +82,52 @@
 #endif
 
 &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>;
-               };
+       filename = "flash.bin";
+       section {
+               pad-byte = <0x00>;
 
-               ddr-1d-imem-fw {
-                       filename = "lpddr4_pmu_train_1d_imem_202006.bin";
-                       type = "blob-ext";
-                       align-end = <4>;
-               };
+               nxp-imx8mimage {
+                       filename = "u-boot-spl-mkimage.bin";
+                       nxp,boot-from = "sd";
+                       nxp,rom-version = <2>;
+                       nxp,loader-address = <CONFIG_SPL_TEXT_BASE>;
+                       args;   /* Needed by mkimage etype superclass */
 
-               ddr-1d-dmem-fw {
-                       filename = "lpddr4_pmu_train_1d_dmem_202006.bin";
-                       type = "blob-ext";
-                       align-end = <4>;
-               };
+                       section {
+                               filename = "u-boot-spl-ddr.bin";
+                               pad-byte = <0xff>;
+                               align-size = <4>;
+                               align = <4>;
 
-               ddr-2d-imem-fw {
-                       filename = "lpddr4_pmu_train_2d_imem_202006.bin";
-                       type = "blob-ext";
-                       align-end = <4>;
-               };
+                               u-boot-spl {
+                                       align-end = <4>;
+                               };
 
-               ddr-2d-dmem-fw {
-                       filename = "lpddr4_pmu_train_2d_dmem_202006.bin";
-                       type = "blob-ext";
-                       align-end = <4>;
-               };
-       };
+                               ddr-1d-imem-fw {
+                                       filename = "lpddr4_pmu_train_1d_imem_202006.bin";
+                                       type = "blob-ext";
+                                       align-end = <4>;
+                               };
 
-       spl {
-               filename = "spl.bin";
+                               ddr-1d-dmem-fw {
+                                       filename = "lpddr4_pmu_train_1d_dmem_202006.bin";
+                                       type = "blob-ext";
+                                       align-end = <4>;
+                               };
 
-               mkimage {
-                       args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x920000";
+                               ddr-2d-imem-fw {
+                                       filename = "lpddr4_pmu_train_2d_imem_202006.bin";
+                                       type = "blob-ext";
+                                       align-end = <4>;
+                               };
 
-                       blob {
-                               filename = "u-boot-spl-ddr.bin";
+                               ddr-2d-dmem-fw {
+                                       filename = "lpddr4_pmu_train_2d_dmem_202006.bin";
+                                       type = "blob-ext";
+                                       align-end = <4>;
+                               };
                        };
                };
-       };
-
-       itb {
-               filename = "u-boot.itb";
 
                fit {
                        description = "Configuration to load ATF before U-Boot";
@@ -140,6 +136,7 @@
 #endif
                        fit,fdt-list = "of-list";
                        #address-cells = <1>;
+                       offset = <0x58000>;
 
                        images {
                                uboot {
@@ -195,21 +192,4 @@
                        };
                };
        };
-
-       imx-boot {
-               filename = "flash.bin";
-               pad-byte = <0x00>;
-
-               spl {
-                       filename = "spl.bin";
-                       offset = <0x0>;
-                       type = "blob-ext";
-               };
-
-               binman_uboot: uboot {
-                       filename = "u-boot.itb";
-                       offset = <0x58000>;
-                       type = "blob-ext";
-               };
-       };
 };
arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi +7 -8
index e3341a46d63..1a4568dac65 100644
@@ -11,14 +11,13 @@
 };
 
 &binman {
-       /delete-node/ signed-hdmi;
-
-       signed-hdmi {
-               filename = "signed_hdmi.bin";
-
-               signed-dp-imx8m {
-                       filename = "signed_dp_imx8m.bin";
-                       type = "blob-ext";
+       section {
+               nxp-imx8mimage {
+                       section {
+                               signed-hdmi-imx8m {
+                                       filename = "signed_dp_imx8m.bin";
+                               };
+                       };
                };
        };
 };
arch/arm/dts/imx8mq-u-boot.dtsi +42 -68
index 90b2274754b..48dbe94f0c4 100644
@@ -5,7 +5,6 @@
 
 / {
        binman: binman {
-               multiple-images;
        };
 
 };
@@ -35,65 +34,58 @@
 };
 
 &binman {
-       u-boot-spl-ddr {
-               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";
-               };
+       filename = "flash.bin";
+       section {
+               pad-byte = <0x00>;
 
-               ddr-1d-imem-fw {
-                       filename = "lpddr4_pmu_train_1d_imem.bin";
-                       align-end = <4>;
-                       type = "blob-ext";
-               };
+               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 */
 
-               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";
-               };
+                       section {
+                               align = <4>;
+                               align-size = <4>;
+                               filename = "u-boot-spl-ddr.bin";
+                               pad-byte = <0xff>;
 
-               ddr-2d-dmem-fw {
-                       filename = "lpddr4_pmu_train_2d_dmem.bin";
-                       align-end = <4>;
-                       type = "blob-ext";
-               };
-       };
+                               u-boot-spl {
+                                       align-end = <4>;
+                                       filename = "u-boot-spl.bin";
+                               };
 
-       signed-hdmi {
-               filename = "signed_hdmi.bin";
+                               ddr-1d-imem-fw {
+                                       filename = "lpddr4_pmu_train_1d_imem.bin";
+                                       align-end = <4>;
+                                       type = "blob-ext";
+                               };
 
-               signed-hdmi-imx8m {
-                       filename = "signed_hdmi_imx8m.bin";
-                       type = "blob-ext";
-               };
-       };
+                               ddr-1d-dmem-fw {
+                                       filename = "lpddr4_pmu_train_1d_dmem.bin";
+                                       align-end = <4>;
+                                       type = "blob-ext";
+                               };
 
-       spl {
-               filename = "spl.bin";
+                               ddr-2d-imem-fw {
+                                       filename = "lpddr4_pmu_train_2d_imem.bin";
+                                       align-end = <4>;
+                                       type = "blob-ext";
+                               };
 
-               mkimage {
-                       args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
+                               ddr-2d-dmem-fw {
+                                       filename = "lpddr4_pmu_train_2d_dmem.bin";
+                                       align-end = <4>;
+                                       type = "blob-ext";
+                               };
 
-                       blob {
-                               filename = "u-boot-spl-ddr.bin";
+                               signed-hdmi-imx8m {
+                                       filename = "signed_hdmi_imx8m.bin";
+                                       type = "blob-ext";
+                               };
                        };
                };
-       };
-
-       itb {
-               filename = "u-boot.itb";
 
                fit {
                        description = "Configuration to load ATF before U-Boot";
@@ -158,21 +150,4 @@
                        };
                };
        };
-
-       imx-boot {
-               filename = "flash.bin";
-               pad-byte = <0x00>;
-
-               spl {
-                       filename = "spl.bin";
-                       offset = <0x0>;
-                       type = "blob-ext";
-               };
-
-               binman_uboot: uboot {
-                       filename = "u-boot.itb";
-                       offset = <0x57c00>;
-                       type = "blob-ext";
-               };
-       };
 };
--

2.43.0

#7 lore raw

Re: [PATCH 3/3] ARM: dts: imx: Convert i.MX8M flash.bin image generation to binman

Quoted 22 lines · Adam Ford
Quoted 8 lines · Marek Vasut

Rework the flash.bin image generation such that it uses the new binman nxp_imx8mimage etype. This way, the flash.bin is assembled in correct order using plain binman, without any workarounds or sections assembled in special DT node order.

---

This introduced a regression on the 8M Nano with CONFIG_FSPI_CONF_HEADER set. As is, the board doesn't appear to do anything.

Looking at the binary blob that is generated, the offset for the SPL phase is missing, so SPL starts at 0x5c0 instead of 0x1000, but adding offset = <0x1000> isn't sufficient.

Adding the offset = <0x1000> starts the SPL phase, but it hangs right away and doesn't past the version message:
U-Boot SPL 2024.07-rc1-00155-g37e50627ef-dirty (Nov 06 2024 - 19:16:52 -0600)

Quoted 6 lines

<hangs here>

I have only tested this on a Nano, but I think the issue would likely affect Plus since their boot ROM is similar. I currently don't have a Mini in my possession right now, so I cannot verify the behavior on it.

I think Lukasz was able to reproduce it on Mini. I have a few Mini here, but none of them use FSPI.

iMX8MP never supported FSPI ?

Quoted 15 lines

From what I can tell, reverting this patch appears to restore boot
operation. I don't know enough about the mkimage tool, but I have
tried changing nxp,boot-from and that doesn't seem to fix it either.

When I diff the binaries, it looks like a fairly significant about of the values have changed, but the various magic numbers and offets appear correct. This makes me wonder if setting the offsets being passed to mkimage are getting in the way.

If remove the references to CONFIG_FSPI_CONF_HEADER in the device tree, a regular image is built. I then use dd to create a new file which has the FSPI header at 0x400, and moves the beginning of the rest of the image to 0x1000. This process boots the board just fine. This leads me to believe that something in the imx8 mkimage tool is doing something different when fspi is enabled.

[...]

Quoted 5 lines

I'd like to rework the binman to build a standard flash.bin without the Flexspi stuff, then create a second file like fspi.bin (or something similar) which inserts the FSPI header at 0x400 and then just places the entirely of flash.bin contents placed at 0x1000 in a way that doesn't pass these offsets to imx8 mkimage tool.

That looks like a workaround . It would be much better if binman would generate suitable flash.bin blob with FSPI header. Maybe the FSPI header needs to be generated by binman using yet another etype, and the SPL/U-Boot have to be positioned properly according to the binman node content in imx8mm-u-boot.dtsi ?

(I also have hard time with binman tool)

#8 lore raw

Re: [PATCH 3/3] ARM: dts: imx: Convert i.MX8M flash.bin image generation to binman

Hi Marek, Adam

Quoted 61 lines · Adam Ford
Quoted 23 lines · Marek Vasut
Quoted 8 lines

Rework the flash.bin image generation such that it uses the new binman nxp_imx8mimage etype. This way, the flash.bin is assembled in correct order using plain binman, without any workarounds or sections assembled in special DT node order.

---

This introduced a regression on the 8M Nano with CONFIG_FSPI_CONF_HEADER set. As is, the board doesn't appear to do anything.

Looking at the binary blob that is generated, the offset for the SPL phase is missing, so SPL starts at 0x5c0 instead of 0x1000, but adding offset = <0x1000> isn't sufficient.

Adding the offset = <0x1000> starts the SPL phase, but it hangs right away and doesn't past the version message:
U-Boot SPL 2024.07-rc1-00155-g37e50627ef-dirty (Nov 06 2024 - 19:16:52 -0600)

Quoted 6 lines

<hangs here>

I have only tested this on a Nano, but I think the issue would likely affect Plus since their boot ROM is similar. I currently don't have a Mini in my possession right now, so I cannot verify the behavior on it.

I think Lukasz was able to reproduce it on Mini. I have a few Mini here, but none of them use FSPI.

iMX8MP never supported FSPI ?

Quoted 16 lines

From what I can tell, reverting this patch appears to restore boot
operation. I don't know enough about the mkimage tool, but I have
tried changing nxp,boot-from and that doesn't seem to fix it either.

When I diff the binaries, it looks like a fairly significant about of the values have changed, but the various magic numbers and offets appear correct. This makes me wonder if setting the offsets being passed to mkimage are getting in the way.

If remove the references to CONFIG_FSPI_CONF_HEADER in the device tree, a regular image is built. I then use dd to create a new file which has the FSPI header at 0x400, and moves the beginning of the rest of the image to 0x1000. This process boots the board just fine. This leads me to believe that something in the imx8 mkimage tool is doing something different when fspi is enabled.

[...]

Quoted 5 lines

I'd like to rework the binman to build a standard flash.bin without the Flexspi stuff, then create a second file like fspi.bin (or something similar) which inserts the FSPI header at 0x400 and then just places the entirely of flash.bin contents placed at 0x1000 in a way that doesn't pass these offsets to imx8 mkimage tool.

Quoted 7 lines

That looks like a workaround . It would be much better if binman would generate suitable flash.bin blob with FSPI header. Maybe the FSPI header needs to be generated by binman using yet another etype, and the SPL/U-Boot have to be positioned properly according to the binman node content in imx8mm-u-boot.dtsi ?

(I also have hard time with binman tool)

I've managed to nail down which offsets are shifted by 0x1000. The "only" only problem is to add this "fix" to binman... :)

Please refer to below discussion/link:
https://lore.kernel.org/all/CAFLszTh65OkyXnG3L7XTJFK69EYdj4DZwYGxizu4877n-mCw-w@mail.gmail.com/T/

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]