iPXE
include
ipxe
lkrn.h
Go to the documentation of this file.
1
#ifndef _IPXE_LKRN_H
2
#define _IPXE_LKRN_H
3
4
/** @file
5
*
6
* Linux kernel images
7
*
8
*/
9
10
FILE_LICENCE
( GPL2_OR_LATER_OR_UBDL );
11
FILE_SECBOOT
( FORBIDDEN );
12
13
#include <
stdint.h
>
14
15
/** Kernel image header */
16
struct
lkrn_header
{
17
/** Executable code */
18
uint32_t
code
[2];
19
/** Image load offset */
20
uint64_t
text_offset
;
21
/** Image size */
22
uint64_t
image_size
;
23
/** Flags */
24
uint64_t
flags
;
25
/** Reserved */
26
uint8_t
reserved_a
[24];
27
/** Magic */
28
uint32_t
magic
;
29
/** Reserved */
30
uint8_t
reserved_b
[4];
31
}
__attribute__
(( packed ));
32
33
/** Kernel magic value */
34
#define LKRN_MAGIC( a, b, c, d ) \
35
( ( (a) << 0 ) | ( (b) << 8 ) | ( (c) << 16 ) | ( (d) << 24 ) )
36
37
/** Kernel magic value for AArch64 */
38
#define LKRN_MAGIC_AARCH64 LKRN_MAGIC ( 'A', 'R', 'M', 0x64 )
39
40
/** Kernel magic value for RISC-V */
41
#define LKRN_MAGIC_RISCV LKRN_MAGIC ( 'R', 'S', 'C', 0x05 )
42
43
/** Kernel image context */
44
struct
lkrn_context
{
45
/** Load offset */
46
size_t
offset
;
47
/** File size */
48
size_t
filesz
;
49
/** Memory size */
50
size_t
memsz
;
51
52
/** Start of RAM */
53
physaddr_t
ram
;
54
/** Entry point */
55
physaddr_t
entry
;
56
/** Initial ramdisk (if any) */
57
physaddr_t
initrd
;
58
/** Device tree */
59
physaddr_t
fdt
;
60
};
61
62
/** Compressed kernel image header */
63
struct
zimg_header
{
64
/** Reserved */
65
uint8_t
reserved_a
[4];
66
/** Magic */
67
uint32_t
magic
;
68
/** Offset to payload */
69
uint32_t
offset
;
70
/** Length of payload */
71
uint32_t
len
;
72
/** Reserved */
73
uint8_t
reserved_b
[8];
74
/** Compression type */
75
uint32_t
type
;
76
}
__attribute__
(( packed ));
77
78
/** Compressed kernel image magic value */
79
#define ZIMG_MAGIC LKRN_MAGIC ( 'z', 'i', 'm', 'g' )
80
81
/** Compressed kernel image context */
82
struct
zimg_context
{
83
/** Offset to compressed data */
84
size_t
offset
;
85
/** Length of compressed data */
86
size_t
len
;
87
/** Compression type */
88
union
{
89
/** Raw type */
90
uint32_t
raw
;
91
/** Printable string */
92
char
string
[5];
93
}
type
;
94
};
95
96
#include <
bits/lkrn.h
>
97
98
/**
99
* Jump to kernel entry point
100
*
101
* @v entry Kernel entry point
102
* @v fdt Device tree
103
*/
104
void
lkrn_jump
(
physaddr_t
entry,
physaddr_t
fdt
);
105
106
#endif
/* _IPXE_LKRN_H */
uint32_t
unsigned int uint32_t
Definition
stdint.h:12
physaddr_t
unsigned long physaddr_t
Definition
stdint.h:20
uint64_t
unsigned long long uint64_t
Definition
stdint.h:13
uint8_t
unsigned char uint8_t
Definition
stdint.h:10
lkrn.h
Dummy architecture-specific Linux kernel image invocation.
type
uint32_t type
Operating system type.
Definition
ena.h:1
FILE_LICENCE
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition
compiler.h:896
__attribute__
struct lkrn_context __attribute__
FILE_SECBOOT
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition
compiler.h:926
stdint.h
lkrn_jump
void lkrn_jump(physaddr_t entry, physaddr_t fdt)
Jump to kernel entry point.
fdt
A device tree.
Definition
fdt.h:89
lkrn_context
Kernel image context.
Definition
lkrn.h:44
lkrn_context::filesz
size_t filesz
File size.
Definition
lkrn.h:48
lkrn_context::offset
size_t offset
Load offset.
Definition
lkrn.h:46
lkrn_context::fdt
physaddr_t fdt
Device tree.
Definition
lkrn.h:59
lkrn_context::ram
physaddr_t ram
Start of RAM.
Definition
lkrn.h:53
lkrn_context::entry
physaddr_t entry
Entry point.
Definition
lkrn.h:55
lkrn_context::memsz
size_t memsz
Memory size.
Definition
lkrn.h:50
lkrn_context::initrd
physaddr_t initrd
Initial ramdisk (if any)
Definition
lkrn.h:57
lkrn_header
Kernel image header.
Definition
lkrn.h:16
lkrn_header::magic
uint32_t magic
Magic.
Definition
lkrn.h:28
lkrn_header::reserved_b
uint8_t reserved_b[4]
Reserved.
Definition
lkrn.h:30
lkrn_header::reserved_a
uint8_t reserved_a[24]
Reserved.
Definition
lkrn.h:26
lkrn_header::text_offset
uint64_t text_offset
Image load offset.
Definition
lkrn.h:20
lkrn_header::flags
uint64_t flags
Flags.
Definition
lkrn.h:24
lkrn_header::code
uint32_t code[2]
Executable code.
Definition
lkrn.h:18
lkrn_header::image_size
uint64_t image_size
Image size.
Definition
lkrn.h:22
zimg_context
Compressed kernel image context.
Definition
lkrn.h:82
zimg_context::raw
uint32_t raw
Raw type.
Definition
lkrn.h:90
zimg_context::len
size_t len
Length of compressed data.
Definition
lkrn.h:86
zimg_context::offset
size_t offset
Offset to compressed data.
Definition
lkrn.h:84
zimg_header
Compressed kernel image header.
Definition
lkrn.h:63
zimg_header::reserved_b
uint8_t reserved_b[8]
Reserved.
Definition
lkrn.h:73
zimg_header::len
uint32_t len
Length of payload.
Definition
lkrn.h:71
zimg_header::offset
uint32_t offset
Offset to payload.
Definition
lkrn.h:69
zimg_header::reserved_a
uint8_t reserved_a[4]
Reserved.
Definition
lkrn.h:65
zimg_header::type
uint32_t type
Compression type.
Definition
lkrn.h:75
zimg_header::magic
uint32_t magic
Magic.
Definition
lkrn.h:67
Generated by
1.14.0