1 /* SPDX-License-Identifier: GPL-2.0-only */
5 * Supports bzImage, zImage and Image format.
7 * Based on work by Steve Gehlbach.
8 * Portions are taken from mkelfImage.
10 * 2003-09 by SONE Takeshi
14 #include "linux_trampoline.h"
21 #define E820MAX 32 /* number of entries in E820MAP */
23 u64 addr
; /* start of memory segment */
24 u64 size
; /* size of memory segment */
25 u32 type
; /* type of memory segment */
27 #define E820_RESERVED 2
28 #define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */
32 /* The header of Linux/i386 kernel */
34 u8 reserved1
[0x1f1]; /* 0x000 */
35 u8 setup_sects
; /* 0x1f1 */
36 u16 root_flags
; /* 0x1f2 */
37 u32 syssize
; /* 0x1f4 (2.04+) */
38 u8 reserved2
[2]; /* 0x1f8 */
39 u16 vid_mode
; /* 0x1fa */
40 u16 root_dev
; /* 0x1fc */
41 u16 boot_sector_magic
; /* 0x1fe */
43 u8 reserved3
[2]; /* 0x200 */
44 u8 header_magic
[4]; /* 0x202 */
45 u16 protocol_version
; /* 0x206 */
46 u32 realmode_swtch
; /* 0x208 */
47 u16 start_sys
; /* 0x20c */
48 u16 kver_addr
; /* 0x20e */
49 u8 type_of_loader
; /* 0x210 */
50 u8 loadflags
; /* 0x211 */
51 u16 setup_move_size
; /* 0x212 */
52 u32 code32_start
; /* 0x214 */
53 u32 ramdisk_image
; /* 0x218 */
54 u32 ramdisk_size
; /* 0x21c */
55 u8 reserved4
[4]; /* 0x220 */
57 u16 heap_end_ptr
; /* 0x224 */
58 u8 reserved5
[2]; /* 0x226 */
60 u32 cmd_line_ptr
; /* 0x228 */
62 u32 initrd_addr_max
; /* 0x22c */
64 u32 kernel_alignment
; /* 0x230 */
65 u8 relocatable_kernel
; /* 0x234 */
66 u8 min_alignment
; /* 0x235 (2.10+) */
67 u8 reserved6
[2]; /* 0x236 */
69 u32 cmdline_size
; /* 0x238 */
71 u32 hardware_subarch
; /* 0x23c */
72 u64 hardware_subarch_data
;/* 0x240 */
74 u32 payload_offset
; /* 0x248 */
75 u32 payload_length
; /* 0x24c */
77 u64 setup_data
; /* 0x250 */
79 u64 pref_address
; /* 0x258 */
80 u32 init_size
; /* 0x260 */
83 /* Parameters passed to 32-bit part of Linux
84 * This is another view of the structure above.. */
88 u16 ext_mem_k
; /* 0x02 -- EXT_MEM_K sits here */
89 u16 orig_video_page
; /* 0x04 */
90 u8 orig_video_mode
; /* 0x06 */
91 u8 orig_video_cols
; /* 0x07 */
92 u16 unused2
; /* 0x08 */
93 u16 orig_video_ega_bx
; /* 0x0a */
94 u16 unused3
; /* 0x0c */
95 u8 orig_video_lines
; /* 0x0e */
96 u8 orig_video_isVGA
; /* 0x0f */
97 u16 orig_video_points
; /* 0x10 */
99 /* VESA graphic mode -- linear frame buffer */
100 u16 lfb_width
; /* 0x12 */
101 u16 lfb_height
; /* 0x14 */
102 u16 lfb_depth
; /* 0x16 */
103 u32 lfb_base
; /* 0x18 */
104 u32 lfb_size
; /* 0x1c */
105 u16 cl_magic
; /* 0x20 */
106 #define CL_MAGIC_VALUE 0xA33F
107 u16 cl_offset
; /* 0x22 */
108 u16 lfb_linelength
; /* 0x24 */
109 u8 red_size
; /* 0x26 */
110 u8 red_pos
; /* 0x27 */
111 u8 green_size
; /* 0x28 */
112 u8 green_pos
; /* 0x29 */
113 u8 blue_size
; /* 0x2a */
114 u8 blue_pos
; /* 0x2b */
115 u8 rsvd_size
; /* 0x2c */
116 u8 rsvd_pos
; /* 0x2d */
117 u16 vesapm_seg
; /* 0x2e */
118 u16 vesapm_off
; /* 0x30 */
119 u16 pages
; /* 0x32 */
120 u8 reserved4
[12]; /* 0x34 -- 0x3f reserved for future expansion */
122 //struct apm_bios_info apm_bios_info; /* 0x40 */
123 u8 apm_bios_info
[0x40];
124 //struct drive_info_struct drive_info; /* 0x80 */
126 //struct sys_desc_table sys_desc_table; /* 0xa0 */
127 u8 sys_desc_table
[0x140];
128 u32 alt_mem_k
; /* 0x1e0 */
129 u8 reserved5
[4]; /* 0x1e4 */
130 u8 e820_map_nr
; /* 0x1e8 */
131 u8 reserved6
[8]; /* 0x1e9 */
132 /* This next variable is to show where
133 * in this struct the Linux setup_hdr
134 * is located. It does not get filled in.
135 * We may someday find it useful to use
137 u8 setup_hdr
; /* 0x1f1 */
138 u16 mount_root_rdonly
; /* 0x1f2 */
139 u8 reserved7
[4]; /* 0x1f4 */
140 u16 ramdisk_flags
; /* 0x1f8 */
141 #define RAMDISK_IMAGE_START_MASK 0x07FF
142 #define RAMDISK_PROMPT_FLAG 0x8000
143 #define RAMDISK_LOAD_FLAG 0x4000
144 u8 reserved8
[2]; /* 0x1fa */
145 u16 orig_root_dev
; /* 0x1fc */
146 u8 reserved9
[1]; /* 0x1fe */
147 u8 aux_device_info
; /* 0x1ff */
148 u8 reserved10
[2]; /* 0x200 */
149 u8 param_block_signature
[4]; /* 0x202 */
150 u16 param_block_version
; /* 0x206 */
151 u8 reserved11
[8]; /* 0x208 */
152 u8 loader_type
; /* 0x210 */
153 #define LOADER_TYPE_LOADLIN 1
154 #define LOADER_TYPE_BOOTSECT_LOADER 2
155 #define LOADER_TYPE_SYSLINUX 3
156 #define LOADER_TYPE_ETHERBOOT 4
157 #define LOADER_TYPE_KERNEL 5
158 u8 loader_flags
; /* 0x211 */
159 u8 reserved12
[2]; /* 0x212 */
160 u32 kernel_start
; /* 0x214 */
161 u32 initrd_start
; /* 0x218 */
162 u32 initrd_size
; /* 0x21c */
163 u8 reserved12_5
[8]; /* 0x220 */
164 u32 cmd_line_ptr
; /* 0x228 */
165 u32 initrd_addr_max
; /* 0x22c */
166 u32 kernel_alignment
; /* 0x230 */
167 u8 relocatable_kernel
; /* 0x234 */
168 u8 reserved13
[0x2b]; /* 0x235 */
169 u32 init_size
; /* 0x260 */
170 u8 reserved14
[0x6c]; /* 0x264 */
171 struct e820entry e820_map
[E820MAX
]; /* 0x2d0 */
172 u8 reserved16
[688]; /* 0x550 */
173 #define COMMAND_LINE_SIZE 256
174 /* Command line is copied here by 32-bit i386/kernel/head.S.
175 * So I will follow the boot protocol, rather than putting it
176 * directly here. --ts1 */
177 u8 command_line
[COMMAND_LINE_SIZE
]; /* 0x800 */
178 u8 reserved17
[1792]; /* 0x900 - 0x1000 */