From 5443567733f00e8217731c1241f565025e6f4c9e Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 17 Nov 2020 22:38:16 +0100 Subject: I think this fixes quite many bugs! For real though! First tests show no weird bugs anymore. --- kernel/Makefile | 2 +- kernel/link.ld | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 kernel/link.ld (limited to 'kernel') diff --git a/kernel/Makefile b/kernel/Makefile index 1bc41c5..64b5993 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -36,4 +36,4 @@ all: compile compile: $(COBJS) @mkdir -p ../build/ @$(LD) -N -ekernel_main -Ttext 0x00050000 -o ../build/kernel.elf -L../build/ $+ -lk - @$(OC) -O binary ../build/kernel.elf ../build/kernel.bin + @$(LD) -N -Tlink.ld -o ../build/kernel.bin -L../build/ $+ -lk diff --git a/kernel/link.ld b/kernel/link.ld new file mode 100644 index 0000000..0d8d865 --- /dev/null +++ b/kernel/link.ld @@ -0,0 +1,30 @@ +OUTPUT_FORMAT("binary") +OUTPUT_ARCH(i386) +ENTRY(kernel_main) +phys = 0x00050000; + +SECTIONS +{ + .text phys : AT(phys) { + code = .; + *(.text) + *(.rodata) + . = ALIGN(4096); + } + + .data : AT(phys + (data - code)) + { + data = .; + *(.data) + . = ALIGN(4096); + } + + .bss : AT(phys + (bss - code)) + { + bss = .; + *(.bss) + . = ALIGN(4096); + } + + end = .; +} -- cgit v1.2.3