sos

[unmaintained] experimenting with low level OS development
Log | Files | Refs | README | LICENSE

kernel.ld (752B)


      1 ENTRY(_start)
      2 OUTPUT_FORMAT(elf32-i386)
      3 
      4 SECTIONS
      5 {
      6 	/* Begin putting sections at 1 MiB, a conventional place for kernels to be
      7 	   loaded at by the bootloader. */
      8 	. = 1M;
      9 
     10 	/* First put the multiboot header, as it is required to be put very early
     11 	   early in the image or the bootloader won't recognize the file format.
     12 	   Next we'll put the .text section. */
     13 	.text BLOCK(4K) : ALIGN(4K)
     14 	{
     15 		*(.multiboot)
     16 		*(.text)
     17 	}
     18 
     19 	.rodata BLOCK(4K) : ALIGN(4K)
     20 	{
     21 		*(.rodata)
     22 	}
     23 
     24 	.data BLOCK(4K) : ALIGN(4K)
     25 	{
     26 		*(.data)
     27 	}
     28 
     29 	.bss BLOCK(4K) : ALIGN(4K)
     30 	{
     31 		*(COMMON)
     32 		*(.bss)
     33 		*(.bootstrap_stack)
     34 	}
     35 
     36 	/* The compiler may produce other sections, by default it will put them in
     37 	   a segment with the same name. Simply add stuff here as needed. */
     38 }