← Documents Documentation/arch/loongarch/booting.rst GitHub 원문 ↗

Linux 6.18.37 · Architecture

Booting Linux/LoongArch

LoongArch kernel entry register와 PE/EFI image의 64-byte header layout을 설명합니다.

Source pathDocumentation/arch/loongarch/booting.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

booting.rst:1-42

BootLoader는 UEFI 상태, command line, EFI system table을 `a0..a2`로 전달하고 kernel image는 고정 64-byte PE header로 entry, size, load offset을 공개합니다.

LoongArch boot handoff
ACPI/FDT + memmap/initrdUEFI BootLoader`a0` efi_boot`a1` cmdline`a2` systemtable`kernel_entry`

Firmware 정보가 kernel entry와 image header를 통해 전달됩니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =======================
4 Booting Linux/LoongArch
5 =======================
6
7 :Author: Yanteng Si <[email protected]>
8 :Date: 18 Nov 2022
9
10 Information passed from BootLoader to kernel
11 ============================================
12
13 LoongArch supports ACPI and FDT. The information that needs to be passed
14 to the kernel includes the memmap, the initrd, the command line, optionally
15 the ACPI/FDT tables, and so on.
16
17 The 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
27 Header of Linux/LoongArch kernel images
28 =======================================
29
30 Linux/LoongArch kernel images are EFI images. Being PE files, they have
31 a 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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

BootLoader에서 kernel로 전달하는 정보

1-26

저자: Yanteng Si, 2022-11-18. LoongArch는 ACPI와 FDT를 지원하며 BootLoader는 memmap, initrd, command line, 선택적 ACPI/FDT table 등을 kernel에 전달합니다.

`kernel_entry` register의미
`a0``efi_boot`Boot environment가 완전한 UEFI 규격인지 나타내는 flag
`a1``cmdline`Kernel command-line pointer
`a2``systemtable`EFI system-table pointer; 이 단계의 모든 pointer는 physical address

Linux/LoongArch image header

27-42

Linux/LoongArch kernel image는 PE 형식의 EFI image이며 64-byte header는 다음 구조입니다.

u32        MZ_MAGIC                /* "MZ", MS-DOS header */
u32        res0 = 0                /* Reserved */
u64        kernel_entry            /* Kernel entry point */
u64        _end - _text            /* Kernel image effective size */
u64        load_offset             /* Kernel image load offset from start of RAM */
u64        res1 = 0                /* Reserved */
u64        res2 = 0                /* Reserved */
u64        res3 = 0                /* Reserved */
u32        LINUX_PE_MAGIC          /* Magic number */
u32        pe_header - _head       /* Offset to the PE header */