diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-04-30 20:20:20 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-02 06:04:31 -0400 |
commit | a6afacb6b8ba3d2eed6406a018e604d6f9c0f97d (patch) | |
tree | a51e62feed1fc59f9379deb4a2d87cea960cceeb | |
parent | 0cd74f398a1b86eab9d56224f3469235b2097e3c (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>
-rw-r--r-- | arch/powerpc/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/boot/Makefile | 15 | ||||
-rwxr-xr-x | arch/powerpc/boot/wrapper | 28 |
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 | ||
149 | CPPFLAGS_vmlinux.lds := -Upowerpc | 149 | CPPFLAGS_vmlinux.lds := -Upowerpc |
150 | 150 | ||
151 | BOOT_TARGETS = zImage zImage.initrd uImage cuImage | 151 | BOOT_TARGETS = zImage zImage.initrd uImage |
152 | 152 | ||
153 | PHONY += $(BOOT_TARGETS) | 153 | PHONY += $(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 | |||
129 | image-$(CONFIG_PPC_CHRP) += zImage.chrp | 129 | image-$(CONFIG_PPC_CHRP) += zImage.chrp |
130 | image-$(CONFIG_PPC_EFIKA) += zImage.chrp | 130 | image-$(CONFIG_PPC_EFIKA) += zImage.chrp |
131 | image-$(CONFIG_PPC_PMAC) += zImage.pmac | 131 | image-$(CONFIG_PPC_PMAC) += zImage.pmac |
132 | image-$(CONFIG_DEFAULT_UIMAGE) += uImage cuImage | 132 | image-$(CONFIG_PPC_83xx) += cuImage.83xx |
133 | image-$(CONFIG_PPC_85xx) += cuImage.85xx | ||
134 | image-$(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 | ||
165 | cuboot-plat-$(CONFIG_83xx) += 83xx | ||
166 | cuboot-plat-$(CONFIG_85xx) += 85xx | ||
167 | cuboot-plat-y += unknown-platform | ||
168 | |||
169 | dts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\ | 167 | dts = $(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) |
184 | clean-files += $(image-) $(initrd-) zImage zImage.initrd \ | 182 | clean-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 |
188 | clean-kernel := vmlinux.strip vmlinux.bin | 185 | clean-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 | ||
164 | vmz="$vmz$gzip" | 164 | vmz="$vmz$gzip" |
165 | 165 | ||
166 | case "$platform" in | 166 | # Extract kernel version information, some platforms want to include |
167 | uboot|cuboot*) | 167 | # it in the image header |
168 | version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ | 168 | version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ |
169 | cut -d' ' -f3` | 169 | cut -d' ' -f3` |
170 | if [ -n "$version" ]; then | 170 | if [ -n "$version" ]; then |
171 | version="-n Linux-$version" | 171 | uboot_version="-n Linux-$version" |
172 | fi | 172 | fi |
173 | esac | ||
174 | 173 | ||
175 | case "$platform" in | 174 | case "$platform" in |
176 | uboot) | 175 | uboot) |
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 |
213 | fi | 212 | fi |
214 | 213 | ||
214 | # Some platforms need the zImage's entry point and base address | ||
215 | base=0x`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1` | ||
216 | entry=`${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 |
216 | case "$platform" in | 219 | case "$platform" in |
217 | pseries|chrp) | 220 | pseries|chrp) |
218 | $object/addnote "$ofile" | 221 | $object/addnote "$ofile" |
219 | ;; | 222 | ;; |
220 | pmaccoff) | 223 | pmaccoff) |
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 | ;; |
226 | cuboot*) | 227 | cuboot*) |
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 | ;; |
236 | esac | 234 | esac |