Skip to contentSkip to conversation

docs/LoongArch: Add English and Chinese versions of booting

PATCH Applied Yanteng Si 2 participants 4 messages Dec 6, 2022 – Dec 8, 2022

Subsystems (3)
lore
Share & tools
lore

Yanteng Si

author
#0 lore raw

v5 cover docs/LoongArch: Add English and Chinese versions of booting

v5:
* Add LINUX_PE_MAGIC.
* Modify some words under Xuerui's advice.

v4:
LoongArch supports ACPI and FDT, so let's add the description of fdt.

v3:
* Add a description about boot parameters (a0=efi_boot a1=cmdline a2=systemtable), and then rename the file to booting.rst.
* remove some blank line.

v2:
* Fix magic start address.
* res14 -> res4.

v1:
* Add boot image header.
* Translate boot-image-header into Chinese.

Yanteng Si (2):
docs/LoongArch: Add booting
docs/zh_CN: Add booting Chinese translation

 Documentation/loongarch/booting.rst           | 43 +++++++++++++++++
 Documentation/loongarch/index.rst             |  1 +
 .../translations/zh_CN/loongarch/booting.rst  | 48 +++++++++++++++++++
 .../translations/zh_CN/loongarch/index.rst    |  1 +
 4 files changed, 93 insertions(+)
 create mode 100644 Documentation/loongarch/booting.rst
 create mode 100644 Documentation/translations/zh_CN/loongarch/booting.rst
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH v5 1/2 docs/LoongArch: Add booting

Describes the meaning and value of the image header field.

---
 Documentation/loongarch/booting.rst | 43 +++++++++++++++++++++++++++++
 Documentation/loongarch/index.rst   |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 Documentation/loongarch/booting.rst
Documentation/loongarch/booting.rst new file +43 -0
new file mode 100644
index 000000000000..d893f495ca58
@@ -0,0 +1,43 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=======================
+Booting Linux/LoongArch
+=======================
+
+:Author: Yanteng Si <[email protected]>
+:Date:   18 Nov 2022
+
+Bootloader passing parameters to the kernel
+============================================
+
+LoongArch supports ACPI and FDT. The information that needs to be
+passed to the kernel includes the memmap, the initrd, the command
+line, optionally the FDT, and so on.
+The kernel is passed the following arguments on `kernel_entry` :
+
+      - a0 = efi_boot: `efi_boot` is a flag indicating whether
+        this boot environment isfully UEFI-compliant.
+
+      - a1 = cmdline: `cmdline` is a pointer to the kernel command line.
+
+      - a2 = systemtable: `systemtable` points to the EFI system table.
+        All pointers involved at this stage are in
+        physical addresses.
+
+Header of Linux/LoongArch kernel images
+=======================================
+
+Linux/LoongArch kernel images are EFI images. Being PE files, they have
+a 64-byte header structured like::
+
+	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	0			        /* 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 */
+
Documentation/loongarch/index.rst +1 -0
index aaba648db907..df0174d6d227 100644
@@ -10,6 +10,7 @@ LoongArch Architecture
 
    introduction
    irq-chip-model
+   booting
 
    features
 
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH v5 2/2 docs/zh_CN: Add booting Chinese translation

In reply to Yanteng Si

Translate ../loongarch/booting.rst into Chinese.

---
 .../translations/zh_CN/loongarch/booting.rst  | 48 +++++++++++++++++++
 .../translations/zh_CN/loongarch/index.rst    |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/loongarch/booting.rst
Documentation/translations/zh_CN/loongarch/booting.rst new file +48 -0
new file mode 100644
index 000000000000..71c71c5f1b4d
@@ -0,0 +1,48 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: Documentation/loongarch/booting.rst
+
+:翻译:
+
+ 司延腾 Yanteng Si <[email protected]>
+
+====================
+启动 Linux/LoongArch
+====================
+
+:作者: 司延腾 <[email protected]>
+:日期: 2022年11月18日
+
+BootLoader传递给内核的信息
+==========================
+
+LoongArch支持ACPI和FDT,需要传递给内核的信息包括memmap、initrd、cmdline、可选
+的fdt等。
+内核在 `kernel_entry` 被传递给以下参数:
+
+      - a0 = efi_boot: `efi_boot` 是一个标志,表示这个启动环境是否完全符合UEFI
+        的要求。
+
+      - a1 = cmdline: `cmdline` 是一个指向内核命令行的指针。
+
+      - a2 = systemtable: `systemtable` 指向EFI的系统表,在这个阶段涉及的所有
+        指针都是物理地址。
+
+Linux/LoongArch启动镜像文件头
+=============================
+
+内核镜像是EFI镜像。作为PE文件,它们有一个64字节的头结构体,如下所示::
+
+	u32	MZ_MAGIC		    /* "MZ", MS-DOS 头 */
+	u32	res0 = 0		    /* 保留 */
+	u64	kernel_entry		/* 内核入口点 */
+	u64	_end - _text		/* 内核镜像有效大小 */
+	u64	0			        /* 从RAM开始的加载内核镜像的偏移量 */
+	u64	res1 = 0		    /* 保留 */
+	u64	res2 = 0		    /* 保留 */
+	u64	res3 = 0		    /* 保留 */
+	u32	LINUX_PE_MAGIC		/* 魔术数 */
+	u32	pe_header - _head	/* 到PE头的偏移量 */
+
Documentation/translations/zh_CN/loongarch/index.rst +1 -0
index 7d23eb78379d..8609ade41981 100644
@@ -15,6 +15,7 @@ LoongArch体系结构
 
    introduction
    irq-chip-model
+   booting
 
    features
 
Signature · 1 line
2.31.1
maintainer Applied
#3 lore raw
In reply to Yanteng Si

Applied, thanks.

Huacai

Quoted 37 lines · Yanteng Si

v5:
* Add LINUX_PE_MAGIC.
* Modify some words under Xuerui's advice.

v4:
LoongArch supports ACPI and FDT, so let's add the description of fdt.

v3:
* Add a description about boot parameters (a0=efi_boot a1=cmdline a2=systemtable), and then rename the file to booting.rst.
* remove some blank line.

v2:
* Fix magic start address.
* res14 -> res4.

v1:
* Add boot image header.
* Translate boot-image-header into Chinese.

Yanteng Si (2):
docs/LoongArch: Add booting
docs/zh_CN: Add booting Chinese translation

 Documentation/loongarch/booting.rst           | 43 +++++++++++++++++
 Documentation/loongarch/index.rst             |  1 +
 .../translations/zh_CN/loongarch/booting.rst  | 48 +++++++++++++++++++
 .../translations/zh_CN/loongarch/index.rst    |  1 +
 4 files changed, 93 insertions(+)
 create mode 100644 Documentation/loongarch/booting.rst
 create mode 100644 Documentation/translations/zh_CN/loongarch/booting.rst

--
2.31.1