iPXE
bzimage.h
Go to the documentation of this file.
00001 #ifndef _BZIMAGE_H
00002 #define _BZIMAGE_H
00003 
00004 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00005 
00006 #include <stdint.h>
00007 
00008 /**
00009  * A bzImage header
00010  *
00011  * As documented in Documentation/i386/boot.txt
00012  */
00013 struct bzimage_header {
00014         /** The size of the setup in sectors
00015          *
00016          * If this field contains 0, assume it contains 4.
00017          */
00018         uint8_t setup_sects;
00019         /** If set, the root is mounted readonly */
00020         uint16_t root_flags;
00021         /** DO NOT USE - for bootsect.S use only */
00022         uint16_t syssize;
00023         /** DO NOT USE - obsolete */
00024         uint16_t swap_dev;
00025         /** DO NOT USE - for bootsect.S use only */
00026         uint16_t ram_size;
00027         /** Video mode control */
00028         uint16_t vid_mode;
00029         /** Default root device number */
00030         uint16_t root_dev;
00031         /** 0xAA55 magic number */
00032         uint16_t boot_flag;
00033         /** Jump instruction */
00034         uint16_t jump;
00035         /** Magic signature "HdrS" */
00036         uint32_t header;
00037         /** Boot protocol version supported */
00038         uint16_t version;
00039         /** Boot loader hook (see below) */
00040         uint32_t realmode_swtch;
00041         /** The load-low segment (0x1000) (obsolete) */
00042         uint16_t start_sys;
00043         /** Pointer to kernel version string */
00044         uint16_t kernel_version;
00045         /** Boot loader identifier */
00046         uint8_t type_of_loader;
00047         /** Boot protocol option flags */
00048         uint8_t loadflags;
00049         /** Move to high memory size (used with hooks) */
00050         uint16_t setup_move_size;
00051         /** Boot loader hook (see below) */
00052         uint32_t code32_start;
00053         /** initrd load address (set by boot loader) */
00054         uint32_t ramdisk_image;
00055         /** initrd size (set by boot loader) */
00056         uint32_t ramdisk_size;
00057         /** DO NOT USE - for bootsect.S use only */
00058         uint32_t bootsect_kludge;
00059         /** Free memory after setup end */
00060         uint16_t heap_end_ptr;
00061         /** Unused */
00062         uint16_t pad1;
00063         /** 32-bit pointer to the kernel command line */
00064         uint32_t cmd_line_ptr;
00065         /** Highest legal initrd address */
00066         uint32_t initrd_addr_max;
00067         /** Physical addr alignment required for kernel */
00068         uint32_t kernel_alignment;
00069         /** Whether kernel is relocatable or not */
00070         uint8_t relocatable_kernel;
00071         /** Unused */
00072         uint8_t pad2[3];
00073         /** Maximum size of the kernel command line */
00074         uint32_t cmdline_size;
00075 } __attribute__ (( packed ));
00076 
00077 /** Offset of bzImage header within kernel image */
00078 #define BZI_HDR_OFFSET 0x1f1
00079 
00080 /** bzImage boot flag value */
00081 #define BZI_BOOT_FLAG 0xaa55
00082 
00083 /** bzImage magic signature value */
00084 #define BZI_SIGNATURE 0x53726448
00085 
00086 /** bzImage boot loader identifier for Etherboot */
00087 #define BZI_LOADER_TYPE_ETHERBOOT 0x40
00088 
00089 /** bzImage boot loader identifier for iPXE
00090  *
00091  * We advertise ourselves as Etherboot version 6.
00092  */
00093 #define BZI_LOADER_TYPE_IPXE ( BZI_LOADER_TYPE_ETHERBOOT | 0x06 )
00094 
00095 /** bzImage "load high" flag */
00096 #define BZI_LOAD_HIGH 0x01
00097 
00098 /** Load address for high-loaded kernels */
00099 #define BZI_LOAD_HIGH_ADDR 0x100000
00100 
00101 /** Load address for low-loaded kernels */
00102 #define BZI_LOAD_LOW_ADDR 0x10000
00103 
00104 /** bzImage "kernel can use heap" flag */
00105 #define BZI_CAN_USE_HEAP 0x80
00106 
00107 /** bzImage special video mode "normal" */
00108 #define BZI_VID_MODE_NORMAL 0xffff
00109 
00110 /** bzImage special video mode "ext" */
00111 #define BZI_VID_MODE_EXT 0xfffe
00112 
00113 /** bzImage special video mode "ask" */
00114 #define BZI_VID_MODE_ASK 0xfffd
00115 
00116 /** bzImage maximum initrd address for versions < 2.03 */
00117 #define BZI_INITRD_MAX 0x37ffffff
00118 
00119 /** bzImage command-line structure used by older kernels */
00120 struct bzimage_cmdline {
00121         /** Magic signature */
00122         uint16_t magic;
00123         /** Offset to command line */
00124         uint16_t offset;
00125 } __attribute__ (( packed ));
00126 
00127 /** Offset of bzImage command-line structure within kernel image */
00128 #define BZI_CMDLINE_OFFSET 0x20
00129 
00130 /** bzImage command line present magic marker value */
00131 #define BZI_CMDLINE_MAGIC 0xa33f
00132 
00133 /** Assumed size of real-mode portion (including .bss) */
00134 #define BZI_ASSUMED_RM_SIZE 0x8000
00135 
00136 /** Amount of stack space to provide */
00137 #define BZI_STACK_SIZE 0x1000
00138 
00139 /** Maximum size of command line */
00140 #define BZI_CMDLINE_SIZE 0x7ff
00141 
00142 #endif /* _BZIMAGE_H */