diff mbox series

[U-Boot,09/12,v2] Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary

Message ID 20190326121642.23302-9-sr@denx.de
State Superseded
Delegated to: Eugen Hristev
Headers show
Series [U-Boot,01/12,v2] arm: at91: Makefile: Compile lowlevel_init only when really necessary | expand

Commit Message

Stefan Roese March 26, 2019, 12:16 p.m. UTC
This patch adds the CONFIG_SPL_IMAGE option to select the SPL image that
shall be used to generate the combined SPL + U-Boot image. The default
value is the current value "spl/u-boot-spl.bin".

This patch also sets CONFIG_SPL_IMAGE to "spl/boot.bin" for AT91 targets
which use SPL NAND support (boot from NAND).

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Andreas Bießmann <andreas@biessmann.org>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
---
v2:
- No change

 Kconfig  | 10 ++++++++++
 Makefile |  4 +++-
 2 files changed, 13 insertions(+), 1 deletion(-)

Comments

Eugen Hristev March 29, 2019, 10:04 a.m. UTC | #1
On 26.03.2019 14:16, Stefan Roese wrote:

> 
> This patch adds the CONFIG_SPL_IMAGE option to select the SPL image that
> shall be used to generate the combined SPL + U-Boot image. The default
> value is the current value "spl/u-boot-spl.bin". >
> This patch also sets CONFIG_SPL_IMAGE to "spl/boot.bin" for AT91 targets
> which use SPL NAND support (boot from NAND).
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Andreas Bießmann <andreas@biessmann.org>
> Cc: Eugen Hristev <eugen.hristev@microchip.com>
> ---
> v2:
> - No change
> 
>   Kconfig  | 10 ++++++++++
>   Makefile |  4 +++-
>   2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/Kconfig b/Kconfig
> index 305b265ed7..7c2b86f1f3 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -224,6 +224,15 @@ config BUILD_ROM
>   	  which are not shipped in the U-Boot source tree.
>   	  Please, see doc/README.x86 for details.
>   
> +config SPL_IMAGE
> +	string "SPL image filename that is generated"
> +	default "spl/boot.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
> +	default "spl/u-boot-spl.bin"

Hi Stefan,

This means that the old spl/u-boot-spl.bin is gone for AT91 and NAND ?
Please correct me if I am wrong

> +	help
> +	  The SPL image filename that is generated by the build process.
> +	  This image might be used to generated a combined image with
> +	  SPL and main U-Boot proper as well.
> +
>   config BUILD_TARGET
>   	string "Build target special images"
>   	default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_ARRIA10
> @@ -232,6 +241,7 @@ config BUILD_TARGET
>   	default "u-boot-elf.srec" if RCAR_GEN3
>   	default "u-boot.itb" if SPL_LOAD_FIT && ARCH_SUNXI
>   	default "u-boot.kwb" if KIRKWOOD
> +	default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT


This means that before this patch, there was no special target for AT91 
? Thus no special image was built ? And after this patch, there will 
also be a new binary u-boot-with-spl.bin, except spl/boot.bin and 
spl/u-boot-spl.bin ?
Thus your patch does a bit more than what it's explained in the commit 
message ?

Thanks,
Eugen


>   	help
>   	  Some SoCs need special image types (e.g. U-Boot binary
>   	  with a special header) as build targets. By defining
> diff --git a/Makefile b/Makefile
> index c1af9307b3..077bb6634e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1225,9 +1225,11 @@ else
>   SPL_PAYLOAD := u-boot.bin
>   endif
>   
> +SPL_IMAGE := $(CONFIG_SPL_IMAGE:"%"=%)
> +
>   OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
>   				   --pad-to=$(CONFIG_SPL_PAD_TO)
> -u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE
> +u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
>   	$(call if_changed,pad_cat)
>   
>   ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
>
Heiko Schocher March 29, 2019, 10:38 a.m. UTC | #2
Hello Stefan,

Am 26.03.2019 um 13:16 schrieb Stefan Roese:
> This patch adds the CONFIG_SPL_IMAGE option to select the SPL image that
> shall be used to generate the combined SPL + U-Boot image. The default
> value is the current value "spl/u-boot-spl.bin".
> 
> This patch also sets CONFIG_SPL_IMAGE to "spl/boot.bin" for AT91 targets
> which use SPL NAND support (boot from NAND).
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Andreas Bießmann <andreas@biessmann.org>
> Cc: Eugen Hristev <eugen.hristev@microchip.com>
> ---
> v2:
> - No change
> 
>   Kconfig  | 10 ++++++++++
>   Makefile |  4 +++-
>   2 files changed, 13 insertions(+), 1 deletion(-)

Reviewed-by: Heiko Schocher <hs@denx.de>
Tested on the taurus board:
Tested-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
Stefan Roese March 29, 2019, 3:53 p.m. UTC | #3
On 29.03.19 11:04, Eugen.Hristev@microchip.com wrote:
> 
> 
> On 26.03.2019 14:16, Stefan Roese wrote:
> 
>>
>> This patch adds the CONFIG_SPL_IMAGE option to select the SPL image that
>> shall be used to generate the combined SPL + U-Boot image. The default
>> value is the current value "spl/u-boot-spl.bin". >
>> This patch also sets CONFIG_SPL_IMAGE to "spl/boot.bin" for AT91 targets
>> which use SPL NAND support (boot from NAND).
>>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: Heiko Schocher <hs@denx.de>
>> Cc: Andreas Bießmann <andreas@biessmann.org>
>> Cc: Eugen Hristev <eugen.hristev@microchip.com>
>> ---
>> v2:
>> - No change
>>
>>    Kconfig  | 10 ++++++++++
>>    Makefile |  4 +++-
>>    2 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/Kconfig b/Kconfig
>> index 305b265ed7..7c2b86f1f3 100644
>> --- a/Kconfig
>> +++ b/Kconfig
>> @@ -224,6 +224,15 @@ config BUILD_ROM
>>    	  which are not shipped in the U-Boot source tree.
>>    	  Please, see doc/README.x86 for details.
>>    
>> +config SPL_IMAGE
>> +	string "SPL image filename that is generated"
>> +	default "spl/boot.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
>> +	default "spl/u-boot-spl.bin"
> 
> Hi Stefan,
> 
> This means that the old spl/u-boot-spl.bin is gone for AT91 and NAND ?
> Please correct me if I am wrong

No, its still there.
  
>> +	help
>> +	  The SPL image filename that is generated by the build process.
>> +	  This image might be used to generated a combined image with
>> +	  SPL and main U-Boot proper as well.
>> +
>>    config BUILD_TARGET
>>    	string "Build target special images"
>>    	default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_ARRIA10
>> @@ -232,6 +241,7 @@ config BUILD_TARGET
>>    	default "u-boot-elf.srec" if RCAR_GEN3
>>    	default "u-boot.itb" if SPL_LOAD_FIT && ARCH_SUNXI
>>    	default "u-boot.kwb" if KIRKWOOD
>> +	default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
> 
> 
> This means that before this patch, there was no special target for AT91
> ? 

Yes.

> Thus no special image was built ?

Yes.

> And after this patch, there will
> also be a new binary u-boot-with-spl.bin, except spl/boot.bin and
> spl/u-boot-spl.bin ?

The old binaries are still generated. Only a new combined image is
generated too.

> Thus your patch does a bit more than what it's explained in the commit
> message ?

Does it? What exactly is missing in the commit message? Please explain
and I'll add something in the next patch version.

Thanks,
Stefan
Eugen Hristev March 29, 2019, 3:59 p.m. UTC | #4
On 29.03.2019 17:53, Stefan Roese wrote:
> External E-Mail
> 
> 
> On 29.03.19 11:04, Eugen.Hristev@microchip.com wrote:
>>
>>
>> On 26.03.2019 14:16, Stefan Roese wrote:
>>
>>>
>>> This patch adds the CONFIG_SPL_IMAGE option to select the SPL image that
>>> shall be used to generate the combined SPL + U-Boot image. The default
>>> value is the current value "spl/u-boot-spl.bin". >
>>> This patch also sets CONFIG_SPL_IMAGE to "spl/boot.bin" for AT91 targets
>>> which use SPL NAND support (boot from NAND).
>>>
>>> Signed-off-by: Stefan Roese <sr@denx.de>
>>> Cc: Heiko Schocher <hs@denx.de>
>>> Cc: Andreas Bießmann <andreas@biessmann.org>
>>> Cc: Eugen Hristev <eugen.hristev@microchip.com>
>>> ---
>>> v2:
>>> - No change
>>>
>>>    Kconfig  | 10 ++++++++++
>>>    Makefile |  4 +++-
>>>    2 files changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Kconfig b/Kconfig
>>> index 305b265ed7..7c2b86f1f3 100644
>>> --- a/Kconfig
>>> +++ b/Kconfig
>>> @@ -224,6 +224,15 @@ config BUILD_ROM
>>>          which are not shipped in the U-Boot source tree.
>>>          Please, see doc/README.x86 for details.
>>> +config SPL_IMAGE
>>> +    string "SPL image filename that is generated"
>>> +    default "spl/boot.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
>>> +    default "spl/u-boot-spl.bin"
>>
>> Hi Stefan,
>>
>> This means that the old spl/u-boot-spl.bin is gone for AT91 and NAND ?
>> Please correct me if I am wrong
> 
> No, its still there.
> 
>>> +    help
>>> +      The SPL image filename that is generated by the build process.
>>> +      This image might be used to generated a combined image with
>>> +      SPL and main U-Boot proper as well.
>>> +
>>>    config BUILD_TARGET
>>>        string "Build target special images"
>>>        default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_ARRIA10
>>> @@ -232,6 +241,7 @@ config BUILD_TARGET
>>>        default "u-boot-elf.srec" if RCAR_GEN3
>>>        default "u-boot.itb" if SPL_LOAD_FIT && ARCH_SUNXI
>>>        default "u-boot.kwb" if KIRKWOOD
>>> +    default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
>>
>>
>> This means that before this patch, there was no special target for AT91
>> ? 
> 
> Yes.
> 
>> Thus no special image was built ?
> 
> Yes.
> 
>> And after this patch, there will
>> also be a new binary u-boot-with-spl.bin, except spl/boot.bin and
>> spl/u-boot-spl.bin ?
> 
> The old binaries are still generated. Only a new combined image is
> generated too.
> 
>> Thus your patch does a bit more than what it's explained in the commit
>> message ?
> 
> Does it? What exactly is missing in the commit message? Please explain
> and I'll add something in the next patch version.

A new binary is generated on build after this patch is applied.
Your commit states that you add a new Kconfig to select the name of a 
file which is included in a generating a binary (which did not exist 
before )

So I see 2 changes: 1) new binary will be created from now on
2) to create this binary a new Kconfig is used which selects one of the 
files used to create it

> 
> Thanks,
> Stefan
Stefan Roese March 29, 2019, 4:12 p.m. UTC | #5
On 29.03.19 16:59, Eugen.Hristev@microchip.com wrote:

<snip>

>>> And after this patch, there will
>>> also be a new binary u-boot-with-spl.bin, except spl/boot.bin and
>>> spl/u-boot-spl.bin ?
>>
>> The old binaries are still generated. Only a new combined image is
>> generated too.
>>
>>> Thus your patch does a bit more than what it's explained in the commit
>>> message ?
>>
>> Does it? What exactly is missing in the commit message? Please explain
>> and I'll add something in the next patch version.
> 
> A new binary is generated on build after this patch is applied.
> Your commit states that you add a new Kconfig to select the name of a
> file which is included in a generating a binary (which did not exist
> before )

This "new binary" is already generated on other platforms (e.g. MVEBU).
So its not introduced with this patch.
  
> So I see 2 changes: 1) new binary will be created from now on
> 2) to create this binary a new Kconfig is used which selects one of the
> files used to create it

I'll add that this "new binary" is now generated for AT91 & SPL_NAND.
Like this:

Makefile: Add Kconfig option CONFIG_SPL_IMAGE to select the SPL binary

This patch adds the CONFIG_SPL_IMAGE option to select the SPL image that
shall be used to generate the combined SPL + U-Boot image. The default
value is the current value "spl/u-boot-spl.bin".

This patch also sets CONFIG_SPL_IMAGE to "spl/boot.bin" for AT91 targets
which use SPL NAND support (boot from NAND). For these build targets the
combined image "u-boot-with-spl.bin" is now automatically generated and
can be programmed into NAND as one single image (vs. SPL image and U-Boot
as 2 separate images).


What do you think?

Thanks,
Stefan
diff mbox series

Patch

diff --git a/Kconfig b/Kconfig
index 305b265ed7..7c2b86f1f3 100644
--- a/Kconfig
+++ b/Kconfig
@@ -224,6 +224,15 @@  config BUILD_ROM
 	  which are not shipped in the U-Boot source tree.
 	  Please, see doc/README.x86 for details.
 
+config SPL_IMAGE
+	string "SPL image filename that is generated"
+	default "spl/boot.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
+	default "spl/u-boot-spl.bin"
+	help
+	  The SPL image filename that is generated by the build process.
+	  This image might be used to generated a combined image with
+	  SPL and main U-Boot proper as well.
+
 config BUILD_TARGET
 	string "Build target special images"
 	default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_ARRIA10
@@ -232,6 +241,7 @@  config BUILD_TARGET
 	default "u-boot-elf.srec" if RCAR_GEN3
 	default "u-boot.itb" if SPL_LOAD_FIT && ARCH_SUNXI
 	default "u-boot.kwb" if KIRKWOOD
+	default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
 	help
 	  Some SoCs need special image types (e.g. U-Boot binary
 	  with a special header) as build targets. By defining
diff --git a/Makefile b/Makefile
index c1af9307b3..077bb6634e 100644
--- a/Makefile
+++ b/Makefile
@@ -1225,9 +1225,11 @@  else
 SPL_PAYLOAD := u-boot.bin
 endif
 
+SPL_IMAGE := $(CONFIG_SPL_IMAGE:"%"=%)
+
 OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
 				   --pad-to=$(CONFIG_SPL_PAD_TO)
-u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE
+u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
 	$(call if_changed,pad_cat)
 
 ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)