SBC-sig/documents/rockchip/顺序构建.md

144 lines
5.6 KiB
Markdown
Raw Permalink Normal View History

# 顺序单独构建
- [顺序单独构建](#顺序单独构建)
- [准备环境](#准备环境)
- [编译 u-boot](#编译-u-boot)
- [构建 boot 镜像](#构建-boot-镜像)
- [构建 rootfs 镜像](#构建-rootfs-镜像)
- [可启动镜像构建](#可启动镜像构建)
## 准备环境
- 操作系统openEuler、 CentOS 8
- 架构AArch64 ,如树莓派、 RK3399
## 编译 u-boot
编译 u-boot 需执行命令:
`sudo bash build_u-boot.sh -c BOARD_CONFIG`
**说明: 基于 build_u-boot.sh 提供的默认参数,执行 sudo ./build_u-boot.sh 编译 u-boot。**
各个参数意义:
2025-02-28 16:37:08 +08:00
1. --board BOARD_CONFIG
适用的开发板的版型配置文件在 [boards](../scripts/boards) 文件夹中,示例文件 [sample.conf](../scripts/boards/sample.conf),默认为 `firefly-rk3399`。其包括的配置参数意义见[版型文件](./openEuler适配指南.md#编写版型文件)。
2. -h, --help
显示帮助信息。
## 构建 boot 镜像
构建 boot 镜像需执行命令:
2025-02-28 16:37:08 +08:00
`sudo bash build_boot.sh --board BOARD_CONFIG -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG`
**说明: 基于 build_boot.sh 提供的默认参数,执行 sudo ./build_boot.sh 可生成 Firefly-RK3399 的 boot 分区镜像 boot.img。**
各个参数意义:
2025-02-28 16:37:08 +08:00
1. --board BOARD_CONFIG
适用的开发板的版型配置文件在 [boards](../scripts/boards) 文件夹中,示例文件 [sample.conf](../scripts/boards/sample.conf),默认为 `firefly-rk3399`。其包括的配置参数意义见[版型文件](./openEuler适配指南.md#编写版型文件)。
2025-02-28 16:37:08 +08:00
2. -k, --kernel KERNEL_URL
2025-12-26 13:02:58 +00:00
内核源码仓库的项目地址,默认为 `https://atomgit.com/openeuler/raspberrypi-kernel.git`。可根据需要设置为 `git@atomgit.com:openeuler/raspberrypi-kernel.git``git@atomgit.com:openeuler/kernel.git`
2025-02-28 16:37:08 +08:00
3. -b, --branch KERNEL_BRANCH
内核源码的对应分支,默认为 openEuler-20.03-LTS。根据 -k 参数有以下选择:
2025-12-26 13:02:58 +00:00
- -k https://atomgit.com/openeuler/rockchip-kernel.git
- openEuler-20.03-LTS
2025-12-26 13:02:58 +00:00
- -k https://atomgit.com/openeuler/kernel.git
- openEuler-21.03
- openEuler-21.09
2025-02-28 16:37:08 +08:00
4. -c, --config KERNEL_DEFCONFIG
2025-02-28 16:37:08 +08:00
内核编译使用的配置文件名称或路径,默认为 `openeuler_rockchip_defconfig`。如果该参数为配置文件名称,请确保该文件在内核源码的目录 arch/arm64/configs 下。
2025-02-28 16:37:08 +08:00
5. -h, --help
显示帮助信息。
## 构建 rootfs 镜像
运行 rootfs 构建脚本需执行命令:
2025-02-28 16:37:08 +08:00
`sudo bash build_rootfs.sh --board BOARD_CONFIG -r REPO_INFO -b KERNEL_BRANCH -s SPEC`
**说明: 基于 build_rootfs.sh 提供的默认参数,执行 sudo ./build_rootfs.sh 可生成 Firefly-RK3399 的 rootfs 分区镜像 rootfs.img。**
各个参数意义:
2025-02-28 16:37:08 +08:00
1. --board BOARD_CONFIG
适用的开发板的版型配置文件在 [boards](../scripts/boards) 文件夹中,示例文件 [sample.conf](../scripts/boards/sample.conf),默认为 `firefly-rk3399`。其包括的配置参数意义见[版型文件](./openEuler适配指南.md#编写版型文件)。
2. -r, --repo REPO_INFO
软件源 repo 文件的 URL 或者路径,也可以是软件源中资源库的 baseurl 列表。注意,如果该参数为资源库的 baseurl 列表,该参数需要使用双引号,各个 baseurl 之间以空格隔开。
下面分别举例:
2026-01-04 11:41:06 +00:00
- 软件源 repo 文件的 URL`https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-20.03-LTS-SP2/generic.repo`
- 软件源的 repo 文件路径:
2025-12-26 13:02:58 +00:00
`./openEuler-20.03-LTS.repo`:生成 openEuler 20.03 LTS 版本的镜像,该文件内容参考 <https://atomgit.com/src-openeuler/openEuler-repos/blob/openEuler-20.03-LTS/generic.repo>
- 资源库的 baseurl 列表,如 `http://repo.openeuler.org/openEuler-20.03-LTS-SP2/OS/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS-SP2/EPOL/aarch64/`
3. -b, --branch KERNEL_BRANCH
内核源码的对应分支,默认为 openEuler-20.03-LTS。根据 -k 参数有以下选择:
2025-12-26 13:02:58 +00:00
- -k https://atomgit.com/openeuler/rockchip-kernel.git
- openEuler-20.03-LTS
2025-12-26 13:02:58 +00:00
- -k https://atomgit.com/openeuler/kernel.git
- openEuler-21.03
- openEuler-21.09
4. -s, --spec SPEC
构建的镜像版本:
- `headless`,无图形界面版的镜像。
- `xfce`,带 Xfce 桌面以及中文字体、输入法等全部配套软件。
- `ukui`,带 UKUI 桌面及必要的配套软件(不包括中文字体以及输入法)。
- `dde`,带 DDE 桌面及必要的配套软件(不包括中文字体以及输入法)。
- rpmlist 文件路径,其中包含镜像中要安装的软件列表,内容参考 [rpmlist](../../scripts/configs/rockchip/rpmlist)。
默认使用 `headless` 选项。
5. -h, --help
显示帮助信息。
## 可启动镜像构建
运行可启动镜像构建脚本需执行命令:
2025-02-28 16:37:08 +08:00
`sudo bash gen_image.sh --board BOARD_CONFIG -n NAME`
**说明: 在确保顺序执行以上脚本并生成对应的文件及文件夹后再执行此脚本**
脚本运行结束后,在 scripts/build/YYYY-MM-DD 所在目录生成 openEuler-VERSION-BOARD.img.xz 即为压缩后的 RK3399 SD卡启动镜像openEuler-VERSION-BOARD.tar.gz 即为打包后的 EMMC 刷写镜像。
各个参数意义:
2025-02-28 16:37:08 +08:00
1. --board BOARD_CONFIG
适用的开发板的版型配置文件在 [boards](../scripts/boards) 文件夹中,示例文件 [sample.conf](../scripts/boards/sample.conf),默认为 `firefly-rk3399`。其包括的配置参数意义见[版型文件](./openEuler适配指南.md#编写版型文件)。
2025-02-28 16:37:08 +08:00
2. -n, --name IMAGE_NAME
构建的镜像名称。
2025-02-28 16:37:08 +08:00
3. -h, --help
显示帮助信息。