diff mbox

[U-Boot,v4,10/11] Add u-boot-pad.bin target to the Makefile

Message ID 1348053927-16021-11-git-send-email-jose.goncalves@inov.pt
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

José Miguel Gonçalves Sept. 19, 2012, 11:25 a.m. UTC
Samsung's S3C24XX SoCs need this in order to generate a binary image
with a padded SPL concatenated with U-Boot.

Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
---
Changes for v2:
   - None

Changes for v3:
   - Changed new binary target name from u-boot-ubl.bin to u-boot-pad.bin

Changes for v4:
   - None
---
 Makefile |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Scott Wood Sept. 19, 2012, 10:39 p.m. UTC | #1
On 09/19/2012 06:25:26 AM, José Miguel Gonçalves wrote:
> Samsung's S3C24XX SoCs need this in order to generate a binary image
> with a padded SPL concatenated with U-Boot.
> 
> Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
> ---
> Changes for v2:
>    - None
> 
> Changes for v3:
>    - Changed new binary target name from u-boot-ubl.bin to  
> u-boot-pad.bin
> 
> Changes for v4:
>    - None
> ---
>  Makefile |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 8738d55..86dedca 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -433,14 +433,15 @@ $(obj)u-boot.sha1:	$(obj)u-boot.bin
>  $(obj)u-boot.dis:	$(obj)u-boot
>  		$(OBJDUMP) -d $< > $@
> 
> -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
> +$(obj)u-boot-pad.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
>  		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary  
> $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
> -		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin >  
> $(obj)u-boot-ubl.bin
> -		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
> -		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin  
> $(obj)u-boot.ubl
> -		rm $(obj)u-boot-ubl.bin
> +		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin >  
> $(obj)u-boot-pad.bin
>  		rm $(obj)spl/u-boot-spl-pad.bin

This rule lists u-boot-spl.bin as a prerequisite, but it doesn't appear  
to use it -- it uses u-boot-spl instead.

It seems that either spl/Makefile should produce u-boot-spl rather than  
u-boot-spl.bin and let the toplevel Makefile deal with converting it to  
a binary, or spl/Makefile should take care of adding any needed padding  
for the target and the final rule should just be a concatenation.

-Scott
Tom Rini Sept. 19, 2012, 11:31 p.m. UTC | #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/19/12 15:39, Scott Wood wrote:
> On 09/19/2012 06:25:26 AM, José Miguel Gonçalves wrote:
>> Samsung's S3C24XX SoCs need this in order to generate a binary
>> image with a padded SPL concatenated with U-Boot.
>> 
>> Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt> 
>> --- Changes for v2: - None
>> 
>> Changes for v3: - Changed new binary target name from
>> u-boot-ubl.bin to u-boot-pad.bin
>> 
>> Changes for v4: - None --- Makefile |   11 ++++++----- 1 file
>> changed, 6 insertions(+), 5 deletions(-)
>> 
>> diff --git a/Makefile b/Makefile index 8738d55..86dedca 100644 
>> --- a/Makefile +++ b/Makefile @@ -433,14 +433,15 @@
>> $(obj)u-boot.sha1:    $(obj)u-boot.bin $(obj)u-boot.dis:
>> $(obj)u-boot $(OBJDUMP) -d $< > $@
>> 
>> -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin
>> $(obj)u-boot.bin +$(obj)u-boot-pad.bin:
>> $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(OBJCOPY) ${OBJCFLAGS}
>> --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl
>> $(obj)spl/u-boot-spl-pad.bin -        cat
>> $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > 
>> $(obj)u-boot-ubl.bin -        $(obj)tools/mkimage -n
>> $(UBL_CONFIG) -T ublimage \ -        -e $(CONFIG_SYS_TEXT_BASE)
>> -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl -        rm
>> $(obj)u-boot-ubl.bin +        cat $(obj)spl/u-boot-spl-pad.bin
>> $(obj)u-boot.bin > $(obj)u-boot-pad.bin rm
>> $(obj)spl/u-boot-spl-pad.bin
> 
> This rule lists u-boot-spl.bin as a prerequisite, but it doesn't
> appear to use it -- it uses u-boot-spl instead.
> 
> It seems that either spl/Makefile should produce u-boot-spl rather
> than u-boot-spl.bin and let the toplevel Makefile deal with
> converting it to a binary, or spl/Makefile should take care of
> adding any needed padding for the target and the final rule should
> just be a concatenation.

So, if we use a weak PAD_TO value of say 0x1, we could always "pad"
u-boot-spl.bin out and then do the concatenation here and in a few
other targets as well.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWlXRAAoJENk4IS6UOR1W2jQP/2LNJnDDVVIuGHuUul5qfTen
6/BJJAp9BGJAtaLjOU/Yl9PxcKoqm7JgrONxBtOeLx3R3otn/drVjgQWgfizSBw6
niXLcisSa8RzTmC2fufyIQLq4Eq4aIJzJs8SV5jT8+cCKiGdwnl4MLv296JEWSOE
rZUJwCEOsO7hPI7nYnbDkgz2UHSVF8ONhWAAghvOdBC0L9MYWMnbpwC8iFFDPFWf
8ilCFJ9bpMRo9PbLm2ukA4wBXf24L/+GWUn6jr7hOHbsfpvqiTV/59TayliqJHSq
aa06KsRq/D8l9kYy7IBb1bJzWb50LW8FiaHcSrAyctf65fDc/wlL6eUnUCIeOfL1
Fs7rfYYfKSe2aGug9KysfPd6m+nEhVe4dL7DtA5Iq2M+vEZ1h4rEOHTNINn2OaW8
jqBjfi/gn/M6QD3EHCHC0Qr2pOUX1BLJEEj4fd/VkKCE3iHiAmt/9g6qiTUdXdWv
5YOXzG8wG/5LlQvPpfNemsapjo+VrppefPIDvtIjFb8bnfOPHB+EKnAJb+JPFoEq
N5Qru35BP5DXggYDzfITDza0qF47CKSR2uGxNT56hS/vsWcirJEa1E0ZPNUg8CaH
YwbhpsXgRn4J3req2rBrCtn9hwtfBfUd0cTeFdY28YAlgv0QKyUNvcL85iCtE9nK
v6i+//5q/nN/Q22hrR9g
=ul+t
-----END PGP SIGNATURE-----
Scott Wood Sept. 19, 2012, 11:36 p.m. UTC | #3
On 09/19/2012 06:31:29 PM, Tom Rini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 09/19/12 15:39, Scott Wood wrote:
> > On 09/19/2012 06:25:26 AM, José Miguel Gonçalves wrote:
> >> Samsung's S3C24XX SoCs need this in order to generate a binary
> >> image with a padded SPL concatenated with U-Boot.
> >>
> >> Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
> >> --- Changes for v2: - None
> >>
> >> Changes for v3: - Changed new binary target name from
> >> u-boot-ubl.bin to u-boot-pad.bin
> >>
> >> Changes for v4: - None --- Makefile |   11 ++++++----- 1 file
> >> changed, 6 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/Makefile b/Makefile index 8738d55..86dedca 100644
> >> --- a/Makefile +++ b/Makefile @@ -433,14 +433,15 @@
> >> $(obj)u-boot.sha1:    $(obj)u-boot.bin $(obj)u-boot.dis:
> >> $(obj)u-boot $(OBJDUMP) -d $< > $@
> >>
> >> -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin
> >> $(obj)u-boot.bin +$(obj)u-boot-pad.bin:
> >> $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(OBJCOPY) ${OBJCFLAGS}
> >> --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl
> >> $(obj)spl/u-boot-spl-pad.bin -        cat
> >> $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin >
> >> $(obj)u-boot-ubl.bin -        $(obj)tools/mkimage -n
> >> $(UBL_CONFIG) -T ublimage \ -        -e $(CONFIG_SYS_TEXT_BASE)
> >> -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl -        rm
> >> $(obj)u-boot-ubl.bin +        cat $(obj)spl/u-boot-spl-pad.bin
> >> $(obj)u-boot.bin > $(obj)u-boot-pad.bin rm
> >> $(obj)spl/u-boot-spl-pad.bin
> >
> > This rule lists u-boot-spl.bin as a prerequisite, but it doesn't
> > appear to use it -- it uses u-boot-spl instead.
> >
> > It seems that either spl/Makefile should produce u-boot-spl rather
> > than u-boot-spl.bin and let the toplevel Makefile deal with
> > converting it to a binary, or spl/Makefile should take care of
> > adding any needed padding for the target and the final rule should
> > just be a concatenation.
> 
> So, if we use a weak PAD_TO value of say 0x1, we could always "pad"
> u-boot-spl.bin out and then do the concatenation here and in a few
> other targets as well.

Yes, or use a variable that includes the linker option, so that it  
expands to an empty string if padding isn't required.

-Scott
Tom Rini Sept. 19, 2012, 11:40 p.m. UTC | #4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/19/12 16:36, Scott Wood wrote:
> On 09/19/2012 06:31:29 PM, Tom Rini wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>> 
>> On 09/19/12 15:39, Scott Wood wrote:
>>> On 09/19/2012 06:25:26 AM, José Miguel Gonçalves wrote:
>>>> Samsung's S3C24XX SoCs need this in order to generate a 
>>>> binary image with a padded SPL concatenated with U-Boot.
>>>> 
>>>> Signed-off-by: José Miguel Gonçalves <jose.goncalves@inov.pt>
>>>> --- Changes for v2: - None
>>>> 
>>>> Changes for v3: - Changed new binary target name from 
>>>> u-boot-ubl.bin to u-boot-pad.bin
>>>> 
>>>> Changes for v4: - None --- Makefile |   11 ++++++----- 1 file
>>>> changed, 6 insertions(+), 5 deletions(-)
>>>> 
>>>> diff --git a/Makefile b/Makefile index 8738d55..86dedca 
>>>> 100644 --- a/Makefile +++ b/Makefile @@ -433,14 +433,15 @@ 
>>>> $(obj)u-boot.sha1:    $(obj)u-boot.bin $(obj)u-boot.dis: 
>>>> $(obj)u-boot $(OBJDUMP) -d $< > $@
>>>> 
>>>> -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin 
>>>> $(obj)u-boot.bin +$(obj)u-boot-pad.bin: 
>>>> $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(OBJCOPY) 
>>>> ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary 
>>>> $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin - cat
>>>> $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > 
>>>> $(obj)u-boot-ubl.bin -        $(obj)tools/mkimage -n 
>>>> $(UBL_CONFIG) -T ublimage \ -        -e 
>>>> $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin 
>>>> $(obj)u-boot.ubl -        rm $(obj)u-boot-ubl.bin + cat
>>>> $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > 
>>>> $(obj)u-boot-pad.bin rm $(obj)spl/u-boot-spl-pad.bin
>>> 
>>> This rule lists u-boot-spl.bin as a prerequisite, but it 
>>> doesn't appear to use it -- it uses u-boot-spl instead.
>>> 
>>> It seems that either spl/Makefile should produce u-boot-spl 
>>> rather than u-boot-spl.bin and let the toplevel Makefile deal 
>>> with converting it to a binary, or spl/Makefile should take 
>>> care of adding any needed padding for the target and the final 
>>> rule should just be a concatenation.
>> 
>> So, if we use a weak PAD_TO value of say 0x1, we could always 
>> "pad" u-boot-spl.bin out and then do the concatenation here and 
>> in a few other targets as well.
> 
> Yes, or use a variable that includes the linker option, so that it
>  expands to an empty string if padding isn't required.

Yes, I don't know if say IMAGE_PAD ?= "" and having boards set that to
- --pad-to=... or just saying --pad-to=$(PAD_SIZE) and PAD_SIZE ?= 0x1
ends up looking cleaner once all is said and done.  First one to try
both and patch... :)

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWlfyAAoJENk4IS6UOR1W4X0P/04JTA9358iiOXrJKUxeZAR0
pVJCzmdiQrlD2Xo7SlApe0s2ZvZL4UvTivmYPlFDcLhpI+ZSkfxHdvXLKNmg//h6
L2ghpAsRtUwZTYgxY1WMvJUuVeh/Pzy8dmJhf5AHwnQ2jAw+SMo3X9jc4e7srCEw
6eSbk/UwG/5WMpLTbUDEp2t9vmSpTkREhv9QvFVeKAzBrSF0fv/OohFIKEx/uuws
HxgXkkzWLox8sp1rCclrNMEFL/EInqa3OSlkF0e2N3514ETHdqBL52qhPWASEz5G
gCHDruxcGTacr1a2ssxURLm5org6ZxlEzywDTluNTnt0VPTOAqCoSLiKL87RQeYB
PrQRWli3r888P+ZG1aOr5OwTxBrgYiynzOGUTkw7FQkf7vF3ak1E2Hvm/7GQCouG
Fm/9aZRDovSk09rbBP7k8M0efV7D5J7PDzRZ6oruIQR6EJu2x64ILyir9HATAUMd
GSjgCDV0BmXYgUJ5I+bLAC/pY9i+aito4lc0Faa1R839tyvP3rvhpFwmAxgOY+97
iFSvpadj0qju/dOouzM250YzLC8a97rvpHQArW4mWw7XPnOh0wSNsfuP/KSrKUUi
YA6gB3DBjUuvT9qTwfwrd/zcYYvZ77nSzlPMcfGOvkpphK+yamv/qogNp7p0Kw43
PtAX09fpq65iVat0ZXtX
=DPv4
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 8738d55..86dedca 100644
--- a/Makefile
+++ b/Makefile
@@ -433,14 +433,15 @@  $(obj)u-boot.sha1:	$(obj)u-boot.bin
 $(obj)u-boot.dis:	$(obj)u-boot
 		$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-pad.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
-		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin
-		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
-		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl
-		rm $(obj)u-boot-ubl.bin
+		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-pad.bin
 		rm $(obj)spl/u-boot-spl-pad.bin
 
+$(obj)u-boot.ubl:       $(obj)spl/u-boot-pad.bin
+		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
+		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-pad.bin $(obj)u-boot.ubl
+
 $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
 		$(obj)tools/mkimage -s -n /dev/null -T aisimage \
 			-e $(CONFIG_SPL_TEXT_BASE) \