/*We have to write out this linker script so the linker knows where to put all the soup of stuff we put in start.s and main.c. i'll write out reasoning as i go. */ /*letting em know our entry point is actually label "start" in start.s, and not some function in the c file.*/ ENTRY(start) SECTIONS { /*start me at 1Mb because below that is x86 essential stuff, which we dont want to be written on top of.*/ . = 1M; /* we're going to maintain 4K alignment - apparently useful for paging, and i'm not complaining about the lost space anyway. */ /*our multiboot header from start.s - has to go at the beginning of the executable so the bootloader knows we're loadable.*/ /*executable section*/ .mb_sect : { *(.multiboot) } .lower_text : { *(.lower_text) } /* Higher half addressing! We'll have to also specify that we want to be physically placed at 1MB.*/ . += 0xC0000000; _kernel_start = .; .text ALIGN (4K) : AT (ADDR (.text) - 0xC0000000) { *(.text) } /*general read only data*/ .rodata ALIGN (4K) : AT(ADDR(.rodata) - 0xC0000000) { *(.rodata*) *(.gdt_sect) *(.idtr) } /*initialized rw data. */ .data ALIGN (4K) : AT(ADDR(.data) - 0xC0000000) { *(.data) } /*uninitialized data, and our stack as defined in start.s*/ .bss ALIGN(4K) : AT(ADDR(.bss) - 0xC0000000) { *(COMMON) *(.bss) *(.bootstrap_tables) *(.tss) *(.idt) } _kernel_end = .; }