boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

kernel.lds (989B)


      1 /* arm64 seed kernel link layout.
      2  *
      3  * QEMU `-machine virt` puts RAM at 0x40000000. With `-kernel` and the arm64
      4  * Image header, QEMU loads us at RAM_BASE + text_offset = 0x40080000.
      5  * We don't reference absolute addresses in code (the entry stub uses adrp
      6  * which is PC-relative), so the link base mostly affects symbol values.
      7  */
      8 
      9 ENTRY(_head)
     10 
     11 SECTIONS {
     12     . = 0x40080000;
     13 
     14     .head.text : {
     15         KEEP(*(.head.text))
     16     }
     17 
     18     .text : ALIGN(8) {
     19         *(.text .text.*)
     20     }
     21 
     22     .rodata : ALIGN(8) {
     23         *(.rodata .rodata.*)
     24     }
     25 
     26     .data : ALIGN(8) {
     27         *(.data .data.*)
     28     }
     29 
     30     .bss : ALIGN(16) {
     31         __bss_start = .;
     32         *(.bss .bss.*)
     33         *(COMMON)
     34         . = ALIGN(16);
     35         __bss_end = .;
     36     }
     37 
     38     /* 64KB kernel stack */
     39     .stack : ALIGN(16) {
     40         kstack_bottom = .;
     41         . += 0x10000;
     42         kstack_top = .;
     43     }
     44 
     45     _end = .;
     46     _image_end = .;
     47 
     48     /DISCARD/ : {
     49         *(.note.*) *(.comment) *(.eh_frame)
     50     }
     51 }