-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathlinux.h
116 lines (109 loc) · 2.96 KB
/
linux.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* stubby
*
* Copyright (c) 2020 Cisco Systems, Inc. <pmoore2@cisco.com>
*
* This file was originally copied from systemd under the LGPL-2.1+ license
* and that license has been preserved in this project. The systemd source
* repository can be found at https://github.com/systemd/systemd.
*
*/
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifndef __STUBBY_LINUX_H
#define __STUBBY_LINUX_H
#define SETUP_MAGIC 0x53726448 /* "HdrS" */
struct setup_header {
UINT8 setup_sects;
UINT16 root_flags;
UINT32 syssize;
UINT16 ram_size;
UINT16 vid_mode;
UINT16 root_dev;
UINT16 boot_flag;
UINT16 jump;
UINT32 header;
UINT16 version;
UINT32 realmode_swtch;
UINT16 start_sys_seg;
UINT16 kernel_version;
UINT8 type_of_loader;
UINT8 loadflags;
UINT16 setup_move_size;
UINT32 code32_start;
UINT32 ramdisk_image;
UINT32 ramdisk_size;
UINT32 bootsect_kludge;
UINT16 heap_end_ptr;
UINT8 ext_loader_ver;
UINT8 ext_loader_type;
UINT32 cmd_line_ptr;
UINT32 initrd_addr_max;
UINT32 kernel_alignment;
UINT8 relocatable_kernel;
UINT8 min_alignment;
UINT16 xloadflags;
UINT32 cmdline_size;
UINT32 hardware_subarch;
UINT64 hardware_subarch_data;
UINT32 payload_offset;
UINT32 payload_length;
UINT64 setup_data;
UINT64 pref_address;
UINT32 init_size;
UINT32 handover_offset;
} __attribute__((packed));
/* adapted from linux' bootparam.h */
struct boot_params {
UINT8 screen_info[64];
UINT8 apm_bios_info[20];
UINT8 _pad2[4];
UINT64 tboot_addr;
UINT8 ist_info[16];
UINT8 _pad3[16];
UINT8 hd0_info[16];
UINT8 hd1_info[16];
UINT8 sys_desc_table[16];
UINT8 olpc_ofw_header[16];
UINT32 ext_ramdisk_image;
UINT32 ext_ramdisk_size;
UINT32 ext_cmd_line_ptr;
UINT8 _pad4[116];
UINT8 edid_info[128];
UINT8 efi_info[32];
UINT32 alt_mem_k;
UINT32 scratch;
UINT8 e820_entries;
UINT8 eddbuf_entries;
UINT8 edd_mbr_sig_buf_entries;
UINT8 kbd_status;
UINT8 secure_boot;
UINT8 _pad5[2];
UINT8 sentinel;
UINT8 _pad6[1];
struct setup_header hdr;
UINT8 _pad7[0x290 - 0x1f1 - sizeof(struct setup_header)];
UINT32 edd_mbr_sig_buffer[16];
UINT8 e820_table[20 * 128];
UINT8 _pad8[48];
UINT8 eddbuf[6 * 82];
UINT8 _pad9[276];
} __attribute__((packed));
EFI_STATUS linux_exec(EFI_HANDLE *image,
CHAR8 *cmdline, UINTN cmdline_size,
UINTN linux_addr,
UINTN initrd_addr, UINTN initrd_size);
#endif