9
0
Fork 0

ARM: bootm: fix default uImage placement

For small systems we would put the zImage at 32KiB after
the start of memory, and put the DT a bit after the uImage.
The kernel will always try to relocate itself and overwrite
the DT.

Try to be more clever at uImage placement to avoid
triggering the kernel relocation.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Lucas Stach 2014-05-01 23:42:04 +02:00 committed by Sascha Hauer
parent d79618aa66
commit 0839e3f402
1 changed files with 10 additions and 7 deletions

View File

@ -127,7 +127,13 @@ static int do_bootm_linux(struct image_data *data)
load_address = data->os_address;
if (load_address == UIMAGE_INVALID_ADDRESS) {
load_address = mem_start + SZ_32K;
/*
* Just use a conservative default of 4 times the size of the
* compressed image, to avoid the need for the kernel to
* relocate itself before decompression.
*/
load_address = mem_start + PAGE_ALIGN(
uimage_get_size(data->os, data->os_num) * 4);
if (bootm_verbose(data))
printf("no os load address, defaulting to 0x%08lx\n",
load_address);
@ -138,13 +144,10 @@ static int do_bootm_linux(struct image_data *data)
return ret;
/*
* Put devicetree/initrd at maximum to 128MiB into RAM to not
* risk to put it outside of lowmem.
* put oftree/initrd close behind compressed kernel image to avoid
* placing it outside of the kernels lowmem.
*/
if (mem_size > SZ_256M)
mem_free = mem_start + SZ_128M;
else
mem_free = PAGE_ALIGN(data->os_res->end + SZ_1M);
mem_free = PAGE_ALIGN(data->os_res->end + SZ_1M);
return __do_bootm_linux(data, mem_free, 0);
}