From 5a311a67a45915710de88b0f5902b6a2cf9a8306 Mon Sep 17 00:00:00 2001 From: chainsx Date: Mon, 17 Feb 2025 09:46:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8u-boot=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=88=B0=E7=89=88=E5=9E=8B=E6=96=87=E4=BB=B6=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...02\351\205\215\346\214\207\345\215\227.md" | 8 +++- .../rockchip/boards/firefly-itx-3588j.conf | 1 + .../boards/firefly-roc-rk3566-pc.conf | 1 + .../boards/firefly-roc-rk3568-pc-se.conf | 1 + .../boards/firefly-roc-rk3588s-pc.conf | 1 + scripts/rockchip/boards/phytiumpi-4gb.conf | 1 + scripts/rockchip/boards/radxa-rock5b.conf | 1 + scripts/rockchip/build_u-boot.sh | 45 ++++++++----------- 8 files changed, 32 insertions(+), 27 deletions(-) diff --git "a/documents/rockchip/openEuler\351\200\202\351\205\215\346\214\207\345\215\227.md" "b/documents/rockchip/openEuler\351\200\202\351\205\215\346\214\207\345\215\227.md" index d5de2d1..30dbb47 100644 --- "a/documents/rockchip/openEuler\351\200\202\351\205\215\346\214\207\345\215\227.md" +++ "b/documents/rockchip/openEuler\351\200\202\351\205\215\346\214\207\345\215\227.md" @@ -40,7 +40,7 @@ - RK35xx - 需要将编译好的 u-boot 二进制文件放到 [u-boot 目录](../../scripts/rockchip/bin/u-boot/)下,并在 [build_boot.sh](../../scripts/rockchip/build_u-boot.sh#L126) 中增加相应操作。 + 需要将编译好的 u-boot 二进制文件放到 [u-boot 目录](../../scripts/rockchip/bin/u-boot/)下,并在版型文件中增加文件路径。 ## 准备 firmware 文件 @@ -72,6 +72,12 @@ POST_BOARD_OVERLAY() { 1. ubootconfig=UBOOT_DEFCONFIG 开发板对应的 defconfig 的文件名称,对应 [u-boot/configs](https://github.com/u-boot/u-boot/tree/master/configs) 下 `UBOOT_DEFCONFIG` 文件,默认为 `firefly-rk3399_defconfig`;如需在 RK3568/RK3588 开发板上使用预编译的 u-boot,可以将此项设置为 `none`。 + + 如果设置为 `none`,则还需添加以下附属配置参数: + + - local_uboot_dir + + 开发板 u-boot 配置设置为 `none` 时,本地预编译的 u-boot 二进制文件的位置。 2. dtb_name=DTB_NAME diff --git a/scripts/rockchip/boards/firefly-itx-3588j.conf b/scripts/rockchip/boards/firefly-itx-3588j.conf index bae98c2..341fc56 100644 --- a/scripts/rockchip/boards/firefly-itx-3588j.conf +++ b/scripts/rockchip/boards/firefly-itx-3588j.conf @@ -1,4 +1,5 @@ ubootconfig=none +local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3588 dtb_name=rk3588-firefly-itx-3588j platform=rockchip diff --git a/scripts/rockchip/boards/firefly-roc-rk3566-pc.conf b/scripts/rockchip/boards/firefly-roc-rk3566-pc.conf index a26fbb2..57fe2f4 100644 --- a/scripts/rockchip/boards/firefly-roc-rk3566-pc.conf +++ b/scripts/rockchip/boards/firefly-roc-rk3566-pc.conf @@ -1,4 +1,5 @@ ubootconfig=none +local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3566 dtb_name=rk3566-roc-pc platform=rockchip diff --git a/scripts/rockchip/boards/firefly-roc-rk3568-pc-se.conf b/scripts/rockchip/boards/firefly-roc-rk3568-pc-se.conf index e8520a3..1b4e5ab 100644 --- a/scripts/rockchip/boards/firefly-roc-rk3568-pc-se.conf +++ b/scripts/rockchip/boards/firefly-roc-rk3568-pc-se.conf @@ -1,4 +1,5 @@ ubootconfig=none +local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3568 dtb_name=rk3568-roc-pc-se platform=rockchip diff --git a/scripts/rockchip/boards/firefly-roc-rk3588s-pc.conf b/scripts/rockchip/boards/firefly-roc-rk3588s-pc.conf index 9df0220..ee7d8c1 100644 --- a/scripts/rockchip/boards/firefly-roc-rk3588s-pc.conf +++ b/scripts/rockchip/boards/firefly-roc-rk3588s-pc.conf @@ -1,4 +1,5 @@ ubootconfig=none +local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3588 dtb_name=rk3588s-roc-pc platform=rockchip diff --git a/scripts/rockchip/boards/phytiumpi-4gb.conf b/scripts/rockchip/boards/phytiumpi-4gb.conf index 842fa25..ff1330f 100644 --- a/scripts/rockchip/boards/phytiumpi-4gb.conf +++ b/scripts/rockchip/boards/phytiumpi-4gb.conf @@ -1,4 +1,5 @@ ubootconfig=none +local_uboot_dir=${nonfree_bin_dir}/u-boot/phytiumpi dtb_name=phytiumpi_firefly platform=phytium diff --git a/scripts/rockchip/boards/radxa-rock5b.conf b/scripts/rockchip/boards/radxa-rock5b.conf index 0bf5341..4dd6a3c 100644 --- a/scripts/rockchip/boards/radxa-rock5b.conf +++ b/scripts/rockchip/boards/radxa-rock5b.conf @@ -1,4 +1,5 @@ ubootconfig=none +local_uboot_dir=${nonfree_bin_dir}/u-boot/radxa-rock5b dtb_name=rk3588-rock-5b platform=rockchip diff --git a/scripts/rockchip/build_u-boot.sh b/scripts/rockchip/build_u-boot.sh index 58120a4..ef75ae6 100755 --- a/scripts/rockchip/build_u-boot.sh +++ b/scripts/rockchip/build_u-boot.sh @@ -2,11 +2,11 @@ __usage=" Usage: build_u-boot [OPTIONS] -Build Rockchip u-boot image. +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: - -u, --ubootconfig UBOOT_DEFCONFIG Required! The name of defconfig file when compiling u-boot, which defaults to firefly-rk3399_defconfig, set none to use prebuild u-boot image. + --board, BOARD 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. " @@ -18,7 +18,7 @@ help() } default_param() { - ubootconfig="firefly-rk3399_defconfig" + board=firefly-rk3399 workdir=$(pwd)/build u_boot_url="https://gitlab.arm.com/systemready/firmware-build/u-boot.git" rk3399_bl31_url="https://github.com/rockchip-linux/rkbin/raw/master/bin/rk33/rk3399_bl31_v1.36.elf" @@ -29,8 +29,8 @@ default_param() { local_param(){ if [ -f $workdir/.param ]; then - ubootconfig=$(cat $workdir/.param | grep ubootconfig) - ubootconfig=${ubootconfig:12} + board=$(cat $workdir/.param | grep board) + board=${board:6} fi } @@ -46,8 +46,8 @@ parseargs() return 1 elif [ "x$1" == "x" ]; then shift - elif [ "x$1" == "x-u" -o "x$1" == "x--ubootconfig" ]; then - ubootconfig=`echo $2` + elif [ "x$1" == "x--board" ]; then + board=`echo $2` shift shift elif [ "x$1" == "x--cores" ]; then @@ -119,26 +119,17 @@ use_prebuild_u-boot() { if [ -d $workdir/u-boot ]; then rm -rf $workdir/u-boot fi + mkdir $workdir/u-boot - if [ -f $workdir/.param ]; then - dtb_name=$(cat $workdir/.param | grep dtb_name) - dtb_name=${dtb_name:9} - if [[ "x$dtb_name" == "xrk3588s-roc-pc" || "x$dtb_name" == "xrk3588-firefly-itx-3588j" ]]; then - cp $nonfree_bin_dir/u-boot/firefly-rk3588/* $workdir/u-boot - elif [[ "x$dtb_name" == "xrk3588-rock-5b" ]]; then - cp $nonfree_bin_dir/u-boot/radxa-rock5b/* $workdir/u-boot - elif [[ "x$dtb_name" == "xrk3566-roc-pc" ]]; then - cp $nonfree_bin_dir/u-boot/firefly-rk3566/* $workdir/u-boot - elif [[ "x$dtb_name" == "xrk3568-roc-pc-se" ]]; then - cp $nonfree_bin_dir/u-boot/firefly-rk3568/* $workdir/u-boot - elif [[ "x$dtb_name" == "xphytiumpi_firefly" ]]; then - cp $nonfree_bin_dir/u-boot/phytiumpi/fip-all-sd-boot.bin $workdir/u-boot - mkenvimage -s 0x1000 -o $workdir/u-boot/env.bin $nonfree_bin_dir/u-boot/phytiumpi/env.txt - dd if=$workdir/u-boot/env.bin of=$workdir/u-boot/fip-all-sd-boot.bin bs=1k seek=1472 conv=notrunc - else - echo "target u-boot can not found!" - exit 2 - fi + if [[ "x${platform}" == "xrockchip" ]]; then + cp ${local_uboot_dir}/* $workdir/u-boot + elif [[ "x${platform}" == "xphytium" ]]; then + cp ${local_uboot_dir}/fip-all-sd-boot.bin $workdir/u-boot + mkenvimage -s 0x1000 -o $workdir/u-boot/env.bin ${local_uboot_dir}/env.txt + dd if=$workdir/u-boot/env.bin of=$workdir/u-boot/fip-all-sd-boot.bin bs=1k seek=1472 conv=notrunc + else + echo "target u-boot can not found!" + exit 2 fi } @@ -148,6 +139,8 @@ default_param local_param parseargs "$@" || help $? +source $workdir/../boards/${board}.conf + if [ ! -d $workdir ]; then mkdir $workdir fi -- Gitee