You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bzimage.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #ifndef _BZIMAGE_H
  2. #define _BZIMAGE_H
  3. FILE_LICENCE ( GPL2_OR_LATER );
  4. #include <stdint.h>
  5. /**
  6. * A bzImage header
  7. *
  8. * As documented in Documentation/i386/boot.txt
  9. */
  10. struct bzimage_header {
  11. /** The size of the setup in sectors
  12. *
  13. * If this field contains 0, assume it contains 4.
  14. */
  15. uint8_t setup_sects;
  16. /** If set, the root is mounted readonly */
  17. uint16_t root_flags;
  18. /** DO NOT USE - for bootsect.S use only */
  19. uint16_t syssize;
  20. /** DO NOT USE - obsolete */
  21. uint16_t swap_dev;
  22. /** DO NOT USE - for bootsect.S use only */
  23. uint16_t ram_size;
  24. /** Video mode control */
  25. uint16_t vid_mode;
  26. /** Default root device number */
  27. uint16_t root_dev;
  28. /** 0xAA55 magic number */
  29. uint16_t boot_flag;
  30. /** Jump instruction */
  31. uint16_t jump;
  32. /** Magic signature "HdrS" */
  33. uint32_t header;
  34. /** Boot protocol version supported */
  35. uint16_t version;
  36. /** Boot loader hook (see below) */
  37. uint32_t realmode_swtch;
  38. /** The load-low segment (0x1000) (obsolete) */
  39. uint16_t start_sys;
  40. /** Pointer to kernel version string */
  41. uint16_t kernel_version;
  42. /** Boot loader identifier */
  43. uint8_t type_of_loader;
  44. /** Boot protocol option flags */
  45. uint8_t loadflags;
  46. /** Move to high memory size (used with hooks) */
  47. uint16_t setup_move_size;
  48. /** Boot loader hook (see below) */
  49. uint32_t code32_start;
  50. /** initrd load address (set by boot loader) */
  51. uint32_t ramdisk_image;
  52. /** initrd size (set by boot loader) */
  53. uint32_t ramdisk_size;
  54. /** DO NOT USE - for bootsect.S use only */
  55. uint32_t bootsect_kludge;
  56. /** Free memory after setup end */
  57. uint16_t heap_end_ptr;
  58. /** Unused */
  59. uint16_t pad1;
  60. /** 32-bit pointer to the kernel command line */
  61. uint32_t cmd_line_ptr;
  62. /** Highest legal initrd address */
  63. uint32_t initrd_addr_max;
  64. /** Physical addr alignment required for kernel */
  65. uint32_t kernel_alignment;
  66. /** Whether kernel is relocatable or not */
  67. uint8_t relocatable_kernel;
  68. /** Unused */
  69. uint8_t pad2[3];
  70. /** Maximum size of the kernel command line */
  71. uint32_t cmdline_size;
  72. } __attribute__ (( packed ));
  73. /** Offset of bzImage header within kernel image */
  74. #define BZI_HDR_OFFSET 0x1f1
  75. /** bzImage boot flag value */
  76. #define BZI_BOOT_FLAG 0xaa55
  77. /** bzImage magic signature value */
  78. #define BZI_SIGNATURE 0x53726448
  79. /** bzImage boot loader identifier for Etherboot */
  80. #define BZI_LOADER_TYPE_ETHERBOOT 0x40
  81. /** bzImage boot loader identifier for iPXE
  82. *
  83. * We advertise ourselves as Etherboot version 6.
  84. */
  85. #define BZI_LOADER_TYPE_IPXE ( BZI_LOADER_TYPE_ETHERBOOT | 0x06 )
  86. /** bzImage "load high" flag */
  87. #define BZI_LOAD_HIGH 0x01
  88. /** Load address for high-loaded kernels */
  89. #define BZI_LOAD_HIGH_ADDR 0x100000
  90. /** Load address for low-loaded kernels */
  91. #define BZI_LOAD_LOW_ADDR 0x10000
  92. /** bzImage "kernel can use heap" flag */
  93. #define BZI_CAN_USE_HEAP 0x80
  94. /** bzImage special video mode "normal" */
  95. #define BZI_VID_MODE_NORMAL 0xffff
  96. /** bzImage special video mode "ext" */
  97. #define BZI_VID_MODE_EXT 0xfffe
  98. /** bzImage special video mode "ask" */
  99. #define BZI_VID_MODE_ASK 0xfffd
  100. /** bzImage maximum initrd address for versions < 2.03 */
  101. #define BZI_INITRD_MAX 0x37ffffff
  102. /** bzImage command-line structure used by older kernels */
  103. struct bzimage_cmdline {
  104. /** Magic signature */
  105. uint16_t magic;
  106. /** Offset to command line */
  107. uint16_t offset;
  108. } __attribute__ (( packed ));
  109. /** Offset of bzImage command-line structure within kernel image */
  110. #define BZI_CMDLINE_OFFSET 0x20
  111. /** bzImage command line present magic marker value */
  112. #define BZI_CMDLINE_MAGIC 0xa33f
  113. /** Assumed size of real-mode portion (including .bss) */
  114. #define BZI_ASSUMED_RM_SIZE 0x8000
  115. /** Amount of stack space to provide */
  116. #define BZI_STACK_SIZE 0x1000
  117. /** Maximum size of command line */
  118. #define BZI_CMDLINE_SIZE 0x100
  119. #endif /* _BZIMAGE_H */