diff options
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r-- | arch/powerpc/boot/Makefile | 224 | ||||
-rwxr-xr-x | arch/powerpc/boot/wrapper | 204 | ||||
-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 | ||
23 | all: $(obj)/zImage | ||
23 | 24 | ||
24 | HOSTCC := gcc | 25 | HOSTCC := gcc |
25 | BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ | 26 | BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ |
26 | $(shell $(CROSS32CC) -print-file-name=include) -fPIC | 27 | $(shell $(CROSS32CC) -print-file-name=include) -fPIC |
27 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc | 28 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc |
28 | OBJCOPYFLAGS := contents,alloc,load,readonly,data | 29 | |
29 | OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000 | 30 | ifeq ($(call cc-option-yn, -fstack-protector),y) |
30 | OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment | 31 | BOOTCFLAGS += -fno-stack-protector |
32 | endif | ||
33 | |||
34 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | ||
31 | 35 | ||
32 | zlib := inffast.c inflate.c inftrees.c | 36 | zlib := inffast.c inflate.c inftrees.c |
33 | zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h | 37 | zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h |
34 | zliblinuxheader := zlib.h zconf.h zutil.h | 38 | zliblinuxheader := 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 | |||
43 | src-wlib := string.S stdio.c main.c div64.S $(zlib) | ||
44 | src-plat := of.c | ||
45 | src-boot := crt0.S $(src-wlib) $(src-plat) empty.c | ||
38 | 46 | ||
39 | src-boot-$(CONFIG_PPC_MULTIPLATFORM) := of.c | ||
40 | src-boot := crt0.S string.S stdio.c main.c div64.S $(src-boot-y) | ||
41 | src-boot += $(zlib) | ||
42 | src-boot := $(addprefix $(obj)/, $(src-boot)) | 47 | src-boot := $(addprefix $(obj)/, $(src-boot)) |
43 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) | 48 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) |
44 | 49 | obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) | |
45 | ifeq ($(call cc-option-yn, -fstack-protector),y) | 50 | obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) |
46 | BOOTCFLAGS += -fno-stack-protector | ||
47 | endif | ||
48 | |||
49 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | ||
50 | 51 | ||
51 | quiet_cmd_copy_zlib = COPY $@ | 52 | quiet_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 | ||
69 | clean-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 | ||
76 | clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ | ||
77 | $(obj)/empty.c | ||
71 | 78 | ||
72 | quiet_cmd_bootcc = BOOTCC $@ | 79 | quiet_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 $@ | |||
75 | quiet_cmd_bootas = BOOTAS $@ | 82 | quiet_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 | ||
78 | quiet_cmd_bootld = BOOTLD $@ | 85 | quiet_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 | #----------------------------------------------------------- | ||
89 | required := vmlinux.strip | ||
90 | initrd := initrd | ||
91 | 95 | ||
92 | obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section))) | 96 | hostprogs-y := addnote addRamDisk hack-coff |
93 | src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) | ||
94 | gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) | ||
95 | 97 | ||
96 | hostprogs-y := addnote addRamDisk hack-coff | 98 | extra-y := $(obj)/crt0.o $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ |
99 | $(obj)/zImage.lds $(obj)/zImage.coff.lds | ||
97 | 100 | ||
98 | targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ | 101 | wrapper :=$(srctree)/$(src)/wrapper |
99 | zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \ | 102 | wrapperbits := $(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 | ||
104 | extra-y := initrd.o | ||
105 | 103 | ||
106 | quiet_cmd_ramdisk = RAMDISK $@ | 104 | ############# |
107 | cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@ | 105 | # Bits for building various flavours of zImage |
108 | 106 | ||
109 | quiet_cmd_stripvm = STRIP $@ | 107 | ifneq ($(CROSS32_COMPILE),) |
110 | cmd_stripvm = $(STRIP) -s -R .comment $< -o $@ | 108 | CROSSWRAP := -C $(CROSS32_COMPILE) |
109 | else | ||
110 | ifneq ($(CROSS_COMPILE),) | ||
111 | CROSSWRAP := -C $(CROSS_COMPILE) | ||
112 | endif | ||
113 | endif | ||
111 | 114 | ||
112 | vmlinux.strip: vmlinux | 115 | quiet_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 | 117 | quiet_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 | ||
117 | quiet_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 | ||
122 | quiet_cmd_addnote = ADDNOTE $@ | 124 | $(obj)/zImage.initrd.chrp: vmlinux $(wrapperbits) |
123 | cmd_addnote = $(obj)/addnote $@ | 125 | $(call cmd,wrap_initrd,chrp) |
124 | 126 | ||
125 | quiet_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 | ||
129 | quiet_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 | |
154 | image-$(CONFIG_PPC_PSERIES) += zImage.pseries | ||
155 | image-$(CONFIG_PPC_MAPLE) += zImage.pseries | ||
156 | image-$(CONFIG_PPC_CELL) += zImage.pseries | ||
157 | image-$(CONFIG_PPC_CHRP) += zImage.chrp | ||
158 | image-$(CONFIG_PPC_PMAC) += zImage.pmac | ||
159 | image-$(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. |
156 | coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff | 163 | ifeq ($(CONFIG_PPC32),y) |
157 | coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff | 164 | image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot |
158 | mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image | 165 | endif |
159 | mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image | 166 | |
160 | 167 | initrd-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) | 174 | install: $(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 | 177 | clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip.gz) | |
171 | $(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \ | 178 | clean-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 | #----------------------------------------------------------- | ||
190 | quiet_cmd_mygzip = GZIP $@ | ||
191 | cmd_mygzip = gzip -f -9 < $< > $@.$$$$ && mv $@.$$$$ $@ | ||
192 | |||
193 | quiet_cmd_objbin = OBJCOPY $@ | ||
194 | cmd_objbin = $(OBJCOPY) -O binary $< $@ | ||
195 | |||
196 | quiet_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 | |||
201 | MKIMAGE := $(srctree)/scripts/mkuboot.sh | ||
202 | targets += uImage | ||
203 | extra-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 | |||
217 | install: $(CONFIGURE) $(BOOTIMAGE) | ||
218 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)" | ||
219 | |||
220 | clean-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 | ||
25 | kernel= | ||
26 | ofile=zImage | ||
27 | platform=of | ||
28 | initrd= | ||
29 | dtb= | ||
30 | dts= | ||
31 | cacheit= | ||
32 | |||
33 | # cross-compilation prefix | ||
34 | CROSS= | ||
35 | |||
36 | # directory for object and other files used by this script | ||
37 | object=arch/powerpc/boot | ||
38 | |||
39 | # directory for working files | ||
40 | tmpdir=. | ||
41 | |||
42 | usage() { | ||
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 | |||
49 | while [ "$#" -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 | ||
103 | done | ||
104 | |||
105 | if [ -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 | ||
110 | fi | ||
111 | |||
112 | if [ -z "$kernel" ]; then | ||
113 | kernel=vmlinux | ||
114 | fi | ||
115 | |||
116 | platformo=$object/"$platform".o | ||
117 | lds=$object/zImage.lds | ||
118 | ext=strip | ||
119 | objflags=-S | ||
120 | tmp=$tmpdir/zImage.$$.o | ||
121 | ksection=.kernel:vmlinux.strip | ||
122 | isection=.kernel:initrd | ||
123 | |||
124 | case "$platform" in | ||
125 | pmac|pseries|chrp) | ||
126 | platformo=$object/of.o | ||
127 | ;; | ||
128 | pmaccoff) | ||
129 | platformo=$object/of.o | ||
130 | lds=$object/zImage.coff.lds | ||
131 | ;; | ||
132 | miboot|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 | ;; | ||
140 | esac | ||
141 | |||
142 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" | ||
143 | if [ -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 | ||
151 | fi | ||
152 | |||
153 | case "$platform" in | ||
154 | uboot) | ||
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 | ;; | ||
168 | esac | ||
169 | |||
170 | addsec() { | ||
171 | ${CROSS}objcopy $4 $1 \ | ||
172 | --add-section=$3="$2" \ | ||
173 | --set-section-flags=$3=contents,alloc,load,readonly,data | ||
174 | } | ||
175 | |||
176 | addsec $tmp "$vmz.gz" $ksection $object/empty.o | ||
177 | if [ -z "$cacheit" ]; then | ||
178 | rm -f "$vmz.gz" | ||
179 | fi | ||
180 | |||
181 | if [ -n "$initrd" ]; then | ||
182 | addsec $tmp "$initrd" initrd | ||
183 | fi | ||
184 | |||
185 | if [ -n "$dtb" ]; then | ||
186 | addsec $tmp "$dtb" dtb | ||
187 | fi | ||
188 | |||
189 | if [ "$platform" != "miboot" ]; then | ||
190 | ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \ | ||
191 | $object/crt0.o $platformo $tmp $object/wrapper.a | ||
192 | rm $tmp | ||
193 | fi | ||
194 | |||
195 | # post-processing needed for some platforms | ||
196 | case "$platform" in | ||
197 | pseries|chrp) | ||
198 | $object/addnote "$ofile" | ||
199 | ;; | ||
200 | pmaccoff) | ||
201 | ${CROSS}objcopy -O aixcoff-rs6000 --set-start 0x500000 "$ofile" | ||
202 | $object/hack-coff "$ofile" | ||
203 | ;; | ||
204 | esac | ||
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 | |||