diff mbox series

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

Message ID 20210818121923.1449177-1-festevam@denx.de
State Superseded
Delegated to: Stefano Babic
Headers show
Series imx8mm-evk: Generate a single bootable flash.bin again | expand

Commit Message

Fabio Estevam Aug. 18, 2021, 12:19 p.m. UTC
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).

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Frieder Schrempf Aug. 18, 2021, 2:07 p.m. UTC | #1
On 18.08.21 14:19, Fabio Estevam wrote:
> 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).
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

> ---
>  arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> index f200afac9f..453fe1d259 100644
> --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> @@ -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";
> +		};
> +	};
>  };
>
Heiko Schocher Aug. 18, 2021, 3:16 p.m. UTC | #2
Hello Fabio,

On 18.08.21 14:19, Fabio Estevam wrote:
> 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).
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
>  arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
Tim Harvey Aug. 18, 2021, 4:56 p.m. UTC | #3
On Wed, Aug 18, 2021 at 5:19 AM Fabio Estevam <festevam@denx.de> wrote:
>
> 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).
>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
>  arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> index f200afac9f..453fe1d259 100644
> --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> @@ -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.25.1
>

Fabio,

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

Best regards,

Tim
Frieder Schrempf Aug. 19, 2021, 6:51 p.m. UTC | #4
Hi Fabio,

On 18.08.21 16:07, Frieder Schrempf wrote:
> On 18.08.21 14:19, Fabio Estevam wrote:
>> 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).
>>
>> Signed-off-by: Fabio Estevam <festevam@denx.de>
> 
> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

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

>> ---
>>  arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
>>  1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
>> index f200afac9f..453fe1d259 100644
>> --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi
>> +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
>> @@ -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";
>> +		};
>> +	};
>>  };
>>
Fabio Estevam Aug. 19, 2021, 6:58 p.m. UTC | #5
Hi Frieder,

On Thu, Aug 19, 2021 at 3:52 PM Frieder Schrempf
<frieder.schrempf@kontron.de> wrote:

> 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

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
Frieder Schrempf Aug. 19, 2021, 7:09 p.m. UTC | #6
On 19.08.21 20:58, Fabio Estevam wrote:
> Hi Frieder,
> 
> On Thu, Aug 19, 2021 at 3:52 PM Frieder Schrempf
> <frieder.schrempf@kontron.de> wrote:
> 
>> 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
> 
> 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
Marcel Ziswiler Aug. 19, 2021, 7:13 p.m. UTC | #7
Hi Fabio and Frieder

On Thu, 2021-08-19 at 15:58 -0300, Fabio Estevam wrote:
> Hi Frieder,
> 
> On Thu, Aug 19, 2021 at 3:52 PM Frieder Schrempf
> <frieder.schrempf@kontron.de> wrote:
> 
> > 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

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.

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

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

> Thanks

Cheers

Marcel
Marcel Ziswiler Aug. 19, 2021, 7:24 p.m. UTC | #8
On Wed, 2021-08-18 at 09:19 -0300, Fabio Estevam wrote:
> 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).
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
>  arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> index f200afac9f..453fe1d259 100644
> --- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> +++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
> @@ -150,7 +150,7 @@
>         };
>  
>  
> -       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...

> @@ -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";
> +               };
> +       };
>  };
diff mbox series

Patch

diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
index f200afac9f..453fe1d259 100644
--- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
@@ -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";
+		};
+	};
 };