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.6KB

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