1.. SPDX-License-Identifier: GPL-2.0
2
3=======================
4Booting Linux/LoongArch
5=======================
6
7:Author: Yanteng Si <siyanteng@loongson.cn>
8:Date:   18 Nov 2022
9
10Information passed from BootLoader to kernel
11============================================
12
13LoongArch supports ACPI and FDT. The information that needs to be passed
14to the kernel includes the memmap, the initrd, the command line, optionally
15the ACPI/FDT tables, and so on.
16
17The kernel is passed the following arguments on `kernel_entry` :
18
19      - a0 = efi_boot: `efi_boot` is a flag indicating whether
20        this boot environment is fully UEFI-compliant.
21
22      - a1 = cmdline: `cmdline` is a pointer to the kernel command line.
23
24      - a2 = systemtable: `systemtable` points to the EFI system table.
25        All pointers involved at this stage are in physical addresses.
26
27Header of Linux/LoongArch kernel images
28=======================================
29
30Linux/LoongArch kernel images are EFI images. Being PE files, they have
31a 64-byte header structured like::
32
33	u32	MZ_MAGIC                /* "MZ", MS-DOS header */
34	u32	res0 = 0                /* Reserved */
35	u64	kernel_entry            /* Kernel entry point */
36	u64	_end - _text            /* Kernel image effective size */
37	u64	load_offset             /* Kernel image load offset from start of RAM */
38	u64	res1 = 0                /* Reserved */
39	u64	res2 = 0                /* Reserved */
40	u64	res3 = 0                /* Reserved */
41	u32	LINUX_PE_MAGIC          /* Magic number */
42	u32	pe_header - _head       /* Offset to the PE header */
43