kernel.ld 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /******************************************************************************
  2. * kernel.ld
  3. * by Alex Chadwick
  4. *
  5. * A linker script for generation of raspberry pi kernel images.
  6. ******************************************************************************/
  7. SECTIONS {
  8. /* Link the kernel at this address: "." means the current address */
  9. /* Must be equal to KERNLINK */
  10. . = 0x80008000;
  11. /*
  12. * First and formost we need the .init section, containing the code to
  13. * be run first. We allow room for the ATAGs and stack and conform to
  14. * the bootloader's expectation by putting this code at 0x8000.
  15. */
  16. .init 0x80008000 : AT(0x8000) {
  17. *(.init)
  18. }
  19. /*
  20. * Next we put the rest of the code.
  21. */
  22. .text : {
  23. *.c.o(.text)
  24. *(.text .stub .text.*)
  25. }
  26. /*
  27. * read-only data
  28. */
  29. .rodata : {
  30. *(.rodata .rodata.*)
  31. }
  32. /* Adjust the address for the data segment to the next page */
  33. . = ALIGN(0x1000);
  34. /*
  35. * Next we put the data.
  36. */
  37. .data : {
  38. *(.data)
  39. *.c.o(*)
  40. }
  41. .bss : {
  42. *(.bss)
  43. }
  44. PROVIDE(end = .);
  45. /*
  46. * Finally comes everything else. A fun trick here is to put all other
  47. * sections into this section, which will be discarded by default.
  48. */
  49. /DISCARD/ : {
  50. *(.eh_frame .note.GNU-stack)
  51. }
  52. }