Skip to contentSkip to conversation

powerpc: Copy bootable images in the default install script

PATCH In review Grant Likely 2 participants 6 messages Dec 20, 2008 – Jan 5, 2009 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Copy bootable images in the default install script

From: Grant Likely <[email protected]>

This patch makes the default install script (arch/powerpc/boot/install.sh) copy the bootable image files into the install directory. Before this patch only the vmlinux image file was copied.

This patch makes the default 'make install' command useful for embedded development when $(INSTALL_PATH) is set in the environment.

As a side effect, this patch changes the calling convention of the install.sh script. Instead of a single 5th parameter, the script is now passed a list of all the target images stored in the $(image-y) Makefile variable. This should be backwards compatible with existing install scripts since it just adds additional arguments and does not change existing ones.

CC Kumar Gala <[email protected]>
CC Josh Boyer <[email protected]>
CC Paul Mackerras <[email protected]>
CC Benjamin Herrenschmidt <[email protected]>
CC LinuxPPC Mailing List <[email protected]>

---

 arch/powerpc/boot/Makefile   |    2 +-
 arch/powerpc/boot/install.sh |   14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
arch/powerpc/boot/Makefile +1 -1
index 3d3daa6..b6187ca 100644
@@ -355,7 +355,7 @@ $(obj)/zImage.initrd:	$(addprefix $(obj)/, $(initrd-y))
 	@rm -f $@; ln $< $@
 
 install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
-	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
+	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
 
 # anything not in $(targets)
 clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
arch/powerpc/boot/install.sh +13 -1
index b002bfd..51b2387 100644
@@ -15,7 +15,7 @@
 #   $2 - kernel image file
 #   $3 - kernel map file
 #   $4 - default install path (blank if root directory)
-#   $5 - kernel boot file, the zImage
+#   $5 and more - kernel boot files; zImage*, uImage, cuImage.*, etc.
 #
 
 # User may have a custom install script
@@ -38,3 +38,15 @@ fi
 
 cat $2 > $4/$image_name
 cp $3 $4/System.map
+
+# Copy all the bootable image files
+path=$4
+shift 4
+while [ $# -ne 0 ]; do
+	image_name=`basename $1`
+	if [ -f $path/$image_name ]; then
+		mv $path/$image_name $path/$image_name.old
+	fi
+	cat $1 > $path/$image_name
+	shift
+done;
#1 lore raw

Ben, Kumar & Josh; any comments on this?

Thanks,
g.

Quoted 73 lines · Grant Likely

From: Grant Likely <[email protected]>

This patch makes the default install script (arch/powerpc/boot/install.sh) copy the bootable image files into the install directory. Before this patch only the vmlinux image file was copied.

This patch makes the default 'make install' command useful for embedded development when $(INSTALL_PATH) is set in the environment.

As a side effect, this patch changes the calling convention of the install.sh script. Instead of a single 5th parameter, the script is now passed a list of all the target images stored in the $(image-y) Makefile variable. This should be backwards compatible with existing install scripts since it just adds additional arguments and does not change existing ones.

CC Kumar Gala <[email protected]>
CC Josh Boyer <[email protected]>
CC Paul Mackerras <[email protected]>
CC Benjamin Herrenschmidt <[email protected]>
CC LinuxPPC Mailing List <[email protected]>

---

 arch/powerpc/boot/Makefile   |    2 +-
 arch/powerpc/boot/install.sh |   14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
arch/powerpc/boot/Makefile +1 -1
index 3d3daa6..b6187ca 100644
@@ -355,7 +355,7 @@ $(obj)/zImage.initrd:       $(addprefix $(obj)/, $(initrd-y))
       @rm -f $@; ln $< $@
 
 install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
-       sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
+       sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
 
 # anything not in $(targets)
 clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
arch/powerpc/boot/install.sh +13 -1
index b002bfd..51b2387 100644
@@ -15,7 +15,7 @@
 #   $2 - kernel image file
 #   $3 - kernel map file
 #   $4 - default install path (blank if root directory)
-#   $5 - kernel boot file, the zImage
+#   $5 and more - kernel boot files; zImage*, uImage, cuImage.*, etc.
 #
 
 # User may have a custom install script
@@ -38,3 +38,15 @@ fi
 
 cat $2 > $4/$image_name
 cp $3 $4/System.map
+
+# Copy all the bootable image files
+path=$4
+shift 4
+while [ $# -ne 0 ]; do
+       image_name=`basename $1`
+       if [ -f $path/$image_name ]; then
+               mv $path/$image_name $path/$image_name.old
+       fi
+       cat $1 > $path/$image_name
+       shift
+done;
Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#2 lore raw
In reply to Grant Likely
Quoted 5 lines · Grant Likely

From: Grant Likely <[email protected]>

This patch makes the default install script (arch/powerpc/boot/install.sh) copy the bootable image files into the install directory. Before this patch only the vmlinux image file was copied.

What do you do for cases where there isn't a single file? E.g. a canyonlands board will need both the uImage and caynonlands.dtb files to be "installed". U-Boot needs to be provided with both of them.

josh

#3 lore raw
Quoted 11 lines · Josh Boyer
Quoted 5 lines · Grant Likely

From: Grant Likely <[email protected]>

This patch makes the default install script (arch/powerpc/boot/install.sh) copy the bootable image files into the install directory. Before this patch only the vmlinux image file was copied.

What do you do for cases where there isn't a single file? E.g. a canyonlands board will need both the uImage and caynonlands.dtb files to be "installed". U-Boot needs to be provided with both of them.

That is exactly what this patch does. It copies all of the image files in $(image-y).

g.

--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

Acked-by
#4 lore raw
Quoted 9 lines · Grant Likely
Quoted 8 lines · Josh Boyer
Quoted 5 lines · Grant Likely

From: Grant Likely <[email protected]>

This patch makes the default install script (arch/powerpc/boot/install.sh) copy the bootable image files into the install directory. Before this patch only the vmlinux image file was copied.

Quoted 6 lines
Quoted 3 lines

What do you do for cases where there isn't a single file? E.g. a canyonlands board will need both the uImage and caynonlands.dtb files to be "installed". U-Boot needs to be provided with both of them.

That is exactly what this patch does. It copies all of the image files in $(image-y).

Well, it would if the .dtb files were includes in image-y, but they aren't. Anyway, that doesn't seem to be a bug or short-coming of the patch itself, so this looks good to me.

josh

#5 lore raw
Quoted 14 lines · Josh Boyer
Quoted 13 lines · Grant Likely
Quoted 11 lines · Josh Boyer
Quoted 5 lines · Grant Likely

From: Grant Likely <[email protected]>

This patch makes the default install script (arch/powerpc/boot/install.sh) copy the bootable image files into the install directory. Before this patch only the vmlinux image file was copied.

What do you do for cases where there isn't a single file? E.g. a canyonlands board will need both the uImage and caynonlands.dtb files to be "installed". U-Boot needs to be provided with both of them.

Quoted 6 lines
Quoted 2 lines

That is exactly what this patch does. It copies all of the image files in $(image-y).

Well, it would if the .dtb files were includes in image-y, but they aren't. Anyway, that doesn't seem to be a bug or short-coming of the patch itself, so this looks good to me.

But there is nothing preventing the .dtb files being added to image-y.
If you add them, they will be built and copied. :-)

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.