[PATCH 3/3] arm: bootm: be more clever about kernel spacing
Lucas Stach
dev at lynxeye.de
Fri Feb 26 11:12:39 PST 2016
From: Lucas Stach <l.stach at pengutronix.de>
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 at pengutronix.de>
---
arch/arm/lib/bootm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index a18d149..28b4f4a 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;
}
}
--
2.5.0
More information about the barebox
mailing list