From 7c6386e228294b9780be30ad858231eafebe088c Mon Sep 17 00:00:00 2001 From: Markuss Broks Date: Tue, 14 Jun 2022 19:03:48 +0300 Subject: [PATCH] main: Drop PAYLOAD_SIZE, use compile time kernel size Signed-off-by: Markuss Broks --- include/main.h | 1 + main/linker.lds.S | 2 ++ main/main.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/main.h b/include/main.h index 577b7623..d48ebcf4 100644 --- a/include/main.h +++ b/include/main.h @@ -6,6 +6,7 @@ #ifndef MAIN_H_ /* Include guard */ #define MAIN_H_ +extern unsigned long kernel_size; extern void load_kernel(void* dtb, void* x1, void* x2, void* x3, void* kernel); extern void soc_init(void); extern void board_init(void); diff --git a/main/linker.lds.S b/main/linker.lds.S index ea18a97f..ce9b1c18 100644 --- a/main/linker.lds.S +++ b/main/linker.lds.S @@ -25,4 +25,6 @@ SECTIONS kernel = .; KERNEL_PATH } + + kernel_size = SIZEOF(.kernel); } diff --git a/main/main.c b/main/main.c index 294e680a..0c827ee9 100644 --- a/main/main.c +++ b/main/main.c @@ -23,6 +23,6 @@ void main(void* dt, void* kernel) { #ifdef CONFIG_SIMPLE_FB debug_printfb((char*)CONFIG_FRAMEBUFFER_BASE, "Booting linux...", 0, CONFIG_FRAMEBUFFER_WIDTH, CONFIG_FRAMEBUFFER_STRIDE); #endif - memcpy((void*)CONFIG_PAYLOAD_ENTRY, kernel, CONFIG_PAYLOAD_SIZE); + memcpy((void*)CONFIG_PAYLOAD_ENTRY, kernel, (unsigned long) &kernel_size); load_kernel(dt, 0, 0, 0, (void*)CONFIG_PAYLOAD_ENTRY); }