Patchwork [U-Boot,v4,6/6] arm, davinci: Add support for generating AIS images to the Makefile

login
register
mail settings
Submitter Christian Riesch
Date Dec. 2, 2011, 4:12 p.m.
Message ID <1322842330-25213-7-git-send-email-christian.riesch@omicron.at>
Download mbox | patch
Permalink /patch/128899/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Christian Riesch - Dec. 2, 2011, 4:12 p.m.
Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 .gitignore |    1 +
 Makefile   |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
Mike Frysinger - Dec. 2, 2011, 9:24 p.m.
On Friday 02 December 2011 11:12:10 Christian Riesch wrote:
> +$(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
> +		$(obj)tools/mkimage -s -n /dev/null -T aisimage \
> +		-e $(CONFIG_SPL_TEXT_BASE) -d $(obj)spl/u-boot-spl.bin \
> +		$(obj)spl/u-boot-spl.ais
> +		$(OBJCOPY) ${OBJCFLAGS} -I binary \
> +		--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
> +		$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
> +		cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.bin > \
> +		$(obj)u-boot.ais

lack of indentation on wrapped lines makes it hard to see what's going on

> +		rm $(obj)spl/u-boot-spl.ais
> +		rm $(obj)spl/u-boot-spl-pad.ais

	rm $(obj)spl/u-boot-spl{,-pad}.ais
-mike
Christian Riesch - Dec. 3, 2011, 5:20 a.m.
Hi Mike,
Thanks for your comments.

On Friday, December 2, 2011, Mike Frysinger <vapier@gentoo.org> wrote:
> On Friday 02 December 2011 11:12:10 Christian Riesch wrote:
>> +$(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
>> +             $(obj)tools/mkimage -s -n /dev/null -T aisimage \
>> +             -e $(CONFIG_SPL_TEXT_BASE) -d $(obj)spl/u-boot-spl.bin \
>> +             $(obj)spl/u-boot-spl.ais
>> +             $(OBJCOPY) ${OBJCFLAGS} -I binary \
>> +             --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
>> +             $(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
>> +             cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.bin > \
>> +             $(obj)u-boot.ais
>
> lack of indentation on wrapped lines makes it hard to see what's going on

I'll change that.

The chaos above contains three commands:
1) I run the SPL through mkimage to add an AIS header for booting from SPI.
Since an empty config file (-n) is sufficient here I use /dev/null here.
2) I pad the result $(obj)spl/u-boot-spl.ais to $CONFIG_SPL_MAX_SIZE with
$(OBJCOPY): The result is $(obj)spl/u-boot-spl-pad.ais
3) Then I add $(obj)u-boot.bin with cat, the result is $(obj)u-boot.ais

>
>> +             rm $(obj)spl/u-boot-spl.ais
>> +             rm $(obj)spl/u-boot-spl-pad.ais
>
>        rm $(obj)spl/u-boot-spl{,-pad}.ais

Ok.

Regards, Christian

> -mike
>
Mike Frysinger - Dec. 3, 2011, 7:08 a.m.
On Saturday 03 December 2011 00:20:19 Christian Riesch wrote:
> The chaos above contains three commands:
> 1) I run the SPL through mkimage to add an AIS header for booting from SPI.
> Since an empty config file (-n) is sufficient here I use /dev/null here.
> 2) I pad the result $(obj)spl/u-boot-spl.ais to $CONFIG_SPL_MAX_SIZE with
> $(OBJCOPY): The result is $(obj)spl/u-boot-spl-pad.ais
> 3) Then I add $(obj)u-boot.bin with cat, the result is $(obj)u-boot.ais

right; i was wondering if we could chain these somehow.  but i guess going 
through intermediate files allows for catching errors that would get missed in 
a pipeline.
-mike

Patch

diff --git a/.gitignore b/.gitignore
index ff4bae0..e4e95e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ 
 /u-boot.dis
 /u-boot.lds
 /u-boot.ubl
+/u-boot.ais
 /u-boot.dtb
 /u-boot.sb
 
diff --git a/Makefile b/Makefile
index fb658f4..5b26f8b 100644
--- a/Makefile
+++ b/Makefile
@@ -417,6 +417,18 @@  $(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		rm $(obj)u-boot-ubl.bin
 		rm $(obj)spl/u-boot-spl-pad.bin
 
+$(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+		$(obj)tools/mkimage -s -n /dev/null -T aisimage \
+		-e $(CONFIG_SPL_TEXT_BASE) -d $(obj)spl/u-boot-spl.bin \
+		$(obj)spl/u-boot-spl.ais
+		$(OBJCOPY) ${OBJCFLAGS} -I binary \
+		--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
+		$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
+		cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.bin > \
+		$(obj)u-boot.ais
+		rm $(obj)spl/u-boot-spl.ais
+		rm $(obj)spl/u-boot-spl-pad.ais
+
 $(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
 		elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \
 			-o $(obj)u-boot.sb
@@ -788,6 +800,7 @@  clobber:	clean
 	@rm -f $(obj)u-boot.kwb
 	@rm -f $(obj)u-boot.imx
 	@rm -f $(obj)u-boot.ubl
+	@rm -f $(obj)u-boot.ais
 	@rm -f $(obj)u-boot.dtb
 	@rm -f $(obj)u-boot.sb
 	@rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes}