diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-07 19:06:30 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-07 12:38:01 +0100 |
commit | a81ec0225f5a100341c20b4329c8b1d81ab025c4 (patch) | |
tree | 0d38efb6ba77f80dc0759513d33ab73f7f9bc868 /arch/arm/cpu/start.c | |
parent | b08e08506b9752d3768e42d075283f91d2ed5180 (diff) | |
download | barebox-a81ec0225f5a100341c20b4329c8b1d81ab025c4.tar.gz barebox-a81ec0225f5a100341c20b4329c8b1d81ab025c4.tar.xz |
ARM: Add relocatable binary support
For making the same binary executable on different SoCs which have
different DRAM addresses we have to be independent of the compile
time link address.
This patch adds relocatable binary support for the ARM architecture.
With this two new functions are available. relocate_to_current_adr
will fixup the binary to continue executing from the current position.
relocate_to_adr will copy the binary to a given address, fixup the
binary and continue executing from there.
For the PBL and the real image relocatable support can be enabled
independently. This is done to (hopefully) better cope with setups
where the PBL runs from SRAM or ROM and the real binary does not.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu/start.c')
-rw-r--r-- | arch/arm/cpu/start.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index cd34d9c66d..7c2bcd0631 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -37,6 +37,11 @@ static noinline __noreturn void __start(uint32_t membase, uint32_t memsize, unsigned long endmem = membase + memsize; unsigned long malloc_start, malloc_end; + if (IS_ENABLED(CONFIG_RELOCATABLE)) { + unsigned long barebox_base = arm_barebox_image_place(endmem); + relocate_to_adr(barebox_base); + } + setup_c(); arm_stack_top = endmem; |