From b731a61ab541367848c96e306f7d29e90e53f1d5 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Fri, 26 Feb 2016 20:12:39 +0100 Subject: 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 Signed-off-by: Sascha Hauer --- arch/arm/lib/bootm.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/arm/lib') 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; } } -- cgit v1.2.3