Re: [PATCH 2/3] powerpc: Add support for creating FIT uImages

2009-11-25 Thread Peter Tyser

Hi Stefano,

Stefano Babic wrote:

Peter Tyser ptyser wrote:


+# Create a default, fully populated DTS file
+DATA=/ {
+   description = \Linux kernel ${VERSION}\;
+   #address-cells = 1;
+
+   images {
+   kernel at 1 {


Is the at probably generated by your anti-spam mailer ? dtc seems not
to like it as replacement for the usual '@' ;)


The patch looks correct in my inbox and at 
http://patchwork.kernel.org/patch/61183/.  Perhaps its a problem at your 
end?


Please keep everyone cc-ed on responses - the changes are just as 
relevant to linuxppc as kbuild.


Best,
Peter
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 2/3] powerpc: Add support for creating FIT uImages

2009-11-24 Thread Peter Tyser
Hi Stefano,
Thanks for trying the patches out.

On Tue, 2009-11-24 at 11:32 +0100, Stefano Babic wrote:
 Peter Tyser ptyser wrote:
  +uboot.fit)
  +rm -f $ofile
  +${MKITS} -A ppc -C gzip -a $membase -e $membase -v $version \
  +   -d $srctree/$dtb -k $srctree/$vmz -o $object/uImage.its
  +${MKIMAGE} -f $object/uImage.its $ofile
 
 Hi,
 
 I have tested your patches against last mkimage utility provided with
 u-boot. The utility requires to pass the type of the image (flat_dt),
 even if this is not mentioned in the help output. Without the image type
 parameter, no image is generated, and no error is reported.
 It should be:
 
 ${MKIMAGE} -f $object/uImage.its - T flat_dt $ofile

Argh, I'm seeing the same behavior with the latest mkimage source too.
It looks like there was a regression in the mkimage utility - the -T
option shouldn't be necessary to create a FIT image.  I'll send a patch
to U-Boot to fix this behavior.

 I have tried to get an image for the lite5200b board, because I have the
 possibility to test the result on the target. However, dtc fails to
 compile the its generated by your script (Version: DTC 1.2.0-g0ef21055,
 cloned from jdt).

I did my testing using the dtc in the linux kernel source
(scripts/dtc/dtc, version 1.2.0) and version 1.2.0-rc1.  I see the same
error as you when using version 1.2.0-g0ef21055.

 DTC: dts-dtb  on file arch/powerpc/boot/uImage.its
 Error: arch/powerpc/boot/uImage.its 1:0 syntax error
 
 Do you test in different conditions ?

Applying the following change should resolve the dtc syntax error.

diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 88411dd..75edc27 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -64,7 +64,9 @@ ENTRY_ADDR=`echo $ENTRY_ADDR | sed 's/0x//'`
 RAMFS_ADDR=`echo $RAMFS_ADDR | sed 's/0x//'`
 
 # Create a default, fully populated DTS file
-DATA=/ {
+DATA=/dts-v1/;
+
+/ {
description = \Linux kernel ${VERSION}\;
#address-cells = 1;
 

I'll wait a few more days for feedback then resubmit with the dts syntax
fix

Thanks for testing,
Peter

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/3] powerpc: Add support for creating FIT uImages

2009-11-18 Thread Peter Tyser
Recent U-Boot versions support booting a Flattened Image Tree (FIT)
image format.  The FIT uImage format uses a tree structure to describe a
kernel image as well as supporting device tree blobs, ramdisks, etc.
The 'mkimage' and 'dtc' utilities convert this tree description into a
binary blob that bootloaders such as U-Boot can execute.

This patch adds support for automatically creating a U-Boot FIT image
using the make uImage.fit.boardname command where boardname is
one of arch/powerpc/boot/dts/boardname.dts.  The resulting
arch/powerpc/boot/uImage.fit.boardname file will contain a kernel
image as well as a device tree blob.  U-Boot versions compiled with FIT
support can directly boot this image using the bootm command.

Additional information about the FIT format and its uses can be found in
doc/uImage.FIT/howto.txt of U-Boot's source tree.

Signed-off-by: Peter Tyser pty...@xes-inc.com
---
 arch/powerpc/Makefile|4 +-
 arch/powerpc/boot/.gitignore |1 +
 arch/powerpc/boot/Makefile   |5 ++-
 arch/powerpc/boot/wrapper|   16 ++-
 scripts/mkits.sh |  113 ++
 5 files changed, 136 insertions(+), 3 deletions(-)
 create mode 100755 scripts/mkits.sh

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 1a54a3b..459aed5 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -158,7 +158,8 @@ drivers-$(CONFIG_OPROFILE)  += arch/powerpc/oprofile/
 # Default to zImage, override when needed
 all: zImage
 
-BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% 
cuImage.% simpleImage.%
+BOOT_TARGETS = zImage zImage.initrd uImage uImage.fit.% zImage% dtbImage% \
+  treeImage.% cuImage.% simpleImage.%
 
 PHONY += $(BOOT_TARGETS)
 
@@ -185,6 +186,7 @@ define archhelp
   @echo '* zImage  - Build default images selected by kernel config'
   @echo '  zImage.*- Compressed kernel image 
(arch/$(ARCH)/boot/zImage.*)'
   @echo '  uImage  - U-Boot native image format'
+  @echo '  uImage.fit.dt - U-Boot Flattened Image Tree image format'
   @echo '  cuImage.dt- Backwards compatible U-Boot image for older'
   @echo 'versions which do not support device trees'
   @echo '  dtbImage.dt   - zImage with an embedded device tree blob'
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index 3d80c3e..a443f1c 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -19,6 +19,7 @@ kernel-vmlinux.strip.c
 kernel-vmlinux.strip.gz
 mktree
 uImage
+uImage.fit.*
 cuImage.*
 dtbImage.*
 treeImage.*
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 7bfc8ad..57e4eee 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -307,6 +307,9 @@ $(obj)/zImage.iseries: vmlinux
 $(obj)/uImage: vmlinux $(wrapperbits)
$(call if_changed,wrap,uboot)
 
+$(obj)/uImage.fit.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+   $(call if_changed,wrap,uboot.fit,,$(obj)/$*.dtb)
+
 $(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
 
@@ -346,7 +349,7 @@ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
 
 # anything not in $(targets)
 clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
-   zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
+   uImage.* zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
zImage.iseries zImage.miboot zImage.pmac zImage.pseries \
simpleImage.* otheros.bld *.dtb
 
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 1ee9448..26a971e 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -46,6 +46,9 @@ CROSS=
 # mkimage wrapper script
 MKIMAGE=$srctree/scripts/mkuboot.sh
 
+# script to generate an .its file for uImage.fit.* images
+MKITS=$srctree/scripts/mkits.sh
+
 # directory for object and other files used by this script
 object=arch/powerpc/boot
 objbin=$object
@@ -157,7 +160,7 @@ coff)
 lds=$object/zImage.coff.lds
 link_address='0x50'
 ;;
-miboot|uboot)
+miboot|uboot|uboot.fit)
 # miboot and U-boot want just the bare bits, not an ELF binary
 ext=bin
 objflags=-O binary
@@ -273,6 +276,17 @@ uboot)
 fi
 exit 0
 ;;
+uboot.fit)
+rm -f $ofile
+${MKITS} -A ppc -C gzip -a $membase -e $membase -v $version \
+   -d $srctree/$dtb -k $srctree/$vmz -o $object/uImage.its
+${MKIMAGE} -f $object/uImage.its $ofile
+rm $object/uImage.its
+if [ -z $cacheit ]; then
+   rm -f $vmz
+fi
+exit 0
+;;
 esac
 
 addsec() {
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
new file mode 100755
index 000..a438cac
--- /dev/null
+++ b/scripts/mkits.sh
@@ -0,0 +1,113 @@
+#!/bin/bash
+#
+# Licensed under the terms of the GNU GPL License version 2 or later.
+#
+# Author: Peter Tyser pty...@xes-inc.com
+#
+# U-Boot firmware supports