docs: zh_CN: howto.rst: fix a broken reference
[linux-2.6-block.git] / Documentation / riscv / boot-image-header.txt
CommitLineData
0f327f2a
AP
1 Boot image header in RISC-V Linux
2 =============================================
3
4Author: Atish Patra <atish.patra@wdc.com>
5Date : 20 May 2019
6
7This document only describes the boot image header details for RISC-V Linux.
8The complete booting guide will be available at Documentation/riscv/booting.txt.
9
10The following 64-byte header is present in decompressed Linux kernel image.
11
12 u32 code0; /* Executable code */
13 u32 code1; /* Executable code */
14 u64 text_offset; /* Image load offset, little endian */
15 u64 image_size; /* Effective Image size, little endian */
16 u64 flags; /* kernel flags, little endian */
17 u32 version; /* Version of this header */
18 u32 res1 = 0; /* Reserved */
19 u64 res2 = 0; /* Reserved */
20 u64 magic = 0x5643534952; /* Magic number, little endian, "RISCV" */
21 u32 res3; /* Reserved for additional RISC-V specific header */
22 u32 res4; /* Reserved for PE COFF offset */
23
24This header format is compliant with PE/COFF header and largely inspired from
25ARM64 header. Thus, both ARM64 & RISC-V header can be combined into one common
26header in future.
27
28Notes:
29- This header can also be reused to support EFI stub for RISC-V in future. EFI
30 specification needs PE/COFF image header in the beginning of the kernel image
31 in order to load it as an EFI application. In order to support EFI stub,
32 code0 should be replaced with "MZ" magic string and res5(at offset 0x3c) should
33 point to the rest of the PE/COFF header.
34
35- version field indicate header version number.
36 Bits 0:15 - Minor version
37 Bits 16:31 - Major version
38
39 This preserves compatibility across newer and older version of the header.
40 The current version is defined as 0.1.
41
42- res3 is reserved for offset to any other additional fields. This makes the
43 header extendible in future. One example would be to accommodate ISA
44 extension for RISC-V in future. For current version, it is set to be zero.
45
46- In current header, the flag field has only one field.
47 Bit 0: Kernel endianness. 1 if BE, 0 if LE.
48
49- Image size is mandatory for boot loader to load kernel image. Booting will
50 fail otherwise.