Skip to content

Commit aff9eef

Browse files
committed
docs: build: update build kernel
Signed-off-by: Han Gao <rabenda.cn@gmail.com>
1 parent 5417a08 commit aff9eef

4 files changed

Lines changed: 74 additions & 164 deletions

File tree

docs/build/other/build_kernel.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# 编译内核
2+
3+
支持架构:`x86_64` `riscv64`
4+
5+
`x86_64` 支持工具链:
6+
* `3.2.0` Xuantie-900 Linux 6.6.0 版本v3.2.0
7+
* `14` 主线 RISC-V GCC 14交叉编译器(默认)
8+
9+
`riscv64` 支持工具链:
10+
* `rv` 主线 GCC 编译器
11+
12+
通过`TOOLCHAIN_VERSION`变量选择要使用的编译器
13+
14+
## 使用方法
15+
16+
```bash
17+
git clone https://github.com/revyos/xuantie-kernel-docker
18+
cd xuantie-kernel-docker
19+
docker build --build-arg TOOLCHAIN_VERSION=14 -t xuantie900:linux14 . # 根据支持架构确定 TOOLCHAIN_VERSION 参数
20+
docker run -it --rm -v LOCAL_PATH:/output xuantie900:linux14 bash # LOCAL_PATH 为编译好的内核存放目录
21+
./mkkernel_x64.sh # 根据 TOOLCHAIN_VERSION 配置选择 mkkernel_xuantie.sh 或 mkkernel_riscv64.sh
22+
```
23+
24+
整个过程执行完成后,构建好的内核deb包将会被拷贝到`LOCAL_PATH`指定的目录中,然后使用`dpkg`安装即可。
25+
26+
```bash
27+
sudo dpkg -i [PACKAGE]
28+
```
29+
30+
编译过程会产生多个结果:
31+
* linux-headers.deb(需要编译内核模块或内核开发时安装)
32+
* linux-image-dbg.deb(调试符号,需要调试内核时安装)
33+
* linux-image.deb(内核,必装)
34+
* linux-libc-dev.deb(libc接口,一般不安装,使用通用版即可)
35+
36+
## 注意事项
37+
38+
1. 如需更改编译的版本,可在进入docker环境(输入`bash`)后自由修改
39+
2. `x86_64`环境下交叉编译出的`linux-header`包可能包含`x86_64`的头文件。如需进行内核开发或使用如`zfs`之类的DKMS模块,请在RISC-V环境下使用`TOOLCHAIN_VERSION=rv`编译。

docs/build/other/manuel_build_kernel.md

Lines changed: 0 additions & 103 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Build Kernel
2+
3+
Supported Architectures: `x86_64` `riscv64`
4+
5+
`x86_64` Supported Toolchains:
6+
* `3.2.0` Xuantie-900 Linux 6.6.0 v3.2.0
7+
* `14` Mainline RISC-V GCC 14 Cross Compiler (default)
8+
9+
`riscv64` Supported Toolchains:
10+
* `rv` Mainline GCC Compiler
11+
12+
Select the compiler to use via the `TOOLCHAIN_VERSION` variable
13+
14+
## Usage
15+
16+
```bash
17+
git clone https://github.com/revyos/xuantie-kernel-docker
18+
cd xuantie-kernel-docker
19+
docker build --build-arg TOOLCHAIN_VERSION=14 -t xuantie900:linux14 .
20+
docker run -it --rm -v LOCAL_PATH:/output xuantie900:linux14 bash
21+
./mkkernel_x64.sh # use mkkernel_xuantie.sh or mkkernel_riscv64.sh depend on your TOOLCHAIN_VERSION
22+
```
23+
24+
The built kernel deb packages will be copied to the directory specified by `LOCAL_PATH`, and then you can install them using `dpkg`.
25+
26+
The compilation process will produce several results:
27+
* linux-headers.deb (Install when compiling kernel modules or for kernel development)
28+
* linux-image-dbg.deb (Debug symbols, install when debugging the kernel)
29+
* linux-image.deb (Kernel, must install)
30+
* linux-libc-dev.deb (libc interface, generally not installed, use the generic version)
31+
32+
## Notes
33+
34+
1. To change the version to be compiled, you can freely modify it after entering the docker environment (input `bash`)
35+
2. The `linux-header` package cross-compiled in the `x86_64` environment may contain `x86_64` header files. If you need to develop the kernel or use DKMS modules such as `zfs`, please compile with `TOOLCHAIN_VERSION=rv` in the RISC-V environment.

i18n/en/docusaurus-plugin-content-docs/current/build/other/manuel_build_kernel.md

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)