Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs/zh_CN:add riscv boot-image-header.rst translation

This patch translates Documentation/riscv/boot-image-header.rst intoChinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Reviewed-by: Alex Shi <alex.shi@linux.alibaba.com>
Link: https://lore.kernel.org/r/20210228191054.6048-2-siyanteng@loongson.cn
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Yanteng Si and committed by
Jonathan Corbet
d619afd3 8bd490e4

+67
+67
Documentation/translations/zh_CN/riscv/boot-image-header.rst
··· 1 + .. include:: ../disclaimer-zh_CN.rst 2 + 3 + :Original: :doc:`../../../riscv/boot-image-header` 4 + :Translator: Yanteng Si <siyanteng@loongson.cn> 5 + 6 + .. _cn_boot-image-header.rst: 7 + 8 + 9 + ========================== 10 + RISC-V Linux启动镜像文件头 11 + ========================== 12 + 13 + :Author: Atish Patra <atish.patra@wdc.com> 14 + :Date: 20 May 2019 15 + 16 + 此文档仅描述RISC-V Linux 启动文件头的详情。 17 + 18 + TODO: 19 + 写一个完整的启动指南。 20 + 21 + 在解压后的Linux内核镜像中存在以下64字节的文件头:: 22 + 23 + u32 code0; /* Executable code */ 24 + u32 code1; /* Executable code */ 25 + u64 text_offset; /* Image load offset, little endian */ 26 + u64 image_size; /* Effective Image size, little endian */ 27 + u64 flags; /* kernel flags, little endian */ 28 + u32 version; /* Version of this header */ 29 + u32 res1 = 0; /* Reserved */ 30 + u64 res2 = 0; /* Reserved */ 31 + u64 magic = 0x5643534952; /* Magic number, little endian, "RISCV" */ 32 + u32 magic2 = 0x05435352; /* Magic number 2, little endian, "RSC\x05" */ 33 + u32 res3; /* Reserved for PE COFF offset */ 34 + 35 + 这种头格式与PE/COFF文件头兼容,并在很大程度上受到ARM64文件头的启发。因此,ARM64 36 + 和RISC-V文件头可以在未来合并为一个共同的头。 37 + 38 + 注意 39 + ==== 40 + 41 + - 将来也可以复用这个文件头,用来对RISC-V的EFI桩提供支持。为了使内核镜像如同一个 42 + EFI应用程序一样加载,EFI规范中规定在内核镜像的开始需要PE/COFF镜像文件头。为了 43 + 支持EFI桩,应该用“MZ”魔术字符替换掉code0,并且res3(偏移量未0x3c)应指向PE/COFF 44 + 文件头的其余部分. 45 + 46 + - 表示文件头版本号的Drop-bit位域 47 + 48 + ========== ========== 49 + Bits 0:15 次要 版本 50 + Bits 16:31 主要 版本 51 + ========== ========== 52 + 53 + 这保持了新旧版本之间的兼容性。 54 + 当前版本被定义为0.2。 55 + 56 + - 从版本0.2开始,结构体成员“magic”就已经被弃用,在之后的版本中,可能会移除掉它。 57 + 最初,该成员应该与ARM64头的“magic”成员匹配,但遗憾的是并没有。 58 + “magic2”成员代替“magic”成员与ARM64头相匹配。 59 + 60 + - 在当前的文件头,标志位域只剩下了一个位。 61 + 62 + ===== ============================== 63 + Bit 0 内核字节序。1 if BE, 0 if LE. 64 + ===== ============================== 65 + 66 + - 对于引导加载程序加载内核映像来说,image_size成员对引导加载程序而言是必须的,否 67 + 则将引导失败。