aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-04-30 20:20:20 -0400
committerPaul Mackerras <paulus@samba.org>2007-05-02 06:04:31 -0400
commita6afacb6b8ba3d2eed6406a018e604d6f9c0f97d (patch)
treea51e62feed1fc59f9379deb4a2d87cea960cceeb /arch
parent0cd74f398a1b86eab9d56224f3469235b2097e3c (diff)
[POWERPC] Small cleanups to the cuboot bootwrapper code
This patch makes a few small cleanups to the cuboot code. - It removes the double layered selection of images, via cuboot-plat-y, instead having the cuboot platforms directly select a suitable image-y (this changes the name of the final cuboot image from plain cuImage to cuImage.<platform>). - Factors out some code in the wrapper that's potentially useful to platforms other than uboot. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/boot/Makefile15
-rwxr-xr-xarch/powerpc/boot/wrapper28
3 files changed, 20 insertions, 25 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 794992025d8d..81a531d84ff9 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -148,7 +148,7 @@ all: $(KBUILD_IMAGE)
148 148
149CPPFLAGS_vmlinux.lds := -Upowerpc 149CPPFLAGS_vmlinux.lds := -Upowerpc
150 150
151BOOT_TARGETS = zImage zImage.initrd uImage cuImage 151BOOT_TARGETS = zImage zImage.initrd uImage
152 152
153PHONY += $(BOOT_TARGETS) 153PHONY += $(BOOT_TARGETS)
154 154
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 3716594ea33e..326ee92a2fc3 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -129,7 +129,9 @@ image-$(CONFIG_PPC_CELLEB) += zImage.pseries
129image-$(CONFIG_PPC_CHRP) += zImage.chrp 129image-$(CONFIG_PPC_CHRP) += zImage.chrp
130image-$(CONFIG_PPC_EFIKA) += zImage.chrp 130image-$(CONFIG_PPC_EFIKA) += zImage.chrp
131image-$(CONFIG_PPC_PMAC) += zImage.pmac 131image-$(CONFIG_PPC_PMAC) += zImage.pmac
132image-$(CONFIG_DEFAULT_UIMAGE) += uImage cuImage 132image-$(CONFIG_PPC_83xx) += cuImage.83xx
133image-$(CONFIG_PPC_85xx) += cuImage.85xx
134image-$(CONFIG_DEFAULT_UIMAGE) += uImage
133 135
134# For 32-bit powermacs, build the COFF and miboot images 136# For 32-bit powermacs, build the COFF and miboot images
135# as well as the ELF images. 137# as well as the ELF images.
@@ -162,15 +164,11 @@ $(obj)/zImage.initrd.ps3: vmlinux
162$(obj)/uImage: vmlinux $(wrapperbits) 164$(obj)/uImage: vmlinux $(wrapperbits)
163 $(call if_changed,wrap,uboot) 165 $(call if_changed,wrap,uboot)
164 166
165cuboot-plat-$(CONFIG_83xx) += 83xx
166cuboot-plat-$(CONFIG_85xx) += 85xx
167cuboot-plat-y += unknown-platform
168
169dts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\ 167dts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\
170 ,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE) 168 ,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE)
171 169
172$(obj)/cuImage: vmlinux $(wrapperbits) 170$(obj)/cuImage.%: vmlinux $(wrapperbits)
173 $(call if_changed,wrap,cuboot-$(word 1,$(cuboot-plat-y)),$(dts)) 171 $(call if_changed,wrap,cuboot-$*,$(dts))
174 172
175$(obj)/zImage: $(addprefix $(obj)/, $(image-y)) 173$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
176 @rm -f $@; ln $< $@ 174 @rm -f $@; ln $< $@
@@ -181,8 +179,7 @@ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
181 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< 179 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
182 180
183# anything not in $(targets) 181# anything not in $(targets)
184clean-files += $(image-) $(initrd-) zImage zImage.initrd \ 182clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.*
185 cuImage.elf cuImage.bin.gz
186 183
187# clean up files cached by wrapper 184# clean up files cached by wrapper
188clean-kernel := vmlinux.strip vmlinux.bin 185clean-kernel := vmlinux.strip vmlinux.bin
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 5cedd901201f..1ea208096b15 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -163,20 +163,19 @@ fi
163 163
164vmz="$vmz$gzip" 164vmz="$vmz$gzip"
165 165
166case "$platform" in 166# Extract kernel version information, some platforms want to include
167uboot|cuboot*) 167# it in the image header
168 version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ 168version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
169 cut -d' ' -f3` 169 cut -d' ' -f3`
170 if [ -n "$version" ]; then 170if [ -n "$version" ]; then
171 version="-n Linux-$version" 171 uboot_version="-n Linux-$version"
172 fi 172fi
173esac
174 173
175case "$platform" in 174case "$platform" in
176uboot) 175uboot)
177 rm -f "$ofile" 176 rm -f "$ofile"
178 mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \ 177 mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
179 $version -d "$vmz" "$ofile" 178 $uboot_version -d "$vmz" "$ofile"
180 if [ -z "$cacheit" ]; then 179 if [ -z "$cacheit" ]; then
181 rm -f "$vmz" 180 rm -f "$vmz"
182 fi 181 fi
@@ -212,25 +211,24 @@ if [ "$platform" != "miboot" ]; then
212 rm $tmp 211 rm $tmp
213fi 212fi
214 213
214# Some platforms need the zImage's entry point and base address
215base=0x`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
216entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | cut -d' ' -f3`
217
215# post-processing needed for some platforms 218# post-processing needed for some platforms
216case "$platform" in 219case "$platform" in
217pseries|chrp) 220pseries|chrp)
218 $object/addnote "$ofile" 221 $object/addnote "$ofile"
219 ;; 222 ;;
220pmaccoff) 223pmaccoff)
221 entry=`objdump -f "$ofile" | grep '^start address ' | \
222 cut -d' ' -f3`
223 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" 224 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
224 $object/hack-coff "$ofile" 225 $object/hack-coff "$ofile"
225 ;; 226 ;;
226cuboot*) 227cuboot*)
227 base=`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
228 entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | \
229 cut -d' ' -f3`
230 mv "$ofile" "$ofile".elf 228 mv "$ofile" "$ofile".elf
231 ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin 229 ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin
232 gzip -f -9 "$ofile".bin 230 gzip -f -9 "$ofile".bin
233 mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \ 231 mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
234 $version -d "$ofile".bin.gz "$ofile" 232 $uboot_version -d "$ofile".bin.gz "$ofile"
235 ;; 233 ;;
236esac 234esac