aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/wrapper
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ozlabs.org>2011-04-12 16:38:55 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-20 02:59:20 -0400
commit6975a783d7b40c79be4b7a7ea450e023ff7e5e02 (patch)
tree67c07efa7ca72a24bcd5d893c83fb9b3f59dce77 /arch/powerpc/boot/wrapper
parentee7a2aa3d3fd10a7157dd19f737b2bafdea0458f (diff)
powerpc/boot: Allow building the zImage wrapper as a relocatable ET_DYN
This patch adds code, linker script and makefile support to allow building the zImage wrapper around the kernel as a position independent executable. This results in an ET_DYN instead of an ET_EXEC ELF output file, which can be loaded at any location by the firmware and will process its own relocations to work correctly at the loaded address. This is of interest particularly since the standard ePAPR image format must be an ET_DYN (although this patch alone is not sufficient to produce a fully ePAPR compliant boot image). Note for now we don't enable building with -pie for anything. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/boot/wrapper')
-rwxr-xr-xarch/powerpc/boot/wrapper9
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index cb97e7511d7e..fef527867811 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -39,6 +39,7 @@ dts=
39cacheit= 39cacheit=
40binary= 40binary=
41gzip=.gz 41gzip=.gz
42pie=
42 43
43# cross-compilation prefix 44# cross-compilation prefix
44CROSS= 45CROSS=
@@ -157,9 +158,10 @@ pmac|chrp)
157 platformo=$object/of.o 158 platformo=$object/of.o
158 ;; 159 ;;
159coff) 160coff)
160 platformo=$object/of.o 161 platformo="$object/crt0.o $object/of.o"
161 lds=$object/zImage.coff.lds 162 lds=$object/zImage.coff.lds
162 link_address='0x500000' 163 link_address='0x500000'
164 pie=
163 ;; 165 ;;
164miboot|uboot) 166miboot|uboot)
165 # miboot and U-boot want just the bare bits, not an ELF binary 167 # miboot and U-boot want just the bare bits, not an ELF binary
@@ -208,6 +210,7 @@ ps3)
208 ksection=.kernel:vmlinux.bin 210 ksection=.kernel:vmlinux.bin
209 isection=.kernel:initrd 211 isection=.kernel:initrd
210 link_address='' 212 link_address=''
213 pie=
211 ;; 214 ;;
212ep88xc|ep405|ep8248e) 215ep88xc|ep405|ep8248e)
213 platformo="$object/fixed-head.o $object/$platform.o" 216 platformo="$object/fixed-head.o $object/$platform.o"
@@ -310,9 +313,9 @@ fi
310 313
311if [ "$platform" != "miboot" ]; then 314if [ "$platform" != "miboot" ]; then
312 if [ -n "$link_address" ] ; then 315 if [ -n "$link_address" ] ; then
313 text_start="-Ttext $link_address --defsym _start=$link_address" 316 text_start="-Ttext $link_address"
314 fi 317 fi
315 ${CROSS}ld -m elf32ppc -T $lds $text_start -o "$ofile" \ 318 ${CROSS}ld -m elf32ppc -T $lds $text_start $pie -o "$ofile" \
316 $platformo $tmp $object/wrapper.a 319 $platformo $tmp $object/wrapper.a
317 rm $tmp 320 rm $tmp
318fi 321fi