1 /* Copyright 2010 The Chromium OS Authors. All rights reserved.
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 #ifndef VBOOT_REFERENCE_KERNEL_BLOB_H_
8 #define VBOOT_REFERENCE_KERNEL_BLOB_H_
9 
10 /* Maximum kernel command-line size */
11 #define CROS_CONFIG_SIZE 4096
12 
13 /* Size of the x86 zeropage table */
14 #define CROS_PARAMS_SIZE 4096
15 
16 /* Alignment of various chunks within the kernel blob */
17 #define CROS_ALIGN 4096
18 
19 /* Sentinel RAM address indicating that no entry address is specified */
20 #define CROS_NO_ENTRY_ADDR     (~0)
21 
22 /* RAM address where the 32-bit kernel expects to be started */
23 #define CROS_32BIT_ENTRY_ADDR  0x100000
24 
25 /* Simplified version of x86 kernel e820 memory map entries */
26 #define E820_ENTRY_MAX 128
27 #define E820_TYPE_RAM      1
28 #define E820_TYPE_RESERVED 2
29 
30 struct linux_kernel_e820entry {
31 	uint64_t start_addr;
32 	uint64_t segment_size;
33 	uint32_t segment_type;
34 } __attribute__ ((packed));
35 
36 /* Simplified version of the x86 kernel zeropage table */
37 struct linux_kernel_params {
38 	uint8_t pad0[0x1e8 - 0x0];
39 	uint8_t n_e820_entry;			/* 1e8 */
40 	uint8_t pad1[0x1f1 - 0x1e9];
41 	uint8_t setup_sects;			/* 1f1 */
42 	uint8_t pad2[0x1fe - 0x1f2];
43 	uint16_t boot_flag;			/* 1fe */
44 	uint16_t jump;				/* 200 */
45 	uint32_t header;			/* 202 */
46 	uint16_t version;			/* 206 */
47 	uint8_t pad3[0x210 - 0x208];
48 	uint8_t type_of_loader;			/* 210 */
49 	uint8_t pad4[0x218 - 0x211];
50 	uint32_t ramdisk_image;			/* 218 */
51 	uint32_t ramdisk_size;			/* 21c */
52 	uint8_t pad5[0x228 - 0x220];
53 	uint32_t cmd_line_ptr;			/* 228 */
54 	uint32_t ramdisk_max;			/* 22c */
55 	uint32_t kernel_alignment;		/* 230 */
56 	uint8_t relocatable_kernel;		/* 234 */
57 	uint8_t min_alignment;			/* 235 */
58 	uint8_t pad6[0x2d0 - 0x236];
59 	struct linux_kernel_e820entry
60 		e820_entries[E820_ENTRY_MAX];	/* 2d0-cd0 */
61 } __attribute__ ((packed));
62 
63 #endif /* VBOOT_REFERENCE_KERNEL_BLOB_H_ */
64