summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2016-02-26 20:12:39 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-03-01 07:32:13 +0100
commitb731a61ab541367848c96e306f7d29e90e53f1d5 (patch)
treee6b90a8c889043b1fa4c6ee747e351567fabe39a /arch/arm/lib
parenta324fb5acec8a6889b7ca5f08e796eab17ea5f54 (diff)
downloadbarebox-b731a61ab541367848c96e306f7d29e90e53f1d5.tar.gz
barebox-b731a61ab541367848c96e306f7d29e90e53f1d5.tar.xz
arm: bootm: be more clever about kernel spacing
When the kernel load address is chosen by the user/image we need to check if the kernel needs to relocate itself before decompression. If that's the case the spacing behind the kernel must allow for this relocation without overwriting anything placed behind the kernel. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r--arch/arm/lib/bootm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index a18d14959c..28b4f4a4b4 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -92,6 +92,14 @@ static void get_kernel_addresses(unsigned long mem_start, size_t image_size,
if (verbose)
printf("no OS load address, defaulting to 0x%08lx\n",
*load_address);
+ } else if (*load_address <= mem_start + image_decomp_size) {
+ /*
+ * If the user/image specified an address where the kernel needs
+ * to relocate itself before decompression we need to extend the
+ * spacing to allow this relocation to happen without
+ * overwriting anything placed behind the kernel.
+ */
+ *spacing += image_decomp_size;
}
}