diff mbox

[v2] bootwrapper: support u-boot multi component images

Message ID 1221814210-4738-1-git-send-email-jacmet@sunsite.dk (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Peter Korsgaard Sept. 19, 2008, 8:50 a.m. UTC
From: peter Korsgaard <jacmet@sunsite.dk>

Support uImage.<platform>, which are U-Boot multi component images
containing a kernel, dtb and possibly an initrd.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>

Comments

Gerhard Pircher Sept. 19, 2008, 11:26 a.m. UTC | #1
-------- Original-Nachricht --------
> Datum: Fri, 19 Sep 2008 10:50:10 +0200
> Von: Peter Korsgaard <jacmet@sunsite.dk>
> An: linuxppc-dev@ozlabs.org, grant.likely@secretlab.ca
> Betreff: [PATCH v2] bootwrapper: support u-boot multi component images

> From: peter Korsgaard <jacmet@sunsite.dk>
> 
> Support uImage.<platform>, which are U-Boot multi component images
> containing a kernel, dtb and possibly an initrd.
Just out of interest: Do you intend to replace the code for building
cuImage.<platform> (zImage target) with this new build target?

regards,

Gerhard
Peter Korsgaard Sept. 19, 2008, 11:31 a.m. UTC | #2
>>>>> "Gerhard" == Gerhard Pircher <gerhard_pircher@gmx.net> writes:

Hi,

 >> Support uImage.<platform>, which are U-Boot multi component images
 >> containing a kernel, dtb and possibly an initrd.
 Gerhard> Just out of interest: Do you intend to replace the code for building
 Gerhard> cuImage.<platform> (zImage target) with this new build target?

No, they are for different use cases. cuImages are interesting when
you cannot upgrade uboot to add device tree support and you want to
use a new kernel - uImage.% is interesting when you want to use device
trees but you want the simplicity of having a single file (And you
acknowledge the fact that the device tree as it is today is pretty much
kernel version dependent so it makes most sense to keep them in sync).
Grant Likely Sept. 19, 2008, 1:51 p.m. UTC | #3
On Fri, Sep 19, 2008 at 10:50:10AM +0200, Peter Korsgaard wrote:
> From: peter Korsgaard <jacmet@sunsite.dk>
> 
> Support uImage.<platform>, which are U-Boot multi component images
> containing a kernel, dtb and possibly an initrd.
> 
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> v2: Incorporated Grant Likely's feedback.
> 
>  Documentation/powerpc/bootwrapper.txt |    4 ++++
>  arch/powerpc/boot/Makefile            |   11 +++++++++--
>  arch/powerpc/boot/wrapper             |   20 +++++++++++++++++++-
>  3 files changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/powerpc/bootwrapper.txt b/Documentation/powerpc/bootwrapper.txt
> index d60fced..fa2e014 100644
> --- a/Documentation/powerpc/bootwrapper.txt
> +++ b/Documentation/powerpc/bootwrapper.txt
> @@ -91,6 +91,10 @@ Currently, the following image format targets exist:
>  			a device tree to the kernel at boot.  If using an older
>  			version of U-Boot, then you need to use a cuImage
>  			instead.
> +   uImage.%:		U-Boot multi component image. Similar to uImage,
> +			except device tree blob is embedded inside the
> +			image together with the kernel (and potentially
> +			an initrd).
>     zImage.%:		Image format which does not embed a device tree.
>  			Used by OpenFirmware and other firmware interfaces
>  			which are able to supply a device tree.  This image
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 717a3bc..8d2e789 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -282,8 +282,9 @@ image-y	+= $(subst ",,$(CONFIG_EXTRA_TARGETS))
>  initrd-  := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-))
>  initrd-y := $(patsubst zImage%, zImage.initrd%, \
>  		$(patsubst dtbImage%, dtbImage.initrd%, \
> +		$(patsubst uImage.%, uImage.initrd.%, \
>  		$(patsubst simpleImage%, simpleImage.initrd%, \
> -		$(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
> +		$(patsubst treeImage%, treeImage.initrd%, $(image-y))))))
>  initrd-y := $(filter-out $(image-y), $(initrd-y))
>  targets	+= $(image-y) $(initrd-y)
>  
> @@ -316,6 +317,12 @@ $(obj)/zImage.iseries: vmlinux
>  $(obj)/uImage: vmlinux $(wrapperbits)
>  	$(call if_changed,wrap,uboot)
>  
> +$(obj)/uImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb
> +	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
> +
> +$(obj)/uImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
> +	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb)
> +
>  $(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
>  	$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
>  
> @@ -352,7 +359,7 @@ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
>  clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
>  	zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
>  	zImage.iseries zImage.miboot zImage.pmac zImage.pseries \
> -	otheros.bld *.dtb
> +	otheros.bld uImage* *.dtb
>  
>  # clean up files cached by wrapper
>  clean-kernel := vmlinux.strip vmlinux.bin
> diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
> index 965c237..548b087 100755
> --- a/arch/powerpc/boot/wrapper
> +++ b/arch/powerpc/boot/wrapper
> @@ -153,7 +153,7 @@ coff)
>      lds=$object/zImage.coff.lds
>      link_address='0x500000'
>      ;;
> -miboot|uboot)
> +miboot|uboot*)
>      # miboot and U-boot want just the bare bits, not an ELF binary
>      ext=bin
>      objflags="-O binary"
> @@ -262,6 +262,24 @@ uboot)
>      fi
>      exit 0
>      ;;
> +uboot-*)
> +    rm -f "$ofile"
> +    # we always need an initrd - create a dummy initrd if none provided
> +    if [ ! -f "initrd" ]; then
> +	initrd="$tmpdir/dummy.initrd"
> +	echo -n fill >$initrd
> +    fi
> +    mkimage -A ppc -O linux -T multi -C gzip -a $membase -e $membase \
> +	$uboot_version -d "$vmz:$initrd:$dtb" "$ofile"
> +    if [ "$initrd" == "$tmpdir/dummy.initrd" ]; then
> +	rm $initrd;
> +    fi
> +    if [ -z "$cacheit" ]; then
> +	rm -f "$vmz"
> +    fi
> +    exit 0
> +    ;;
> +
>  esac
>  
>  addsec() {
> -- 
> 1.5.6.3
>
Wolfgang Denk Sept. 22, 2008, 7:41 a.m. UTC | #4
Dear Peter Korsgaard,

In message <1221814210-4738-1-git-send-email-jacmet@sunsite.dk> you wrote:
> From: peter Korsgaard <jacmet@sunsite.dk>
> 
> Support uImage.<platform>, which are U-Boot multi component images
> containing a kernel, dtb and possibly an initrd.

NAK.

Please do not add such a patch to mainline.

> +   uImage.%:		U-Boot multi component image. Similar to uImage,
> +			except device tree blob is embedded inside the
> +			image together with the kernel (and potentially
> +			an initrd).

The use of the old multi-file image format in U-Boot  is  deprecated.
It  has  some  severe  limitations,  and we have a much more flexible
solution now.

Please use FIT images instead (see doc/uImage.FIT/*).

Thanks.

Best regards,

Wolfgang Denk
Peter Korsgaard Sept. 22, 2008, 7:55 a.m. UTC | #5
>>>>> "Wolfgang" == Wolfgang Denk <wd@denx.de> writes:

Hi,

 >> Support uImage.<platform>, which are U-Boot multi component images
 >> containing a kernel, dtb and possibly an initrd.

 Wolfgang> NAK.

 Wolfgang> Please do not add such a patch to mainline.

I agree that FIT images probably are the way to go for the future, but
I do think there's room for uImage.% just like we have cuImage.% for
really old uboots.

I'm sure a patch adding FIT images support to bootwrapper would be
appreciated.
Wolfgang Denk Sept. 22, 2008, 10:49 a.m. UTC | #6
Dear Peter,

In message <874p48y5qb.fsf@macbook.be.48ers.dk> you wrote:
> 
>  Wolfgang> NAK.
> 
>  Wolfgang> Please do not add such a patch to mainline.
> 
> I agree that FIT images probably are the way to go for the future, but
> I do think there's room for uImage.% just like we have cuImage.% for
> really old uboots.

I disagree. Adding such support now just encourages people  to  start
using a deprecated feature.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/Documentation/powerpc/bootwrapper.txt b/Documentation/powerpc/bootwrapper.txt
index d60fced..fa2e014 100644
--- a/Documentation/powerpc/bootwrapper.txt
+++ b/Documentation/powerpc/bootwrapper.txt
@@ -91,6 +91,10 @@  Currently, the following image format targets exist:
 			a device tree to the kernel at boot.  If using an older
 			version of U-Boot, then you need to use a cuImage
 			instead.
+   uImage.%:		U-Boot multi component image. Similar to uImage,
+			except device tree blob is embedded inside the
+			image together with the kernel (and potentially
+			an initrd).
    zImage.%:		Image format which does not embed a device tree.
 			Used by OpenFirmware and other firmware interfaces
 			which are able to supply a device tree.  This image
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 717a3bc..8d2e789 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -282,8 +282,9 @@  image-y	+= $(subst ",,$(CONFIG_EXTRA_TARGETS))
 initrd-  := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-))
 initrd-y := $(patsubst zImage%, zImage.initrd%, \
 		$(patsubst dtbImage%, dtbImage.initrd%, \
+		$(patsubst uImage.%, uImage.initrd.%, \
 		$(patsubst simpleImage%, simpleImage.initrd%, \
-		$(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
+		$(patsubst treeImage%, treeImage.initrd%, $(image-y))))))
 initrd-y := $(filter-out $(image-y), $(initrd-y))
 targets	+= $(image-y) $(initrd-y)
 
@@ -316,6 +317,12 @@  $(obj)/zImage.iseries: vmlinux
 $(obj)/uImage: vmlinux $(wrapperbits)
 	$(call if_changed,wrap,uboot)
 
+$(obj)/uImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb
+	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
+
+$(obj)/uImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
+	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb)
+
 $(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
 	$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
 
@@ -352,7 +359,7 @@  install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
 clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
 	zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
 	zImage.iseries zImage.miboot zImage.pmac zImage.pseries \
-	otheros.bld *.dtb
+	otheros.bld uImage* *.dtb
 
 # clean up files cached by wrapper
 clean-kernel := vmlinux.strip vmlinux.bin
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 965c237..548b087 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -153,7 +153,7 @@  coff)
     lds=$object/zImage.coff.lds
     link_address='0x500000'
     ;;
-miboot|uboot)
+miboot|uboot*)
     # miboot and U-boot want just the bare bits, not an ELF binary
     ext=bin
     objflags="-O binary"
@@ -262,6 +262,24 @@  uboot)
     fi
     exit 0
     ;;
+uboot-*)
+    rm -f "$ofile"
+    # we always need an initrd - create a dummy initrd if none provided
+    if [ ! -f "initrd" ]; then
+	initrd="$tmpdir/dummy.initrd"
+	echo -n fill >$initrd
+    fi
+    mkimage -A ppc -O linux -T multi -C gzip -a $membase -e $membase \
+	$uboot_version -d "$vmz:$initrd:$dtb" "$ofile"
+    if [ "$initrd" == "$tmpdir/dummy.initrd" ]; then
+	rm $initrd;
+    fi
+    if [ -z "$cacheit" ]; then
+	rm -f "$vmz"
+    fi
+    exit 0
+    ;;
+
 esac
 
 addsec() {