xref: /aosp_15_r20/external/vboot_reference/futility/kernel_blob.h (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1 /* Copyright 2010 The ChromiumOS Authors
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  *
5  * Constants describing the kernel blob content.
6  */
7 
8 #ifndef VBOOT_REFERENCE_KERNEL_BLOB_H_
9 #define VBOOT_REFERENCE_KERNEL_BLOB_H_
10 
11 /* Linux vmlinuz header signature */
12 #define VMLINUZ_HEADER_SIG 0x53726448
13 
14 /* Maximum kernel command-line size */
15 #define CROS_CONFIG_SIZE 4096
16 
17 /* Size of the x86 zeropage table */
18 #define CROS_PARAMS_SIZE 4096
19 
20 /* Alignment of various chunks within the kernel blob */
21 #define CROS_ALIGN 4096
22 
23 /* Sentinel RAM address indicating that no entry address is specified */
24 #define CROS_NO_ENTRY_ADDR     (~0)
25 
26 /* RAM address where the 32-bit kernel expects to be started */
27 #define CROS_32BIT_ENTRY_ADDR  0x100000
28 
29 /* Simplified version of x86 kernel e820 memory map entries */
30 #define E820_ENTRY_MAX 128
31 #define E820_TYPE_RAM      1
32 #define E820_TYPE_RESERVED 2
33 
34 struct linux_kernel_e820entry {
35 	uint64_t start_addr;
36 	uint64_t segment_size;
37 	uint32_t segment_type;
38 } __attribute__((packed));
39 
40 /* Simplified version of the x86 kernel zeropage table */
41 struct linux_kernel_params {
42 	uint8_t pad0[0x1e8 - 0x0];
43 	uint8_t n_e820_entry;			/* 1e8 */
44 	uint8_t pad1[0x1f1 - 0x1e9];
45 	uint8_t setup_sects;			/* 1f1 */
46 	uint8_t pad2[0x1fe - 0x1f2];
47 	uint16_t boot_flag;			/* 1fe */
48 	uint16_t jump;				/* 200 */
49 	uint32_t header;			/* 202 */
50 	uint16_t version;			/* 206 */
51 	uint8_t pad3[0x210 - 0x208];
52 	uint8_t type_of_loader;			/* 210 */
53 	uint8_t pad4[0x218 - 0x211];
54 	uint32_t ramdisk_image;			/* 218 */
55 	uint32_t ramdisk_size;			/* 21c */
56 	uint8_t pad5[0x228 - 0x220];
57 	uint32_t cmd_line_ptr;			/* 228 */
58 	uint32_t ramdisk_max;			/* 22c */
59 	uint32_t kernel_alignment;		/* 230 */
60 	uint8_t relocatable_kernel;		/* 234 */
61 	uint8_t min_alignment;			/* 235 */
62 	uint8_t pad6[0x2d0 - 0x236];
63 	struct linux_kernel_e820entry
64 		e820_entries[E820_ENTRY_MAX];	/* 2d0-cd0 */
65 } __attribute__((packed));
66 
67 #endif  /* VBOOT_REFERENCE_KERNEL_BLOB_H_ */
68