From eb6a12e18d45879ec383921f0c7378120b71d159 Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Wed, 17 Dec 2025 14:13:08 +0700 Subject: Linker script rework `memory.ld` is a architecture-dependent ld config provides some general symbols which every `memory.ld` config must assign and memory regions associated with each output section. 'linker.ld' config file presents segments configuration. Multiboot section filling move in the 'linker.ld' file. Recommendation for further patches: controlled logic implementation for multiboot version and header/entries in build configuration tool (CMake or make). For instance, multiboot version and video mode selection through variable passing in build system: `cmake ... -DMULTIBOOT_VERSION=2 -DMULTIBOOT_VIDEO_MODE=TEXT_VIDEO_MODE` or 'export MULTIBOOT_VERSION=2; export MULTIBOOT_VIDEO_MODE=TEXT_VIDEO_MODE'. Then build system do proper filling of `.multiboot` section depends on passing variables. Signed-off-by: Alexey Gavrilov --- arch/x86/memory.ld | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 arch/x86/memory.ld (limited to 'arch/x86') diff --git a/arch/x86/memory.ld b/arch/x86/memory.ld new file mode 100644 index 0000000..0226aca --- /dev/null +++ b/arch/x86/memory.ld @@ -0,0 +1,13 @@ +MEMORY + { + RAM : ORIGIN = 0x00100000, LENGTH = 1M + } + +REGION_ALIAS("REGION_MULTIBOOT", RAM); +REGION_ALIAS("REGION_TEXT", RAM); +REGION_ALIAS("REGION_RODATA", RAM); +REGION_ALIAS("REGION_DATA", RAM); +REGION_ALIAS("REGION_BSS", RAM); +REGION_ALIAS("REGION_COMMON", RAM); + +PROVIDE(START_ADDR = ORIGIN(RAM)); -- cgit v1.2.3