]> git.proxmox.com Git - grub2.git/blob - include/grub/offsets.h
Reduce memory footprint on SGI by putting modules before the kernel
[grub2.git] / include / grub / offsets.h
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2002,2003,2007,2008 Free Software Foundation, Inc.
4 *
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef OFFSETS_HEADER
20 #define OFFSETS_HEADER 1
21
22 /* The offset of GRUB_TOTAL_MODULE_SIZE. */
23 #define GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE 0x8
24
25 /* The offset of GRUB_KERNEL_IMAGE_SIZE. */
26 #define GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE 0xc
27
28 /* The offset of GRUB_COMPRESSED_SIZE. */
29 #define GRUB_KERNEL_I386_PC_COMPRESSED_SIZE 0x10
30
31 /* The offset of GRUB_INSTALL_DOS_PART. */
32 #define GRUB_KERNEL_I386_PC_INSTALL_DOS_PART 0x14
33
34 /* The offset of GRUB_INSTALL_BSD_PART. */
35 #define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
36
37 /* Offset of reed_solomon_redundancy. */
38 #define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
39
40 /* The size of the first region which won't be compressed. */
41 #define GRUB_KERNEL_I386_PC_RAW_SIZE 0xcd0
42
43 #define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x730
44
45 /* The offset of GRUB_PREFIX. */
46 #define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
47
48 /* End of the data section. */
49 #define GRUB_KERNEL_I386_PC_PREFIX_END (GRUB_KERNEL_I386_PC_PREFIX + 0x40)
50
51 /* The segment where the kernel is loaded. */
52 #define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
53
54 #define GRUB_KERNEL_I386_PC_LINK_ADDR 0x8200
55
56 /* The upper memory area (starting at 640 kiB). */
57 #define GRUB_MEMORY_I386_PC_UPPER 0xa0000
58 #define GRUB_MEMORY_I386_QEMU_UPPER GRUB_MEMORY_I386_PC_UPPER
59
60 /* The offset of GRUB_CORE_ENTRY_ADDR. */
61 #define GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR 0x4
62
63 /* The offset of GRUB_CORE_ENTRY_ADDR. */
64 #define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR 0x8
65
66 /* The offset of GRUB_KERNEL_IMAGE_SIZE. */
67 #define GRUB_KERNEL_I386_QEMU_KERNEL_IMAGE_SIZE 0xc
68
69 /* The offset of GRUB_PREFIX. */
70 #define GRUB_KERNEL_I386_QEMU_PREFIX 0x10
71
72 /* End of the data section. */
73 #define GRUB_KERNEL_I386_QEMU_PREFIX_END 0x50
74
75 #define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200
76
77 /* The offset of GRUB_TOTAL_MODULE_SIZE. */
78 #define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8
79
80 /* The offset of GRUB_KERNEL_IMAGE_SIZE. */
81 #define GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE 0xc
82
83 /* The offset of GRUB_COMPRESSED_SIZE. */
84 #define GRUB_KERNEL_SPARC64_IEEE1275_COMPRESSED_SIZE 0x10
85
86 /* The offset of GRUB_PREFIX. */
87 #define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX 0x14
88
89 /* End of the data section. */
90 #define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END 0x114
91
92 #define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
93
94 #define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
95 #define GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE 0
96 #define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
97
98 #define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX 0x4
99 #define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END 0x44
100 #define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
101 #define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
102
103 #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR 0x80200000
104
105 #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN 32
106
107 #define GRUB_KERNEL_MIPS_LOONGSON_COMPRESSED_SIZE 0x8
108 #define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_SIZE 0xc
109 #define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_ADDR 0x10
110
111 #define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE 0x08
112 #define GRUB_KERNEL_MIPS_LOONGSON_PREFIX 0x0c
113 #define GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END 0x54
114
115 #define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR 0x80200000
116 #define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN 32
117 #define GRUB_KERNEL_MIPS_QEMU_MIPS_COMPRESSED_SIZE 0x8
118 #define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE 0xc
119 #define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
120 #define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08
121 #define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX 0x0c
122 #define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END 0x54
123
124 #define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8bd00000
125
126 #define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32
127
128 #define GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE 0x8
129 #define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
130 #define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_ADDR 0x10
131
132 #define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
133 #define GRUB_KERNEL_MIPS_ARC_PREFIX 0x0c
134 #define GRUB_KERNEL_MIPS_ARC_PREFIX_END 0x54
135
136 /* The offset of GRUB_PREFIX. */
137 #define GRUB_KERNEL_I386_EFI_PREFIX 0x8
138
139 /* End of the data section. */
140 #define GRUB_KERNEL_I386_EFI_PREFIX_END 0x50
141
142 /* The offset of GRUB_PREFIX. */
143 #define GRUB_KERNEL_IA64_EFI_PREFIX 0x50
144
145 /* End of the data section. */
146 #define GRUB_KERNEL_IA64_EFI_PREFIX_END 0xa0
147
148 /* The offset of GRUB_PREFIX. */
149 #define GRUB_KERNEL_X86_64_EFI_PREFIX 0x8
150
151 /* End of the data section. */
152 #define GRUB_KERNEL_X86_64_EFI_PREFIX_END 0x50
153
154 #define GRUB_KERNEL_I386_COREBOOT_PREFIX 0x2
155 #define GRUB_KERNEL_I386_COREBOOT_PREFIX_END 0x42
156 #define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
157
158 #define GRUB_KERNEL_I386_MULTIBOOT_PREFIX GRUB_KERNEL_I386_COREBOOT_PREFIX
159 #define GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END GRUB_KERNEL_I386_COREBOOT_PREFIX_END
160
161 #define GRUB_KERNEL_I386_IEEE1275_PREFIX 0x2
162 #define GRUB_KERNEL_I386_IEEE1275_PREFIX_END 0x42
163 #define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
164
165 #define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
166 #define GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN 0x1
167 #define GRUB_KERNEL_I386_MULTIBOOT_MOD_ALIGN GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
168
169 /* Non-zero value is only needed for PowerMacs. */
170 #define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0
171 #define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0
172
173 #define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
174
175 #define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
176 #define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
177 #define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN 0x1
178
179 /* Minimal gap between _end and the start of the modules. It's a hack
180 for PowerMac to prevent "CLAIM failed" error. The real fix is to
181 rewrite grub-mkimage to generate valid ELF files. */
182 #define GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP 0x8000
183
184 #ifdef GRUB_MACHINE
185 #define GRUB_OFFSETS_CONCAT_(a,b,c) a ## b ## c
186 #define GRUB_OFFSETS_CONCAT(a,b,c) GRUB_OFFSETS_CONCAT_(a,b,c)
187 #define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_ALIGN)
188 #define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_GAP)
189 #define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _TOTAL_MODULE_SIZE)
190 #define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _KERNEL_IMAGE_SIZE)
191 #define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _COMPRESSED_SIZE)
192 #define GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
193 #define GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
194
195 #define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX)
196 #define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX_END)
197 #define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
198 #define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
199 #define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _RAW_SIZE)
200 #define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_BSD_PART)
201 #define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_DOS_PART)
202 #define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
203 #endif
204
205 #ifndef ASM_FILE
206 struct grub_pc_bios_boot_blocklist
207 {
208 grub_uint64_t start;
209 grub_uint16_t len;
210 grub_uint16_t segment;
211 } __attribute__ ((packed));
212 #endif
213
214 #endif