diff options
Diffstat (limited to 'arch/mips/lib/reloc.c')
-rw-r--r-- | arch/mips/lib/reloc.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c index 9756d61666..9a9e404f7e 100644 --- a/arch/mips/lib/reloc.c +++ b/arch/mips/lib/reloc.c @@ -40,8 +40,6 @@ #include <linux/sizes.h> #include <asm-generic/memory_layout.h> -#define MAX_BSS_SIZE SZ_1M - void main_entry(void *fdt, u32 fdt_size); void relocate_code(void *fdt, u32 fdt_size, u32 relocaddr); @@ -108,17 +106,6 @@ static void apply_reloc(unsigned int type, void *addr, long off) } } -/** - * relocate_code() - Relocate Barebox, generally from flash to DDR - * @start_addr_sp: new stack pointer - * @new_gd: pointer to relocated global data - * @relocaddr: the address to relocate to - * - * Relocate Barebox from its current location (generally in flash) to a new one - * (generally in DDR). This function will copy the Barebox binary & apply - * relocations as necessary, then jump to board_init_r in the new build of - * Barebox. As such, this function does not return. - */ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size) { unsigned long addr, length, bss_len; @@ -127,8 +114,10 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size) unsigned int type; long off; - length = barebox_image_size + MAX_BSS_SIZE; - relocaddr = ALIGN_DOWN(ram_size - barebox_image_size, SZ_64K); + bss_len = (unsigned long)&__bss_stop - (unsigned long)__bss_start; + + length = barebox_image_size + bss_len; + relocaddr = ALIGN_DOWN(ram_size - length, SZ_64K); relocaddr = KSEG0ADDR(relocaddr); new_stack = relocaddr - MALLOC_SIZE - 16; @@ -143,7 +132,7 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size) panic("Mis-aligned relocation\n"); /* Copy Barebox to RAM */ - memcpy((void *)relocaddr, __image_start, length); + memcpy((void *)relocaddr, __image_start, barebox_image_size); /* Now apply relocations to the copy in RAM */ buf = __rel_start; @@ -162,7 +151,6 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size) /* Clear the .bss section */ bss_start = (uint8_t *)((unsigned long)__bss_start + off); - bss_len = (unsigned long)&__bss_stop - (unsigned long)__bss_start; memset(bss_start, 0, bss_len); __asm__ __volatile__ ( |