From 0ac15a9da6145072909d193785f7bf8cdeeaa321 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 --- board/Kconfig | 4 ---- include/main.h | 1 + main/linker.lds.S | 2 ++ main/main.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/board/Kconfig b/board/Kconfig index 601de32..93d84c9 100644 --- a/board/Kconfig +++ b/board/Kconfig @@ -31,10 +31,6 @@ menu "Device Specific Addresses" default 0x090000000 if SAMSUNG_DREAMLTE default 0x090000000 if SAMSUNG_STARLTE - config PAYLOAD_SIZE - hex "Payload Size" - default 0x2000000 - config FRAMEBUFFER_BASE hex "Framebuffer Base Address (for SimpleFB)" depends on SIMPLE_FB diff --git a/include/main.h b/include/main.h index 577b762..d48ebcf 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 ea18a97..ce9b1c1 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 294e680..0c827ee 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); }