[PATCH] bootm: abort if kernel is outside the first 128MB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Huge images and the pessimistic approach of barebox to put the
kernel-image at five times its size may lead to it being
positioned not in the first 128MiB of RAM. This is however
required for it to be boot. (Referring to

  https://www.kernel.org/doc/Documentation/arm/Booting

"Calling the kernel image")

This commit aborts the boot and displays a message if the
image is located outside the first 128MB.

Signed-off-by: Patrick Boettcher <p@xxxxxx>
---
 arch/arm/lib32/bootm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c
index 4cf570e57..42febdc71 100644
--- a/arch/arm/lib32/bootm.c
+++ b/arch/arm/lib32/bootm.c
@@ -121,6 +121,12 @@ static int get_kernel_addresses(size_t image_size,
 		spacing += image_decomp_size;
 	}
 
+	if ((*load_address - mem_start) > SZ_128M) {
+		printf("boot aborted: kernel address outside 128MiB "
+		       "(0x%08lx)\n", *load_address);
+		return -ENOMEM;
+	}
+
 	*mem_free = PAGE_ALIGN(*load_address + image_size + spacing);
 
 	/*
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux