iPXE
lkrn.h
Go to the documentation of this file.
1#ifndef _IPXE_LKRN_H
2#define _IPXE_LKRN_H
4/** @file
5 *
6 * Linux kernel images
7 *
8 */
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( FORBIDDEN );
12
13#include <stdint.h>
14
15/** Kernel image header */
17 /** Executable code */
19 /** Image load offset */
21 /** Image size */
23 /** Flags */
25 /** Reserved */
27 /** Magic */
29 /** Reserved */
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 */
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 */
54 /** Entry point */
56 /** Initial ramdisk (if any) */
58 /** Device tree */
60};
61
62/** Compressed kernel image header */
64 /** Reserved */
66 /** Magic */
68 /** Offset to payload */
70 /** Length of payload */
72 /** Reserved */
74 /** Compression 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 */
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 */
91 /** Printable string */
92 char string[5];
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 */
105
106#endif /* _IPXE_LKRN_H */
unsigned int uint32_t
Definition stdint.h:12
unsigned long physaddr_t
Definition stdint.h:20
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
Dummy architecture-specific Linux kernel image invocation.
uint32_t type
Operating system type.
Definition ena.h:1
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
struct lkrn_context __attribute__
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
void lkrn_jump(physaddr_t entry, physaddr_t fdt)
Jump to kernel entry point.
A device tree.
Definition fdt.h:89
Kernel image context.
Definition lkrn.h:44
size_t filesz
File size.
Definition lkrn.h:48
size_t offset
Load offset.
Definition lkrn.h:46
physaddr_t fdt
Device tree.
Definition lkrn.h:59
physaddr_t ram
Start of RAM.
Definition lkrn.h:53
physaddr_t entry
Entry point.
Definition lkrn.h:55
size_t memsz
Memory size.
Definition lkrn.h:50
physaddr_t initrd
Initial ramdisk (if any)
Definition lkrn.h:57
Kernel image header.
Definition lkrn.h:16
uint32_t magic
Magic.
Definition lkrn.h:28
uint8_t reserved_b[4]
Reserved.
Definition lkrn.h:30
uint8_t reserved_a[24]
Reserved.
Definition lkrn.h:26
uint64_t text_offset
Image load offset.
Definition lkrn.h:20
uint64_t flags
Flags.
Definition lkrn.h:24
uint32_t code[2]
Executable code.
Definition lkrn.h:18
uint64_t image_size
Image size.
Definition lkrn.h:22
Compressed kernel image context.
Definition lkrn.h:82
uint32_t raw
Raw type.
Definition lkrn.h:90
size_t len
Length of compressed data.
Definition lkrn.h:86
size_t offset
Offset to compressed data.
Definition lkrn.h:84
Compressed kernel image header.
Definition lkrn.h:63
uint8_t reserved_b[8]
Reserved.
Definition lkrn.h:73
uint32_t len
Length of payload.
Definition lkrn.h:71
uint32_t offset
Offset to payload.
Definition lkrn.h:69
uint8_t reserved_a[4]
Reserved.
Definition lkrn.h:65
uint32_t type
Compression type.
Definition lkrn.h:75
uint32_t magic
Magic.
Definition lkrn.h:67