rockchip:统一子脚本传入参数

This commit is contained in:
chainsx 2025-02-28 16:37:08 +08:00
parent 5024ef5ca2
commit a63d6d746a
18 changed files with 69 additions and 70 deletions

View File

@ -87,8 +87,16 @@ POST_BOARD_OVERLAY() {
开发板所使用的平台目前支持的平台有rockchip、phytium。
4. soc_name=SOC_NAME
开发板所使用的具体芯片型号,目前支持的芯片型号有:
- rockchip: rk3399, rk3566, rk3568, rk3588
- phytium: e2000q
4. POST_BOARD_OVERLAY()
5. POST_BOARD_OVERLAY()
`POST_BOARD_OVERLAY()` 是执行复制 firmware 文件到根目录以及对目标开发板根目录执行特定操作的函数,其使用的变量与 [build_rootfs.sh](../../scripts/rockchip/build_rootfs.sh) 相同,通常包含以下两个变量:

View File

@ -21,9 +21,9 @@
各个参数意义:
1. -c, --config BOARD_CONFIG
1. --board BOARD_CONFIG
开发板对应的 defconfig 的文件名称,对应 [u-boot/configs](https://github.com/u-boot/u-boot/tree/master/configs) 下 `BOARD_CONFIG` 文件,默认为 `firefly-rk3399_defconfig`;如需在 RK3588 开发板上使用预编译的 u-boot可以将此项设置为 `none`
适用的开发板的版型配置文件在 [boards](../scripts/rockchip/boards) 文件夹中,示例文件 [sample.conf](../scripts/rockchip/boards/sample.conf),默认为 `firefly-rk3399`。其包括的配置参数意义见[版型文件](./openEuler适配指南.md#编写版型文件)
2. -h, --help
@ -34,17 +34,21 @@
构建 boot 镜像需执行命令:
`sudo bash build_boot.sh -k KERNEL_URL -b KERNEL_BRANCH -d DTB_NAME`
`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。**
各个参数意义:
1. -k, --kernel KERNEL_URL
1. --board BOARD_CONFIG
适用的开发板的版型配置文件在 [boards](../scripts/rockchip/boards) 文件夹中,示例文件 [sample.conf](../scripts/rockchip/boards/sample.conf),默认为 `firefly-rk3399`。其包括的配置参数意义见[版型文件](./openEuler适配指南.md#编写版型文件)。
2. -k, --kernel KERNEL_URL
内核源码仓库的项目地址,默认为 `https://gitee.com/openeuler/raspberrypi-kernel.git`。可根据需要设置为 `git@gitee.com:openeuler/raspberrypi-kernel.git``git@gitee.com:openeuler/kernel.git`
2. -b, --branch KERNEL_BRANCH
3. -b, --branch KERNEL_BRANCH
内核源码的对应分支,默认为 openEuler-20.03-LTS。根据 -k 参数有以下选择:
@ -54,11 +58,11 @@
- openEuler-21.03
- openEuler-21.09
3. -d, --device-tree DTB_NAME
4. -c, --config KERNEL_DEFCONFIG
内核设备树名称,和开发板名称有一点区别,对应 [kernel/arch/arm64/boot/dts/rockchip](https://gitee.com/openeuler/kernel/tree/master/arch/arm64/boot/dts/rockchip) 下的 `DTB_NAME.dts` 文件,默认为 `rk3399_firefly`
内核编译使用的配置文件名称或路径,默认为 `openeuler_rockchip_defconfig`。如果该参数为配置文件名称,请确保该文件在内核源码的目录 arch/arm64/configs 下。
4. -h, --help
5. -h, --help
显示帮助信息。
@ -66,29 +70,15 @@
运行 rootfs 构建脚本需执行命令:
`sudo bash build_rootfs.sh --board BOARD -r REPO_INFO -b KERNEL_BRANCH -s SPEC`
`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。**
各个参数意义:
1. --board BOARD
1. --board BOARD_CONFIG
适用的开发板的版型配置文件在 [boards](../../scripts/rockchip/boards) 文件夹中,示例文件 [sample.conf](../../scripts/rockchip/boards/sample.conf),默认为 `firefly-rk3399`
其包括的配置参数意义如下:
- platform=PLATFORM
开发板所使用的平台目前支持的平台有rockchip、phytium默认为 `rockchip`
- device-tree=DTB_NAME
内核设备树中的设备名称,和开发板名称有一点区别,对应 [kernel/arch/arm64/boot/dts/rockchip](https://gitee.com/openeuler/kernel/tree/master/arch/arm64/boot/dts/rockchip) 下的 `DTB_NAME.dts` 文件,默认为 `rk3399-firefly`
- ubootconfig=UBOOT_DEFCONFIG
开发板对应的 defconfig 的文件名称,对应 [u-boot/configs](https://github.com/u-boot/u-boot/tree/master/configs) 下 `UBOOT_DEFCONFIG` 文件,默认为 `firefly-rk3399_defconfig`;如需在 RK3588 开发板上使用预编译的 u-boot可以将此项设置为 `none`
适用的开发板的版型配置文件在 [boards](../scripts/rockchip/boards) 文件夹中,示例文件 [sample.conf](../scripts/rockchip/boards/sample.conf),默认为 `firefly-rk3399`。其包括的配置参数意义见[版型文件](./openEuler适配指南.md#编写版型文件)。
2. -r, --repo REPO_INFO
@ -132,7 +122,7 @@
运行可启动镜像构建脚本需执行命令:
`sudo bash gen_image.sh -n NAME`
`sudo bash gen_image.sh --board BOARD_CONFIG -n NAME`
**说明: 在确保顺序执行以上脚本并生成对应的文件及文件夹后再执行此脚本**
@ -140,10 +130,14 @@
各个参数意义:
1. -n, --name IMAGE_NAME
1. --board BOARD_CONFIG
适用的开发板的版型配置文件在 [boards](../scripts/rockchip/boards) 文件夹中,示例文件 [sample.conf](../scripts/rockchip/boards/sample.conf),默认为 `firefly-rk3399`。其包括的配置参数意义见[版型文件](./openEuler适配指南.md#编写版型文件)。
2. -n, --name IMAGE_NAME
构建的镜像名称。
2. -h, --help
3. -h, --help
显示帮助信息。

View File

@ -64,7 +64,7 @@
构建镜像需执行命令:
`sudo bash build.sh --board BOARD -n NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO_INFO -s SPEC --cores N`
`sudo bash build.sh --board BOARD_CONFIG -n NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO_INFO -s SPEC --cores N`
**说明: 基于 build.sh 提供的默认参数,执行 sudo bash build.sh 可构建 Firefly-RK3399 的 openEuler-20.03-LTS 镜像。**
@ -82,7 +82,7 @@
各个参数意义:
1. --board BOARD
1. --board BOARD_CONFIG
适用的开发板的版型配置文件在 [boards](../scripts/rockchip/boards) 文件夹中,示例文件 [sample.conf](../scripts/rockchip/boards/sample.conf),默认为 `firefly-rk3399`
@ -119,7 +119,7 @@
5. -c, --config KERNEL_DEFCONFIG
内核编译使用的配置文件名称或路径,默认为 `openeuler-raspi_defconfig`。如果该参数为配置文件名称,请确保该文件在内核源码的目录 arch/arm64/configs 下。
内核编译使用的配置文件名称或路径,默认为 `openeuler_rockchip_defconfig`。如果该参数为配置文件名称,请确保该文件在内核源码的目录 arch/arm64/configs 下。
6. -r, --repo REPO_INFO
@ -260,7 +260,7 @@
#### 使用脚本构建镜像需执行命令:
`sudo bash build-image-docker.sh --board BOARD -d DOCKER_FILE -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
`sudo bash build-image-docker.sh --board BOARD_CONFIG -d DOCKER_FILE -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
脚本运行结束后,镜像默认保存在脚本运行所在目录的 `build/YYYY-MM-DD` 下。

View File

@ -2,6 +2,7 @@ ubootconfig=none
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3588
dtb_name=rk3588-firefly-itx-3588j
platform=rockchip
soc_name=rk3588
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -1,6 +1,7 @@
ubootconfig=firefly-rk3399_defconfig
dtb_name=rk3399-firefly
platform=rockchip
soc_name=rk3399
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -2,6 +2,7 @@ ubootconfig=none
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3566
dtb_name=rk3566-roc-pc
platform=rockchip
soc_name=rk3566
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -2,6 +2,7 @@ ubootconfig=none
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3568
dtb_name=rk3568-roc-pc-se
platform=rockchip
soc_name=rk3568
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -2,6 +2,7 @@ ubootconfig=none
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3588
dtb_name=rk3588s-roc-pc
platform=rockchip
soc_name=rk3588
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -2,6 +2,7 @@ ubootconfig=none
local_uboot_dir=${nonfree_bin_dir}/u-boot/phytiumpi
dtb_name=phytiumpi_firefly
platform=phytium
soc_name=e2000q
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -2,6 +2,7 @@ ubootconfig=none
local_uboot_dir=${nonfree_bin_dir}/u-boot/radxa-rock5b
dtb_name=rk3588-rock-5b
platform=rockchip
soc_name=rk3588
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -1,6 +1,7 @@
ubootconfig=rock-pi-4-rk3399_defconfig
dtb_name=rk3399-rock-pi-4a
platform=rockchip
soc_name=rk3399
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -1,6 +1,7 @@
ubootconfig=firefly-rk3399_defconfig #Required! The name of defconfig file when compiling u-boot, which defaults to firefly-rk3399_defconfig.
dtb_name=rk3399-firefly #Required! The device tree name of target board, which defaults to rk3399-firefly.
platform=rockchip #Required! The platform of target board, which defaults to rockchip.
soc_name=rk3399
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."

View File

@ -7,7 +7,7 @@ Usage: build-image-docker [OPTIONS]
Build board image.
Options:
--board BOARD Required! The config of target board in the boards folder.
--board BOARD_CONFIG Required! The config of target board in the boards folder.
-d, --docker DOCKER_FILE The URL/path of the Docker image, which defaults to https://repo.openeuler.org/openEuler-20.03-LTS-SP1/docker_img/aarch64/openEuler-docker.aarch64.tar.xz
-n, --name IMAGE_NAME The board image name to be built.
-k, --kernel KERNEL_URL The URL of kernel source's repository, which defaults to https://gitee.com/openeuler/rockchip-kernel.git.

View File

@ -6,7 +6,7 @@ Build Rockchip bootable images.
The target bootable compressed images will be generated in the build/YYYY-MM-DD folder of the directory where the build script is located.
Options:
--board BOARD Required! The config of target board in the boards folder, which defaults to rockchip.
--board BOARD_CONFIG Required! The config of target board in the boards folder, which defaults to firefly-rk3399.
-n, --name IMAGE_NAME The Rockchip image name to be built.
-k, --kernel KERNEL_URL The URL of kernel source's repository, which defaults to https://gitee.com/openeuler/rockchip-kernel.git.
-b, --branch KERNEL_BRANCH The branch name of kernel source's repository, which defaults to openEuler-20.03-LTS.
@ -44,7 +44,6 @@ default_param() {
repo_file="https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-20.03-LTS/generic.repo"
kernel_url="https://gitee.com/openeuler/rockchip-kernel.git"
workdir=$(pwd)/build
board_type=rk3399
name=${branch}-${board}-aarch64-alpha1
make_cores=$(nproc)
}
@ -182,9 +181,4 @@ if [[ $(cat $workdir/.done | grep rootfs) != "rootfs" ]];then
bash build_rootfs.sh
fi
if [[ "x$dtb_name" == "xrk3588s-roc-pc" || "x$dtb_name" == "xrk3588-firefly-itx-3588j" || "x$dtb_name" == "xrk3588-rock-5b" ]]; then
board_type=rk3588
else
board_type=rk3399
fi
bash gen_image.sh -n $name -t $board_type -p $platform
bash gen_image.sh --board ${board}

View File

@ -2,15 +2,14 @@
__usage="
Usage: build_boot [OPTIONS]
Build Rockchip boot image.
Build openEuler SBCs boot image.
The target boot.img will be generated in the build folder of the directory where the build_boot.sh script is located.
Options:
--board BOARD_CONFIG Required! The config of target board in the boards folder, which defaults to firefly-rk3399.
-b, --branch KERNEL_BRANCH The branch name of kernel source's repository, which defaults to openEuler-20.03-LTS.
-k, --kernel KERNEL_URL Required! The URL of kernel source's repository.
-c, --config KERNEL_DEFCONFIG The name/path of defconfig file when compiling kernel, which defaults to openeuler_rockchip_defconfig.
-d, --device-tree DTB_NAME Required! The device tree name of target board, which defaults to rk3399-firefly.
-p, --platform PLATFORM Required! The platform of target board, which defaults to rockchip.
--cores N The number of cpu cores to be used during making.
-h, --help Show command help.
"
@ -25,6 +24,7 @@ default_param() {
workdir=$(pwd)/build
branch=openEuler-20.03-LTS
default_defconfig=openeuler_rockchip_defconfig
board=firefly-rk3399
dtb_name=rk3399-firefly
platform=rockchip
kernel_url="https://gitee.com/openeuler/rockchip-kernel.git"
@ -41,11 +41,8 @@ local_param(){
default_defconfig=$(cat $workdir/.param | grep default_defconfig)
default_defconfig=${default_defconfig:18}
dtb_name=$(cat $workdir/.param | grep dtb_name)
dtb_name=${dtb_name:9}
platform=$(cat $workdir/.param | grep platform)
platform=${platform:9}
board=$(cat $workdir/.param | grep board)
board=${board:6}
kernel_url=$(cat $workdir/.param | grep kernel_url)
kernel_url=${kernel_url:11}
@ -64,6 +61,10 @@ parseargs()
return 1
elif [ "x$1" == "x" ]; then
shift
elif [ "x$1" == "x--board" ]; then
board=`echo $2`
shift
shift
elif [ "x$1" == "x-b" -o "x$1" == "x--branch" ]; then
branch=`echo $2`
shift
@ -72,18 +73,10 @@ parseargs()
default_defconfig=`echo $2`
shift
shift
elif [ "x$1" == "x-d" -o "x$1" == "x--device-tree" ]; then
dtb_name=`echo $2`
shift
shift
elif [ "x$1" == "x-k" -o "x$1" == "x--kernel" ]; then
kernel_url=`echo $2`
shift
shift
elif [ "x$1" == "x-p" -o "x$1" == "x--platform" ]; then
platform=`echo $2`
shift
shift
elif [ "x$1" == "x--cores" ]; then
make_cores=`echo $2`
shift
@ -267,6 +260,8 @@ elif [ -f $default_defconfig ]; then
kernel_defconfig=${workdir}/${default_defconfig##*/}
fi
source $workdir/../boards/${board}.conf
if [ ! -d $workdir ]; then
mkdir $workdir
fi

View File

@ -7,7 +7,7 @@ Run in root user.
The target rootfs.img will be generated in the build folder of the directory where the build_rootfs.sh script is located.
Options:
--board, BOARD Required! The config of target board in the boards folder, which defaults to firefly-rk3399.
--board, BOARD_CONFIG Required! The config of target board in the boards folder, which defaults to firefly-rk3399.
-r, --repo REPO_INFO The URL/path of target repo file or list of repo's baseurls which should be a space separated list.
-b, --branch KERNEL_BRANCH The branch name of kernel source's repository, which defaults to openEuler-20.03-LTS.
-s, --spec SPEC The image's specification: headless, xfce, ukui, dde or the file path of rpmlist. The default is headless.

View File

@ -6,7 +6,7 @@ Build openEuler SBCs u-boot image.
The target files idbloader.img and u-boot.itb will be generated in the build/u-boot folder of the directory where the build_u-boot.sh script is located.
Options:
--board, BOARD Required! The config of target board in the boards folder, which defaults to firefly-rk3399.
--board, BOARD_CONFIG Required! The config of target board in the boards folder, which defaults to firefly-rk3399.
--cores N The number of cpu cores to be used during making.
-h, --help Show command help.
"

View File

@ -7,8 +7,7 @@ The target compressed bootable images will be generated in the build/YYYY-MM-DD
Options:
-n, --name IMAGE_NAME The Rockchip image name to be built.
-t, --type BOARD_TYPE Board Soc type.
-p, --platform PLATFORM Required! The platform of target board, which defaults to rockchip.
--board BOARD_CONFIG Required! The config of target board in the boards folder, which defaults to firefly-rk3399.
-h, --help Show command help.
"
@ -22,7 +21,8 @@ default_param() {
workdir=$(pwd)/build
outputdir=${workdir}/$(date +'%Y-%m-%d')
name=openEuler-Firefly-RK3399-aarch64-alpha1
board_type=rk3399
board=firefly-rk3399
soc_name=rk3399
platform=rockchip
rootfs_dir=${workdir}/rootfs
boot_dir=${workdir}/boot
@ -49,12 +49,8 @@ parseargs()
name=`echo $2`
shift
shift
elif [ "x$1" == "x-t" -o "x$1" == "x--type" ]; then
board_type=`echo $2`
shift
shift
elif [ "x$1" == "x-p" -o "x$1" == "x--platform" ]; then
platform=`echo $2`
elif [ "x$1" == "x--board" ]; then
board=`echo $2`
shift
shift
else
@ -256,7 +252,7 @@ outputd(){
LOG "xz openEuler image success."
fi
if [[ "x$board_type" == "xrk3399" && "x$platform" == "xrockchip" ]]; then
if [[ "x$soc_name" == "xrk3399" && "x$platform" == "xrockchip" ]]; then
LOG "tar openEuler image begin..."
cp $workdir/../bin/rk3399_loader.bin $workdir
cp $workdir/../bin/rk3399_parameter.gpt $workdir
@ -293,6 +289,9 @@ outputd(){
set -e
default_param
parseargs "$@" || help $?
source $workdir/../boards/${board}.conf
if [ ! -d ${log_dir} ];then mkdir -p ${log_dir}; fi
if [ ! -f $workdir/.done ];then
touch $workdir/.done