Skip to contentSkip to conversation

imx8mm-evk: Generate a single bootable flash.bin again

PATCH Superseded Fabio Estevam 6 participants 9 messages Aug 18, 2021 – Aug 19, 2021

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx8mm-evk: Generate a single bootable flash.bin again

After the conversion to binman in commit 8996e6b7c6a1 ("imx8mm_evk: switch to use binman to pack images"), it is necessary to flash both flash.bin and u-boot.itb to get a bootable system. Prior to this commit, only flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more descriptive name for its purpose, and can still be used standalone (for example, for secure boot purposes).

---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -1
index f200afac9f..453fe1d259 100644
@@ -150,7 +150,7 @@
 	};
 
 
-       flash {
+	spl {
 		mkimage {
 			args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
 
@@ -217,4 +217,19 @@
 			};
 		};
 	};
+
+	imx-boot {
+		filename = "flash.bin";
+		pad-byte = <0x00>;
+
+		spl: blob-ext@1 {
+			offset = <0x0>;
+			filename = "spl.bin";
+		};
+
+		uboot: blob-ext@2 {
+			offset = <0x57c00>;
+			filename = "u-boot.itb";
+		};
+	};
 };
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Fabio Estevam

After the conversion to binman in commit 8996e6b7c6a1 ("imx8mm_evk: switch to use binman to pack images"), it is necessary to flash both flash.bin and u-boot.itb to get a bootable system. Prior to this commit, only flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the final binary because the extra u-boot.itb is now required.

Quoted 8 lines

Generate a final flash.bin that can be used again as a single bootable binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more descriptive name for its purpose, and can still be used standalone (for example, for secure boot purposes).

Quoted 38 lines
---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -1
index f200afac9f..453fe1d259 100644
@@ -150,7 +150,7 @@
 	};
 
 
-       flash {
+	spl {
 		mkimage {
 			args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
 
@@ -217,4 +217,19 @@
 			};
 		};
 	};
+
+	imx-boot {
+		filename = "flash.bin";
+		pad-byte = <0x00>;
+
+		spl: blob-ext@1 {
+			offset = <0x0>;
+			filename = "spl.bin";
+		};
+
+		uboot: blob-ext@2 {
+			offset = <0x57c00>;
+			filename = "u-boot.itb";
+		};
+	};
 };
#2 lore raw

Hi Fabio,

Quoted 12 lines · Frieder Schrempf
Quoted 11 lines · Fabio Estevam

After the conversion to binman in commit 8996e6b7c6a1 ("imx8mm_evk: switch to use binman to pack images"), it is necessary to flash both flash.bin and u-boot.itb to get a bootable system. Prior to this commit, only flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable binary to keep the original behavior.

Quoted 7 lines
Quoted 5 lines

After this change the SPL binary is called spl.bin, which is a more descriptive name for its purpose, and can still be used standalone (for example, for secure boot purposes).

I tried to adapt this for my own board, but I needed to change the following in the imximage.cfg for the build to pass. Did you test this?

-LOADER         mkimage.flash.mkimage   0x7E1000
+LOADER         mkimage.spl.mkimage     0x7E1000

Best regards
Frieder

Quoted 38 lines
Quoted 38 lines
---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -1
index f200afac9f..453fe1d259 100644
@@ -150,7 +150,7 @@
 	};
 
 
-       flash {
+	spl {
 		mkimage {
 			args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
 
@@ -217,4 +217,19 @@
 			};
 		};
 	};
+
+	imx-boot {
+		filename = "flash.bin";
+		pad-byte = <0x00>;
+
+		spl: blob-ext@1 {
+			offset = <0x0>;
+			filename = "spl.bin";
+		};
+
+		uboot: blob-ext@2 {
+			offset = <0x57c00>;
+			filename = "u-boot.itb";
+		};
+	};
 };
reviewer
#3 lore raw

Hi Frieder,

Review

Quoted 4 lines · Frieder Schrempf

I tried to adapt this for my own board, but I needed to change the following in the imximage.cfg for the build to pass. Did you test this?

(quoted diff) +1 -1
-LOADER         mkimage.flash.mkimage   0x7E1000
+LOADER         mkimage.spl.mkimage     0x7E1000

Interesting. I do not see the build error here.

My patch is against commit 78e786decb6c8 in mainline U-Boot.

Are you able to reproduce the build error on imx8mm-evk too?

Thanks

#4 lore raw
Quoted 7 lines · Fabio Estevam

Hi Frieder,

Quoted 2 lines · Frieder Schrempf

I tried to adapt this for my own board, but I needed to change the following in the imximage.cfg for the build to pass. Did you test this?

Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-LOADER         mkimage.flash.mkimage   0x7E1000
+LOADER         mkimage.spl.mkimage     0x7E1000

Interesting. I do not see the build error here.

My patch is against commit 78e786decb6c8 in mainline U-Boot.

Are you able to reproduce the build error on imx8mm-evk too?

Yes, I'm building against the very same commit from master and I get the following at the end of the build, also for imx8mm-evk:

MKIMAGE u-boot.img
MKIMAGE u-boot-dtb.img
CFGS spl/u-boot-spl.cfgout
BINMAN all
binman: Error 1 running 'mkimage -d ./mkimage.spl.mkimage -n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000 ./mkimage-out.spl.mkimage': mkimage.flash.mkimage: Can't open: No such file or directory

#5 lore raw
In reply to Fabio Estevam

Hi Fabio and Frieder

Quoted 10 lines · Fabio Estevam

Hi Frieder,

Review

Quoted 5 lines · Frieder Schrempf

I tried to adapt this for my own board, but I needed to change the following in the imximage.cfg for the build to pass. Did you test this?

(quoted diff) +1 -1
-LOADER         mkimage.flash.mkimage   0x7E1000
+LOADER         mkimage.spl.mkimage     0x7E1000

Yes, I can copy that. And while investigating I noticed that doing a clean or even a mrproper does not seem to clean any of those mkimage.flash.mkimage or mkimage-out.flash.mkimage.

Quoted 1 line

Interesting.  I do not see the build error here.

So likely, it was just picking up some old stuff for you Fabio. Not sure whether or not we would also want to fix this cleaning issue as it can be quite confusing.

Quoted 3 lines

My patch is against commit 78e786decb6c8 in mainline U-Boot.

Are you able to reproduce the build error on imx8mm-evk too?

Yes, once one does hand clean them old artifacts.

Quoted 1 line

Thanks

Cheers

Marcel

Reviewed-by on v1 1/1
#6 lore raw
In reply to Fabio Estevam

Hello Fabio,

Quoted 11 lines · Fabio Estevam

After the conversion to binman in commit 8996e6b7c6a1 ("imx8mm_evk: switch to use binman to pack images"), it is necessary to flash both flash.bin and u-boot.itb to get a bootable system. Prior to this commit, only flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable binary to keep the original behavior.

Quoted 8 lines

After this change the SPL binary is called spl.bin, which is a more descriptive name for its purpose, and can still be used standalone (for example, for secure boot purposes).

---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#7 lore raw
In reply to Fabio Estevam
Quoted 55 lines · Fabio Estevam

After the conversion to binman in commit 8996e6b7c6a1 ("imx8mm_evk: switch to use binman to pack images"), it is necessary to flash both flash.bin and u-boot.itb to get a bootable system. Prior to this commit, only flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more descriptive name for its purpose, and can still be used standalone (for example, for secure boot purposes).

---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +16 -2
index f200afac9f..453fe1d259 100644
@@ -150,7 +150,7 @@
        };
 
 
-       flash {
+       spl {
                mkimage {
                        args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
 
@@ -217,4 +217,19 @@
                        };
                };
        };
+
+       imx-boot {
+               filename = "flash.bin";
+               pad-byte = <0x00>;
+
+               spl: blob-ext@1 {
+                       offset = <0x0>;
+                       filename = "spl.bin";
+               };
+
+               uboot: blob-ext@2 {
+                       offset = <0x57c00>;
+                       filename = "u-boot.itb";
+               };
+       };
 };
--
Quoted 2 lines

2.25.1

Fabio,

Note that doc/board/freescale/imx8mm_evk.rst will need to be updated after this change as well.

Best regards,

Tim

#8 lore raw
In reply to Fabio Estevam
Quoted 26 lines · Fabio Estevam

After the conversion to binman in commit 8996e6b7c6a1 ("imx8mm_evk: switch to use binman to pack images"), it is necessary to flash both flash.bin and u-boot.itb to get a bootable system. Prior to this commit, only flash.bin was needed.

Such new requirement breaks existing distro mechanisms to generate the final binary because the extra u-boot.itb is now required.

Generate a final flash.bin that can be used again as a single bootable binary to keep the original behavior.

After this change the SPL binary is called spl.bin, which is a more descriptive name for its purpose, and can still be used standalone (for example, for secure boot purposes).

---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-

 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-evk-u-boot.dtsi +0 -0
index f200afac9f..453fe1d259 100644
@@ -150,7 +150,7 @@
         };
Quoted 6 lines



-       flash {
+       spl {
                mkimage {
                        args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";

A second issue I found (besides imximage.cfg needing adjustments as pointed out by Frieder) is that for me it only works if I also explicitly set the filename here to spl.bin e.g. as follows:

			filename = "spl.bin";

Anyway, I am just about to send a patch set updating our Verdin iMX8M Mini to also make use of all this. Stay tuned...

Quoted 20 lines
arch/arm/dts/imx8mm-evk-u-boot.dtsi +15 -0
@@ -217,4 +217,19 @@
                         };
                 };
         };
+
+       imx-boot {
+               filename = "flash.bin";
+               pad-byte = <0x00>;
+
+               spl: blob-ext@1 {
+                       offset = <0x0>;
+                       filename = "spl.bin";
+               };
+
+               uboot: blob-ext@2 {
+                       offset = <0x57c00>;
+                       filename = "u-boot.itb";
+               };
+       };
  };