linux/arch/powerpc/boot
Paul Mackerras 549e8152de powerpc: Make the 64-bit kernel as a position-independent executable
This implements CONFIG_RELOCATABLE for 64-bit by making the kernel as
a position-independent executable (PIE) when it is set.  This involves
processing the dynamic relocations in the image in the early stages of
booting, even if the kernel is being run at the address it is linked at,
since the linker does not necessarily fill in words in the image for
which there are dynamic relocations.  (In fact the linker does fill in
such words for 64-bit executables, though not for 32-bit executables,
so in principle we could avoid calling relocate() entirely when we're
running a 64-bit kernel at the linked address.)

The dynamic relocations are processed by a new function relocate(addr),
where the addr parameter is the virtual address where the image will be
run.  In fact we call it twice; once before calling prom_init, and again
when starting the main kernel.  This means that reloc_offset() returns
0 in prom_init (since it has been relocated to the address it is running
at), which necessitated a few adjustments.

This also changes __va and __pa to use an equivalent definition that is
simpler.  With the relocatable kernel, PAGE_OFFSET and MEMORY_START are
constants (for 64-bit) whereas PHYSICAL_START is a variable (and
KERNELBASE ideally should be too, but isn't yet).

With this, relocatable kernels still copy themselves down to physical
address 0 and run there.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-09-15 11:08:38 -07:00
..
dtc-src powerpc: Update in-kernel dtc and libfdt to version 1.2.0 2008-08-20 16:34:58 +10:00
dts powerpc/85xx: TQM8548: DTS file fixes and cleanup 2008-08-20 23:56:30 -05:00
libfdt powerpc: Update in-kernel dtc and libfdt to version 1.2.0 2008-08-20 16:34:58 +10:00
.gitignore [POWERPC] Update arch/powerpc/boot/.gitignore 2008-05-20 00:35:29 -05:00
4xx.c [POWERPC] 4xx: Workaround for CHIP_11 Errata 2008-05-19 09:36:40 -05:00
4xx.h [POWERPC] 4xx: Add 405GPr and 405EP support in boot wrapper 2008-01-08 07:58:09 -06:00
44x.h [POWERPC] cuimage for Bamboo board 2007-09-19 21:13:16 -05:00
addnote.c powerpc: Change the default link address for pSeries zImage kernels 2008-07-01 11:28:32 +10:00
addRamDisk.c
bamboo.c [POWERPC] Start removing linux,network-index in favour of aliases 2008-03-26 07:19:16 -05:00
cpm-serial.c [POWERPC] cpm-serial: Relocate CPM buffer descriptors and SMC parameter ram. 2008-04-17 01:01:37 -05:00
crt0.S [POWERPC] Fix building of COFF zImages 2007-06-07 22:21:31 +10:00
crtsavres.S [POWERPC] Fix bootwrapper builds with newer gcc versions 2008-06-16 15:00:52 +10:00
cuboot-8xx.c [POWERPC] Use embedded libfdt in the bootwrapper 2007-12-11 13:46:14 +11:00
cuboot-52xx.c [POWERPC] Use embedded libfdt in the bootwrapper 2007-12-11 13:46:14 +11:00
cuboot-83xx.c [POWERPC] bootwrapper: convert cuboot-8{3,5}xx to dt_fixup_mac_address_by_alias 2008-01-23 19:32:47 -06:00
cuboot-85xx-cpm2.c [POWERPC] Add a cuboot wrapper for 85xx with CPM2 2008-01-27 14:10:36 -06:00
cuboot-85xx.c [POWERPC] bootwrapper: convert cuboot-8{3,5}xx to dt_fixup_mac_address_by_alias 2008-01-23 19:32:47 -06:00
cuboot-824x.c [POWERPC] Add initial iomega StorCenter board port. 2008-01-23 19:54:36 -06:00
cuboot-bamboo.c [POWERPC] 4xx: Use correct board info structure in cuboot wrappers 2008-02-28 08:16:27 -06:00
cuboot-c2k.c powerpc: Boot code for the C2K 2008-06-09 13:42:25 +10:00
cuboot-ebony.c [POWERPC] 4xx: Use correct board info structure in cuboot wrappers 2008-02-28 08:16:27 -06:00
cuboot-katmai.c [POWERPC] 4xx: Use correct board info structure in cuboot wrappers 2008-02-28 08:16:27 -06:00
cuboot-mpc7448hpc2.c [POWERPC] bootwrapper: Build multiple cuImages 2008-02-07 11:40:19 +11:00
cuboot-pq2.c [POWERPC] cuboot-pq2: PCI fixes 2008-04-17 01:01:40 -05:00
cuboot-rainier.c [POWERPC] Start removing linux,network-index in favour of aliases 2008-03-26 07:19:16 -05:00
cuboot-sam440ep.c powerpc/4xx: Sam440ep support 2008-06-11 08:32:49 -04:00
cuboot-sequoia.c [POWERPC] Start removing linux,network-index in favour of aliases 2008-03-26 07:19:16 -05:00
cuboot-taishan.c [POWERPC] Start removing linux,network-index in favour of aliases 2008-03-26 07:19:16 -05:00
cuboot-warp.c [POWERPC] PIKA Warp: Update platform code to support Rev B boards 2008-05-29 07:06:56 -05:00
cuboot-yosemite.c [POWERPC] 4xx: Add bootwrapper for AMCC Yosemite board 2008-03-26 07:19:17 -05:00
cuboot.c [POWERPC] bootwrapper: Move linker symbols into ops.h 2007-08-22 15:27:28 +10:00
cuboot.h [POWERPC] Consolidate cuboot initialization code 2007-06-14 22:30:16 +10:00
dcr.h [POWERPC] 4xx: Add 405GPr and 405EP support in boot wrapper 2008-01-08 07:58:09 -06:00
devtree.c [POWERPC] Add bootwrapper function to get virtual reg from the device tree. 2008-04-17 01:01:37 -05:00
div64.S
dummy.c powerpc/32: Generate miboot images with ARCH=powerpc 2006-01-15 13:00:08 +11:00
ebony.c [POWERPC] Start removing linux,network-index in favour of aliases 2008-03-26 07:19:16 -05:00
elf.h [POWERPC] Move bootwrapper ELF parsing routines to a file 2007-04-13 03:55:16 +10:00
elf_util.c powerpc: Make the 64-bit kernel as a position-independent executable 2008-09-15 11:08:38 -07:00
ep88xc.c [POWERPC] Use embedded libfdt in the bootwrapper 2007-12-11 13:46:14 +11:00
ep405.c [POWERPC] 4xx: EP405 boards support for arch/powerpc 2007-12-23 13:13:14 -06:00
ep8248e.c [POWERPC] 82xx: Embedded Planet EP8248E support 2008-01-23 19:34:43 -06:00
fixed-head.S [POWERPC] 8xx/wrapper: Embedded Planet EP88xC support 2007-10-04 11:02:40 -05:00
flatdevtree_env.h Fix file references in documentation and Kconfig 2008-01-22 10:43:36 -08:00
fsl-soc.c [POWERPC] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions. 2007-10-03 20:36:35 -05:00
fsl-soc.h [POWERPC] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions. 2007-10-03 20:36:35 -05:00
gunzip_util.c [POWERPC] boot: Simplify gunzip_finish 2007-10-03 11:48:43 +10:00
gunzip_util.h [POWERPC] Add documentation for the zImage's gunzip convenience functions 2007-03-16 16:38:19 +11:00
hack-coff.c powerpc: Make COFF zImages for old 32-bit powermacs 2006-01-14 15:04:06 +11:00
holly.c [POWERPC] Use embedded libfdt in the bootwrapper 2007-12-11 13:46:14 +11:00
install.sh [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
io.h powerpc: Move include files to arch/powerpc/include/asm 2008-08-04 12:02:00 +10:00
libfdt-wrapper.c [POWERPC] Replace remaining __FUNCTION__ occurrences 2008-04-01 20:43:09 +11:00
libfdt_env.h powerpc: Update in-kernel dtc and libfdt to version 1.2.0 2008-08-20 16:34:58 +10:00
main.c [POWERPC] Kill flatdevtree.c 2007-12-11 13:46:15 +11:00
Makefile powerpc: Make the 64-bit kernel as a position-independent executable 2008-09-15 11:08:38 -07:00
mktree.c [POWERPC] Support for the Ebony 440GP reference board in arch/powerpc 2007-05-08 14:47:32 +10:00
mpc8xx.c [POWERPC] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions. 2007-10-03 20:36:35 -05:00
mpc8xx.h [POWERPC] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions. 2007-10-03 20:36:35 -05:00
mpc52xx-psc.c [POWERPC] Add bootwrapper function to get virtual reg from the device tree. 2008-04-17 01:01:37 -05:00
mpsc.c [POWERPC] prpmc2800: Clean up dts properties 2008-04-15 21:21:24 +10:00
mv64x60.c [POWERPC] mv64x60: Remove device tree absolute path references 2008-04-15 21:21:24 +10:00
mv64x60.h [POWERPC] Add bootwrapper support for Marvell/mv64x60 hostbridge 2007-05-12 11:32:49 +10:00
mv64x60_i2c.c [POWERPC] mv64x60: Remove device tree absolute path references 2008-04-15 21:21:24 +10:00
ns16550.c [POWERPC] Xilinx: boot support for Xilinx uart 16550. 2008-04-24 13:32:46 -05:00
of.c [POWERPC] bootwrapper: Move linker symbols into ops.h 2007-08-22 15:27:28 +10:00
of.h [POWERPC] Make more OF-related bootwrapper functions available to non-OF platforms 2007-06-28 19:19:28 +10:00
ofconsole.c [POWERPC] Make more OF-related bootwrapper functions available to non-OF platforms 2007-06-28 19:19:28 +10:00
oflib.c powerpc: Change the default link address for pSeries zImage kernels 2008-07-01 11:28:32 +10:00
ops.h [POWERPC] Add bootwrapper function to get virtual reg from the device tree. 2008-04-17 01:01:37 -05:00
page.h
planetcore.c [POWERPC] bootwrapper: Add PlanetCore firmware support 2007-10-03 11:48:43 +10:00
planetcore.h [POWERPC] bootwrapper: Add PlanetCore firmware support 2007-10-03 11:48:43 +10:00
ppc_asm.h
ppcboot.h [POWERPC] bootwrapper: Add TARGET_HAS_ETHn tests to ppcboot.h 2007-08-22 15:21:48 +10:00
pq2.c [POWERPC] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions. 2007-10-03 20:36:35 -05:00
pq2.h [POWERPC] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions. 2007-10-03 20:36:35 -05:00
prpmc2800.c [POWERPC] mv64x60: Remove device tree absolute path references 2008-04-15 21:21:24 +10:00
ps3-head.S [POWERPC] PS3: Bootwrapper improvements 2008-04-01 20:43:07 +11:00
ps3-hvcall.S [POWERPC] PS3: Fix bootwrapper hang bug 2008-02-14 22:11:01 +11:00
ps3.c [POWERPC] PS3: Bootwrapper improvements 2008-04-01 20:43:07 +11:00
README
redboot-8xx.c [POWERPC] 8xx: Analogue & Micro Adder875 board support. 2008-01-23 19:34:40 -06:00
redboot-83xx.c [POWERPC] 83xx: Add support for Analogue & Micro ASP837E board 2008-06-02 14:44:25 -05:00
redboot.h [POWERPC] 8xx: Analogue & Micro Adder875 board support. 2008-01-23 19:34:40 -06:00
reg.h [POWERPC] 4xx: Add mfspr/mtspr inline macros to 4xx bootwrapper 2007-12-23 13:14:22 -06:00
rs6000.h powerpc: Make COFF zImages for old 32-bit powermacs 2006-01-14 15:04:06 +11:00
serial.c [POWERPC] mv64x60: Fix FDT compatible names: mv64x60 => mv64360 2008-04-15 21:21:24 +10:00
simple_alloc.c [POWERPC] bootwrapper: Use `unsigned long' for malloc sizes 2007-04-24 22:06:54 +10:00
simpleboot.c powerpc/virtex: Fix booting of Xilinx FPGAs with 16550 for 405 and 440 2008-07-04 00:58:59 -06:00
stdio.c [POWERPC] Add u64 printf to bootwrapper 2007-06-28 19:16:48 +10:00
stdio.h [POWERPC] Add gcc format warnings to zImage printf() 2007-03-26 15:11:20 +10:00
stdlib.c [POWERPC] bootwrapper: Add strtoull() 2007-09-14 01:33:23 +10:00
stdlib.h [POWERPC] bootwrapper: Add strtoull() 2007-09-14 01:33:23 +10:00
string.h [POWERPC] Add memchr() to the bootwrapper 2007-10-12 14:13:44 +10:00
string.S [POWERPC] Add memchr() to the bootwrapper 2007-10-12 14:13:44 +10:00
treeboot-bamboo.c [POWERPC] cuimage for Bamboo board 2007-09-19 21:13:16 -05:00
treeboot-ebony.c [POWERPC] bootwrapper: Move linker symbols into ops.h 2007-08-22 15:27:28 +10:00
treeboot-walnut.c [POWERPC] Start removing linux,network-index in favour of aliases 2008-03-26 07:19:16 -05:00
types.h [POWERPC] Add signed types to bootwrapper 2007-06-28 19:16:47 +10:00
uartlite.c [POWERPC] Uartlite: bootwrapper bug fix, getc loops forever 2007-10-10 09:14:35 -06:00
util.S [POWERPC] Add non-OF serial console support 2006-10-23 12:49:19 +10:00
virtex.c powerpc/virtex: Fix booting of Xilinx FPGAs with 16550 for 405 and 440 2008-07-04 00:58:59 -06:00
virtex405-head.S [POWERPC] bootwrapper: Add a firmware-independent simpleboot target. 2008-04-02 20:36:11 -05:00
wrapper powerpc: Add cuImage.mpc866ads to the bootwrapper as a cuboot-8xx target 2008-08-21 00:37:04 -05:00
zImage.coff.lds.S powerpc: Change the default link address for pSeries zImage kernels 2008-07-01 11:28:32 +10:00
zImage.lds.S powerpc: Change the default link address for pSeries zImage kernels 2008-07-01 11:28:32 +10:00
zImage.ps3.lds.S [POWERPC] PS3: Bootwrapper support. 2007-07-10 21:56:40 +10:00

To extract the kernel vmlinux, System.map, .config or initrd from the zImage binary:

objcopy -j .kernel:vmlinux -O binary zImage vmlinux.gz
objcopy -j .kernel:System.map -O binary zImage System.map.gz
objcopy -j .kernel:.config -O binary zImage config.gz
objcopy -j .kernel:initrd -O binary zImage.initrd initrd.gz


	Peter