kernel.ld 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. /* VESA real-mode stage at 0x7E00, then kernel_main follows. */
  2. ENTRY(_vesa_stage)
  3. SECTIONS
  4. {
  5. . = 0x7E00;
  6. .text : AT(0x7E00) {
  7. *(.text.stage2)
  8. *(.text .text.*)
  9. }
  10. .rodata : { *(.rodata .rodata.*) }
  11. .data : { *(.data .data.*) }
  12. .bss : {
  13. __bss_start = .;
  14. *(.bss .bss.*) *(COMMON)
  15. __bss_end = .;
  16. }
  17. /* Bootstrap/protected-mode stack: inside the image's RAM footprint
  18. * (NOLOAD, so it costs no file bytes), which means its address travels
  19. * with the kernel instead of being a fixed one that kernel growth has
  20. * to be scheduled around. It must sit *after* __bss_end: the BSS clear
  21. * would otherwise wipe the stack kernel_main is running on. */
  22. .stack (NOLOAD) : {
  23. . = ALIGN(16);
  24. __boot_stack_bottom = .;
  25. . += 0x2000; /* 8 KB */
  26. __boot_stack_top = .;
  27. }
  28. _end = .;
  29. }
  30. ASSERT(_end <= 0x7F000, "Kernel too large: would reach the run area at 0x80000");
  31. /* The legacy stage loads the compressed rootfs at 0x60000; the BSS clear and
  32. * the boot stack must stay below it. */
  33. ASSERT(_end <= 0x60000, "Kernel too large: would overlap the low rootfs pack");