精简传入参数,增加版型配置文件

This commit is contained in:
chainsx 2024-12-16 15:55:46 +08:00
parent 6cfff5e556
commit ee72bf2847
11 changed files with 83 additions and 52 deletions

View File

@ -62,7 +62,7 @@
构建镜像需执行命令:
`sudo bash build.sh -n NAME -k KERNEL_URL -b KERNEL_BRANCH -u UBOOT_DEFCONFIG -c KERNEL_DEFCONFIG -r REPO_INFO -d DTB_NAME -p PLATFORM -s SPEC --cores N`
`sudo bash build.sh --board BOARD -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 镜像。**
@ -80,15 +80,33 @@
各个参数意义:
1. -n, --name IMAGE_NAME
1. --board BOARD
适用的开发板的版型配置文件在 [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`
2. -n, --name IMAGE_NAME
构建的镜像名称,例如:`openEuler-20.03-LTS-Firefly-RK3399-aarch64-alpha1``openEuler-21.09-Firefly-RK3399-aarch64-alpha1`
2. -k, --kernel KERNEL_URL
3. -k, --kernel KERNEL_URL
内核源码仓库的项目地址,默认为 `https://gitee.com/openeuler/rockchip-kernel.git`。可根据需要设置为 `git@gitee.com:openeuler/rockchip-kernel.git``git@gitee.com:openeuler/kernel.git`
3. -b, --branch KERNEL_BRANCH
4. -b, --branch KERNEL_BRANCH
内核源码的对应分支,默认为 openEuler-20.03-LTS。根据 -k 参数有以下选择:
@ -97,10 +115,6 @@
- -k https://gitee.com/openeuler/kernel.git
- openEuler-21.09
4. -u, --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`
5. -c, --config KERNEL_DEFCONFIG
内核编译使用的配置文件名称或路径,默认为 `openeuler-raspi_defconfig`。如果该参数为配置文件名称,请确保该文件在内核源码的目录 arch/arm64/configs 下。
@ -117,15 +131,7 @@
- 资源库的 baseurl 列表,如 `http://repo.openeuler.org/openEuler-20.03-LTS/OS/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/aarch64/`
7. -d, --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`
8. -p, --platform PLATFORM
开发板所使用的平台目前支持的平台有rockchip、phytium默认为 `rockchip`
9. -s, --spec SPEC
7. -s, --spec SPEC
构建的镜像版本:
- `headless`,无图形界面版的镜像。
@ -136,11 +142,11 @@
默认使用 `headless` 选项。
10. --cores N
8. --cores N
并行编译的数量,根据运行脚本的宿主机 CPU 实际数目设定,默认为可用的 CPU 总数。
11. -h, --help
9. -h, --help
显示帮助信息。
@ -154,23 +160,23 @@
- openEuler-20.03-LTS构建命令如下:
`sudo bash build.sh -n openEuler-20.03-LTS-Firefly-RK3399-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-20.03-LTS -u firefly-rk3399_defconfig -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-20.03-LTS/generic.repo -d rk3399-firefly -p rockchip -s headless`
`sudo bash build.sh --board firefly-rk3399 -n openEuler-20.03-LTS-Firefly-RK3399-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-20.03-LTS -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-20.03-LTS/generic.repo -s headless`
- openEuler-22.03-LTS-SP3构建命令如下
`sudo bash build.sh -n openEuler-22.03-LTS-SP3-Firefly-RK3399-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -u firefly-rk3399_defconfig -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -d rk3399-firefly -p rockchip -s headless`
`sudo bash build.sh --board firefly-rk3399 -n openEuler-22.03-LTS-SP3-Firefly-RK3399-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -s headless`
2. RockPi-4A
2. Radxa RockPi-4A
已测试的版本如下:
- openEuler-20.03-LTS构建命令如下:
`sudo bash build.sh -n openEuler-20.03-LTS-RockPi-4A-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-20.03-LTS -u rock-pi-4-rk3399_defconfig -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-20.03-LTS/generic.repo -d rk3399-rock-pi-4a -p rockchip -s headless`
`sudo bash build.sh --board radxa-rockpi-4a -n openEuler-20.03-LTS-RockPi-4A-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-20.03-LTS -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-20.03-LTS/generic.repo -s headless`
- openEuler-22.03-LTS构建命令如下
`sudo bash build.sh -n openEuler-22.03-LTS-RockPi-4A-aarch64-alpha1 -k https://gitee.com/openeuler/kernel.git -b openEuler-22.03-LTS -u rock-pi-4-rk3399_defconfig -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS/generic.repo -d rk3399-rock-pi-4a -p rockchip -s headless`
`sudo bash build.sh --board radxa-rockpi-4a -n openEuler-22.03-LTS-RockPi-4A-aarch64-alpha1 -k https://gitee.com/openeuler/kernel.git -b openEuler-22.03-LTS -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS/generic.repo -s headless`
适用的 RK3588 开发板:
@ -182,7 +188,7 @@
- openEuler-22.03-LTS构建命令如下:
`sudo bash build.sh -n openEuler-22.03-RK3588-Firefly-ITX-3588J-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-RK3588 -u none -c openeuler_rk3588_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS/generic.repo -d rk3588-firefly-itx-3588j -p rockchip -s headless`
`sudo bash build.sh --board firefly-itx-3588j -n openEuler-22.03-RK3588-Firefly-ITX-3588J-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-RK3588 -c openeuler_rk3588_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS/generic.repo -s headless`
2. Firefly ROC-RK3588S-PC
@ -190,7 +196,7 @@
- openEuler-22.03-LTS-SP3构建命令如下:
`sudo bash build.sh -n openEuler-22.03-LTS-SP3-Station-M3-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -u none -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -d rk3588s-roc-pc -p rockchip -s headless`
`sudo bash build.sh --board firefly-roc-rk3588s-pc -n openEuler-22.03-LTS-SP3-Station-M3-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -s headless`
3. Radxa Rock-5B
@ -198,7 +204,7 @@
- openEuler-22.03-LTS-SP3构建命令如下:
`sudo bash build.sh -n openEuler-22.03-LTS-SP3-Rock5B-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -u none -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -d rk3588-rock-5b -p rockchip -s headless`
`sudo bash build.sh --board radxa-rock-5b -n openEuler-22.03-LTS-SP3-Rock5B-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -s headless`
适用的 RK356X 开发板:
@ -210,15 +216,15 @@
- openEuler-22.03-LTS-SP2构建命令如下:
`sudo bash build.sh -n openEuler-22.03-LTS-SP2-Station-M2-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP2 -u none -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP2/generic.repo -d rk3566-roc-pc -p rockchip -s headless`
`sudo bash build.sh --board firefly-roc-rk3566-pc -n openEuler-22.03-LTS-SP2-Station-M2-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP2 -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP2/generic.repo -s headless`
- openEuler-22.03-LTS-SP3构建命令如下:
`sudo bash build.sh -n openEuler-22.03-LTS-SP3-Station-M2-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -u none -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -d rk3566-roc-pc -p rockchip -s headless`
`sudo bash build.sh --board firefly-roc-rk3566-pc -n openEuler-22.03-LTS-SP3-Station-M2-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -s headless`
- openEuler-24.03-LTS构建命令如下:
`sudo bash build.sh -n openEuler-24.03-LTS-Station-M2-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-24.03-LTS -u none -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -d rk3566-roc-pc -p rockchip -s headless`
`sudo bash build.sh --board firefly-roc-rk3566-pc -n openEuler-24.03-LTS-Station-M2-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-24.03-LTS -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -s headless`
2. Firefly ROC-RK3568-PC-SE
@ -226,11 +232,11 @@
- openEuler-22.03-LTS-SP2构建命令如下:
`sudo bash build.sh -n openEuler-22.03-LTS-SP2-ROC-RK3568-PC-SE-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP2 -u none -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP2/generic.repo -d rk3568-roc-pc-se -p rockchip -s headless`
`sudo bash build.sh --board firefly-roc-rk3568-pc-se -n openEuler-22.03-LTS-SP2-ROC-RK3568-PC-SE-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP2 -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP2/generic.repo -s headless`
- openEuler-22.03-LTS-SP3构建命令如下:
`sudo bash build.sh -n openEuler-22.03-LTS-SP3-ROC-RK3568-PC-SE-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -u none -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -d rk3568-roc-pc-se -p rockchip -s headless`
`sudo bash build.sh --board firefly-rk3568-pc-se -n openEuler-22.03-LTS-SP3-ROC-RK3568-PC-SE-aarch64-alpha1 -k https://gitee.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -c openeuler_rockchip_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -s headless`
适用的 Phytium 开发板:
@ -242,11 +248,11 @@
- openEuler-22.03-LTS-SP3构建命令如下:
`sudo bash build.sh -n openEuler-22.03-LTS-PhytiumPi-4GB-aarch64-alpha1 -k https://gitee.com/openeuler/phytium-kernel.git -b openEuler-22.03-LTS-Phytium -u none -c phytium_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS/generic.repo -d phytiumpi_firefly -p phytium -s headless`
`sudo bash build.sh --board phytiumpi-4gb -n openEuler-22.03-LTS-PhytiumPi-4GB-aarch64-alpha1 -k https://gitee.com/openeuler/phytium-kernel.git -b openEuler-22.03-LTS-Phytium -c phytium_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS/generic.repo -s headless`
- openEuler-24.03-LTS构建命令如下:
`sudo bash build.sh -n openEuler-24.03-LTS-PhytiumPi-4GB-aarch64-alpha1 -k https://gitee.com/openeuler/phytium-kernel.git -b openEuler-24.03-LTS-Phytium -u none -c phytium_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -d phytiumpi_firefly -p phytium -s headless`
`sudo bash build.sh --board phytium-4gb -n openEuler-24.03-LTS-PhytiumPi-4GB-aarch64-alpha1 -k https://gitee.com/openeuler/phytium-kernel.git -b openEuler-24.03-LTS-Phytium -c phytium_defconfig -r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -s headless`
### 顺序构建

View File

@ -0,0 +1,3 @@
ubootconfig=none
dtb_name=rk3588-firefly-itx-3588j
platform=rockchip

View File

@ -0,0 +1,3 @@
ubootconfig=firefly-rk3399_defconfig
dtb_name=rk3399-firefly
platform=rockchip

View File

@ -0,0 +1,3 @@
ubootconfig=none
dtb_name=rk3566-roc-pc
platform=rockchip

View File

@ -0,0 +1,3 @@
ubootconfig=none
dtb_name=rk3568-roc-pc-se
platform=rockchip

View File

@ -0,0 +1,3 @@
ubootconfig=none
dtb_name=rk3588s-roc-pc
platform=rockchip

View File

@ -0,0 +1,3 @@
ubootconfig=none
dtb_name=phytiumpi_firefly
platform=rockchip

View File

@ -0,0 +1,3 @@
ubootconfig=none
dtb_name=rk3588-rock-5b
platform=rockchip

View File

@ -0,0 +1,3 @@
ubootconfig=rock-pi-4-rk3399_defconfig
dtb_name=rk3399-rock-pi-4a
platform=rockchip

View File

@ -0,0 +1,3 @@
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.

View File

@ -6,14 +6,12 @@ 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.
-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.
-c, --config KERNEL_DEFCONFIG The name/path of defconfig file when compiling kernel, which defaults to openeuler_rockchip_defconfig.
-u, --ubootconfig UBOOT_DEFCONFIG Required! The name of defconfig file when compiling u-boot, which defaults to firefly-rk3399_defconfig.
-p, --platform PLATFORM Required! The platform of target board, which defaults to rockchip.
-r, --repo REPO_INFO The URL/path of target repo file or list of repo's baseurls which should be a space separated list.
-d, --device-tree DTB_NAME Required! The device tree name of target board, which defaults to rk3399-firefly.
-s, --spec SPEC The image's specification: headless, xfce, ukui, dde or the file path of rpmlist. The default is headless.
--cores N The number of cpu cores to be used during making.
-h, --help Show command help.
@ -30,16 +28,15 @@ used_param() {
echo "Default args"
echo "KERNEL_DEFCONFIG : $default_defconfig"
echo ""
echo "DTB_NAME : $dtb_name"
echo "TARGET_BOARD : $board"
echo ""
echo "KERNEL_BRANCH : $branch"
echo ""
echo "PLATFORM : $platform"
echo ""
}
default_param() {
default_defconfig=openeuler_rockchip_defconfig
board=firefly-rk3399
ubootconfig=firefly-rk3399_defconfig
dtb_name=rk3399-firefly
platform=rockchip
@ -86,6 +83,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-n" -o "x$1" == "x--name" ]; then
name=`echo $2`
shift
@ -94,10 +95,6 @@ parseargs()
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-b" -o "x$1" == "x--branch" ]; then
branch=`echo $2`
shift
@ -106,18 +103,10 @@ parseargs()
default_defconfig=`echo $2`
shift
shift
elif [ "x$1" == "x-u" -o "x$1" == "x--ubootconfig" ]; then
ubootconfig=`echo $2`
shift
shift
elif [ "x$1" == "x-r" -o "x$1" == "x--repo" ]; then
repo_file=`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-s" -o "x$1" == "x--spec" ]; then
spec_param=`echo $2`
shift
@ -146,6 +135,15 @@ LOG(){
default_param
parseargs "$@" || help $?
LOG "Selected board: ${board}."
source boards/${board}.conf
LOG "U-Boot config: ${ubootconfig}."
LOG "DeviceTree name: ${dtb_name}."
LOG "Target platform: ${platform}."
used_param
if [ ! -d $workdir ]; then
mkdir $workdir