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