diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/Makefile | 2 | ||||
-rw-r--r-- | kernel/link.ld | 30 |
2 files changed, 31 insertions, 1 deletions
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 = .; +} |