aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-09-27 08:47:03 -0400
committerPaul Mackerras <paulus@samba.org>2006-09-28 00:30:02 -0400
commit2bf118197cb4d9a5e7a9e45b5b007235fdc9f402 (patch)
treed9d7ceadb4eb1b277e914fcca74c901773f17832 /arch/powerpc/boot
parent4e6d816e51728d5006c53e78e079ac62b902f8aa (diff)
[POWERPC] Create a "wrapper" script and use it in arch/powerpc/boot
This puts the knowledge of how to create various sorts of zImage wrappers into a script called "wrapper" that could be used outside of the kernel tree. This changes arch/powerpc/boot so it first builds the files that the wrapper script needs, then runs it to create whatever flavours of zImage are required. This version does uImages as well. The zImage names are changed slightly; zImage.pseries is the one with the PT_NOTE program header entry added, and zImage.pmac is the one without. If the zImage.pseries gets made, it will also get hardlinked to zImage; otherwise, if zImage.pmac is made, it gets hardlinked to zImage. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r--arch/powerpc/boot/Makefile224
-rwxr-xr-xarch/powerpc/boot/wrapper204
-rw-r--r--arch/powerpc/boot/zImage.coff.lds.S (renamed from arch/powerpc/boot/zImage.coff.lds)0
-rw-r--r--arch/powerpc/boot/zImage.lds.S (renamed from arch/powerpc/boot/zImage.lds)0
4 files changed, 295 insertions, 133 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index e73774136b55..c383d56bbe18 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -20,33 +20,34 @@
20# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE 20# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
21# in the toplevel makefile. 21# in the toplevel makefile.
22 22
23all: $(obj)/zImage
23 24
24HOSTCC := gcc 25HOSTCC := gcc
25BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ 26BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
26 $(shell $(CROSS32CC) -print-file-name=include) -fPIC 27 $(shell $(CROSS32CC) -print-file-name=include) -fPIC
27BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 28BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
28OBJCOPYFLAGS := contents,alloc,load,readonly,data 29
29OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000 30ifeq ($(call cc-option-yn, -fstack-protector),y)
30OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment 31BOOTCFLAGS += -fno-stack-protector
32endif
33
34BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
31 35
32zlib := inffast.c inflate.c inftrees.c 36zlib := inffast.c inflate.c inftrees.c
33zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h 37zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
34zliblinuxheader := zlib.h zconf.h zutil.h 38zliblinuxheader := zlib.h zconf.h zutil.h
35 39
36$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 40$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \
37#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) 41 $(addprefix $(obj)/,$(zlibheader))
42
43src-wlib := string.S stdio.c main.c div64.S $(zlib)
44src-plat := of.c
45src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
38 46
39src-boot-$(CONFIG_PPC_MULTIPLATFORM) := of.c
40src-boot := crt0.S string.S stdio.c main.c div64.S $(src-boot-y)
41src-boot += $(zlib)
42src-boot := $(addprefix $(obj)/, $(src-boot)) 47src-boot := $(addprefix $(obj)/, $(src-boot))
43obj-boot := $(addsuffix .o, $(basename $(src-boot))) 48obj-boot := $(addsuffix .o, $(basename $(src-boot)))
44 49obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
45ifeq ($(call cc-option-yn, -fstack-protector),y) 50obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
46BOOTCFLAGS += -fno-stack-protector
47endif
48
49BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
50 51
51quiet_cmd_copy_zlib = COPY $@ 52quiet_cmd_copy_zlib = COPY $@
52 cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@ 53 cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
@@ -66,8 +67,14 @@ $(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
66$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/% 67$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
67 $(call cmd,copy_zliblinuxheader) 68 $(call cmd,copy_zliblinuxheader)
68 69
69clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) 70$(obj)/empty.c:
71 @touch $@
72
73$(obj)/zImage.lds $(obj)/zImage.coff.lds: $(obj)/%: $(srctree)/$(src)/%.S
74 @cp $< $@
70 75
76clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
77 $(obj)/empty.c
71 78
72quiet_cmd_bootcc = BOOTCC $@ 79quiet_cmd_bootcc = BOOTCC $@
73 cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 80 cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
@@ -75,146 +82,97 @@ quiet_cmd_bootcc = BOOTCC $@
75quiet_cmd_bootas = BOOTAS $@ 82quiet_cmd_bootas = BOOTAS $@
76 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 83 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
77 84
78quiet_cmd_bootld = BOOTLD $@ 85quiet_cmd_bootar = BOOTAR $@
79 cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2) 86 cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $^; mv $@.$$$$ $@
80 87
81$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c 88$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
82 $(call if_changed_dep,bootcc) 89 $(call if_changed_dep,bootcc)
83$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S 90$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
84 $(call if_changed_dep,bootas) 91 $(call if_changed_dep,bootas)
85 92
86#----------------------------------------------------------- 93$(obj)/wrapper.a: $(obj-wlib)
87# ELF sections within the zImage bootloader/wrapper 94 $(call cmd,bootar)
88#-----------------------------------------------------------
89required := vmlinux.strip
90initrd := initrd
91 95
92obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section))) 96hostprogs-y := addnote addRamDisk hack-coff
93src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
94gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
95 97
96hostprogs-y := addnote addRamDisk hack-coff 98extra-y := $(obj)/crt0.o $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
99 $(obj)/zImage.lds $(obj)/zImage.coff.lds
97 100
98targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ 101wrapper :=$(srctree)/$(src)/wrapper
99 zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \ 102wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff)
100 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
101 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
102 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
103 vmlinux.initrd dummy.o
104extra-y := initrd.o
105 103
106quiet_cmd_ramdisk = RAMDISK $@ 104#############
107 cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@ 105# Bits for building various flavours of zImage
108 106
109quiet_cmd_stripvm = STRIP $@ 107ifneq ($(CROSS32_COMPILE),)
110 cmd_stripvm = $(STRIP) -s -R .comment $< -o $@ 108CROSSWRAP := -C $(CROSS32_COMPILE)
109else
110ifneq ($(CROSS_COMPILE),)
111CROSSWRAP := -C $(CROSS_COMPILE)
112endif
113endif
111 114
112vmlinux.strip: vmlinux 115quiet_cmd_wrap = WRAP $@
113 $(call if_changed,stripvm) 116 cmd_wrap =$(wrapper) -c -o $@ -p $2 $(CROSSWRAP) vmlinux
114$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz 117quiet_cmd_wrap_initrd = WRAP $@
115 $(call if_changed,ramdisk) 118 cmd_wrap_initrd =$(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
119 -i $(obj)/ramdisk.image.gz vmlinux
116 120
117quiet_cmd_addsection = ADDSEC $@ 121$(obj)/zImage.chrp: vmlinux $(wrapperbits)
118 cmd_addsection = $(CROSS32OBJCOPY) $@ \ 122 $(call cmd,wrap,chrp)
119 --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(patsubst %.o,%.gz, $@) \
120 --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPYFLAGS)
121 123
122quiet_cmd_addnote = ADDNOTE $@ 124$(obj)/zImage.initrd.chrp: vmlinux $(wrapperbits)
123 cmd_addnote = $(obj)/addnote $@ 125 $(call cmd,wrap_initrd,chrp)
124 126
125quiet_cmd_gen-miboot = GEN $@ 127$(obj)/zImage.pseries: vmlinux $(wrapperbits)
126 cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_MIB_ARGS) \ 128 $(call cmd,wrap,pseries)
127 --add-section=$1=$(word 2, $^) $< $@
128 129
129quiet_cmd_gencoff = COFF $@ 130$(obj)/zImage.initrd.pseries: vmlinux $(wrapperbits)
130 cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \ 131 $(call cmd,wrap_initrd,pseries)
131 $(obj)/hack-coff $@
132 132
133$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % 133$(obj)/zImage.pmac: vmlinux $(wrapperbits)
134 $(call if_changed,gzip) 134 $(call cmd,wrap,pmac)
135 135
136$(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz 136$(obj)/zImage.initrd.pmac: vmlinux $(wrapperbits)
137 cp -f $(obj)/ramdisk.image.gz $@ 137 $(call cmd,wrap_initrd,pmac)
138 138
139$(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz 139$(obj)/zImage.coff: vmlinux $(wrapperbits)
140 @touch $@ 140 $(call cmd,wrap,pmaccoff)
141 141
142$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c 142$(obj)/zImage.initrd.coff: vmlinux $(wrapperbits)
143 $(call if_changed_dep,bootcc) 143 $(call cmd,wrap_initrd,pmaccoff)
144 $(call cmd,addsection) 144
145$(obj)/zImage.miboot: vmlinux $(wrapperbits)
146 $(call cmd,wrap,miboot)
145 147
146$(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required)) 148$(obj)/zImage.initrd.miboot: vmlinux $(wrapperbits)
147$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds 149 $(call cmd,wrap_initrd,miboot)
148 $(call cmd,bootld,$(obj-boot),zImage.lds)
149 150
150$(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd)) 151$(obj)/uImage: vmlinux $(wrapperbits)
151$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds 152 $(call cmd,wrap,uboot)
152 $(call cmd,bootld,$(obj-boot),zImage.lds) 153
154image-$(CONFIG_PPC_PSERIES) += zImage.pseries
155image-$(CONFIG_PPC_MAPLE) += zImage.pseries
156image-$(CONFIG_PPC_CELL) += zImage.pseries
157image-$(CONFIG_PPC_CHRP) += zImage.chrp
158image-$(CONFIG_PPC_PMAC) += zImage.pmac
159image-$(CONFIG_DEFAULT_UIMAGE) += uImage
153 160
154# For 32-bit powermacs, build the COFF and miboot images 161# For 32-bit powermacs, build the COFF and miboot images
155# as well as the ELF images. 162# as well as the ELF images.
156coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff 163ifeq ($(CONFIG_PPC32),y)
157coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff 164image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
158mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image 165endif
159mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image 166
160 167initrd-y := $(patsubst zImage%, zImage.initrd%, $(image-y))
161$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \ 168
162 $(mibootimg-y-y) 169$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
163 @cp -f $< $@ 170 @rm -f $@; ln $< $@
164 $(call if_changed,addnote) 171$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
165 172 @rm -f $@; ln $< $@
166$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote \ 173
167 $(coffrdimg-y-y) $(mibrdimg-y-y) 174install: $(CONFIGURE) $(image-y)
168 @cp -f $< $@ 175 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
169 $(call if_changed,addnote) 176
170 177clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip.gz)
171$(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \ 178clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.bin.gz)
172 $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
173 $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
174 $(call cmd,gencoff)
175
176$(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
177 $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
178 $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
179 $(call cmd,gencoff)
180
181$(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz
182 $(call cmd,gen-miboot,image)
183
184$(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz
185 $(call cmd,gen-miboot,initrd)
186
187#-----------------------------------------------------------
188# build u-boot images
189#-----------------------------------------------------------
190quiet_cmd_mygzip = GZIP $@
191cmd_mygzip = gzip -f -9 < $< > $@.$$$$ && mv $@.$$$$ $@
192
193quiet_cmd_objbin = OBJCOPY $@
194 cmd_objbin = $(OBJCOPY) -O binary $< $@
195
196quiet_cmd_uimage = UIMAGE $@
197 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A ppc -O linux -T kernel \
198 -C gzip -a 00000000 -e 00000000 -n 'Linux-$(KERNELRELEASE)' \
199 -d $< $@
200
201MKIMAGE := $(srctree)/scripts/mkuboot.sh
202targets += uImage
203extra-y += vmlinux.bin vmlinux.gz
204
205$(obj)/vmlinux.bin: vmlinux FORCE
206 $(call if_changed,objbin)
207
208$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
209 $(call if_changed,mygzip)
210
211$(obj)/uImage: $(obj)/vmlinux.gz
212 $(Q)rm -f $@
213 $(call cmd,uimage)
214 @echo -n ' Image: $@ '
215 @if [ -f $@ ]; then echo 'is ready' ; else echo 'not made'; fi
216
217install: $(CONFIGURE) $(BOOTIMAGE)
218 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
219
220clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
new file mode 100755
index 000000000000..eab7318729e9
--- /dev/null
+++ b/arch/powerpc/boot/wrapper
@@ -0,0 +1,204 @@
1#!/bin/sh
2
3# Copyright (C) 2006 Paul Mackerras, IBM Corporation <paulus@samba.org>
4# This program may be used under the terms of version 2 of the GNU
5# General Public License.
6
7# This script takes a kernel binary and optionally an initrd image
8# and/or a device-tree blob, and creates a bootable zImage for a
9# given platform.
10
11# Options:
12# -o zImage specify output file
13# -p platform specify platform (links in $platform.o)
14# -i initrd specify initrd file
15# -d devtree specify device-tree blob
16# -s tree.dts specify device-tree source file (needs dtc installed)
17# -c cache $kernel.strip.gz (use if present & newer, else make)
18# -C prefix specify command prefix for cross-building tools
19# (strip, objcopy, ld)
20# -D dir specify directory containing data files used by script
21# (default ./arch/powerpc/boot)
22# -W dir specify working directory for temporary files (default .)
23
24# defaults
25kernel=
26ofile=zImage
27platform=of
28initrd=
29dtb=
30dts=
31cacheit=
32
33# cross-compilation prefix
34CROSS=
35
36# directory for object and other files used by this script
37object=arch/powerpc/boot
38
39# directory for working files
40tmpdir=.
41
42usage() {
43 echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
44 echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2
45 echo ' [-D datadir] [-W workingdir] [vmlinux]' >&2
46 exit 1
47}
48
49while [ "$#" -gt 0 ]; do
50 case "$1" in
51 -o)
52 shift
53 [ "$#" -gt 0 ] || usage
54 ofile="$1"
55 ;;
56 -p)
57 shift
58 [ "$#" -gt 0 ] || usage
59 platform="$1"
60 ;;
61 -i)
62 shift
63 [ "$#" -gt 0 ] || usage
64 initrd="$1"
65 ;;
66 -d)
67 shift
68 [ "$#" -gt 0 ] || usage
69 dtb="$1"
70 ;;
71 -s)
72 shift
73 [ "$#" -gt 0 ] || usage
74 dts="$1"
75 ;;
76 -c)
77 cacheit=y
78 ;;
79 -C)
80 shift
81 [ "$#" -gt 0 ] || usage
82 CROSS="$1"
83 ;;
84 -D)
85 shift
86 [ "$#" -gt 0 ] || usage
87 object="$1"
88 ;;
89 -W)
90 shift
91 [ "$#" -gt 0 ] || usage
92 tmpdir="$1"
93 ;;
94 -?)
95 usage
96 ;;
97 *)
98 [ -z "$kernel" ] || usage
99 kernel="$1"
100 ;;
101 esac
102 shift
103done
104
105if [ -n "$dts" ]; then
106 if [ -z "$dtb" ]; then
107 dtb="$platform.dtb"
108 fi
109 dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1
110fi
111
112if [ -z "$kernel" ]; then
113 kernel=vmlinux
114fi
115
116platformo=$object/"$platform".o
117lds=$object/zImage.lds
118ext=strip
119objflags=-S
120tmp=$tmpdir/zImage.$$.o
121ksection=.kernel:vmlinux.strip
122isection=.kernel:initrd
123
124case "$platform" in
125pmac|pseries|chrp)
126 platformo=$object/of.o
127 ;;
128pmaccoff)
129 platformo=$object/of.o
130 lds=$object/zImage.coff.lds
131 ;;
132miboot|uboot)
133 # miboot and U-boot want just the bare bits, not an ELF binary
134 ext=bin
135 objflags="-O binary"
136 tmp="$ofile"
137 ksection=image
138 isection=initrd
139 ;;
140esac
141
142vmz="$tmpdir/`basename \"$kernel\"`.$ext"
143if [ -z "$cacheit" -o ! -f "$vmz.gz" -o "$vmz.gz" -ot "$kernel" ]; then
144 ${CROSS}objcopy $objflags "$kernel" "$vmz.$$"
145 gzip -f -9 "$vmz.$$"
146 if [ -n "$cacheit" ]; then
147 mv -f "$vmz.$$.gz" "$vmz.gz"
148 else
149 vmz="$vmz.$$"
150 fi
151fi
152
153case "$platform" in
154uboot)
155 rm -f "$ofile"
156 version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
157 cut -d' ' -f3`
158 if [ -n "$version" ]; then
159 version="-n Linux-$version"
160 fi
161 mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
162 $version -d "$vmz.gz" "$ofile"
163 if [ -z "$cacheit" ]; then
164 rm -f $vmz.gz
165 fi
166 exit 0
167 ;;
168esac
169
170addsec() {
171 ${CROSS}objcopy $4 $1 \
172 --add-section=$3="$2" \
173 --set-section-flags=$3=contents,alloc,load,readonly,data
174}
175
176addsec $tmp "$vmz.gz" $ksection $object/empty.o
177if [ -z "$cacheit" ]; then
178 rm -f "$vmz.gz"
179fi
180
181if [ -n "$initrd" ]; then
182 addsec $tmp "$initrd" initrd
183fi
184
185if [ -n "$dtb" ]; then
186 addsec $tmp "$dtb" dtb
187fi
188
189if [ "$platform" != "miboot" ]; then
190 ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
191 $object/crt0.o $platformo $tmp $object/wrapper.a
192 rm $tmp
193fi
194
195# post-processing needed for some platforms
196case "$platform" in
197pseries|chrp)
198 $object/addnote "$ofile"
199 ;;
200pmaccoff)
201 ${CROSS}objcopy -O aixcoff-rs6000 --set-start 0x500000 "$ofile"
202 $object/hack-coff "$ofile"
203 ;;
204esac
diff --git a/arch/powerpc/boot/zImage.coff.lds b/arch/powerpc/boot/zImage.coff.lds.S
index 6016251a1a2c..6016251a1a2c 100644
--- a/arch/powerpc/boot/zImage.coff.lds
+++ b/arch/powerpc/boot/zImage.coff.lds.S
diff --git a/arch/powerpc/boot/zImage.lds b/arch/powerpc/boot/zImage.lds.S
index 4b6bb3ffe3dc..4b6bb3ffe3dc 100644
--- a/arch/powerpc/boot/zImage.lds
+++ b/arch/powerpc/boot/zImage.lds.S