diff --git a/README.en.md b/README.en.md
index 6108544..03e1e98 100644
--- a/README.en.md
+++ b/README.en.md
@@ -13,6 +13,9 @@ This repository is the main repository of the openEuler SBC (Single-Board Comput
- [How to download latest image](#how-to-download-latest-image)
- [Raspberry Pi](#raspberry-pi)
- [Rockchip](#rockchip)
+ - [How to build image](#how-to-build-image)
+ - [Prepare the environment](#prepare-the-environment)
+ - [Run the scripts to build image](#run-the-scripts-to-build-image)
@@ -286,4 +289,50 @@ Basic information of the image is as follows:
openEuler 22.03 LTS SP3 repository |
A compressed RAW original image |
-
\ No newline at end of file
+
+
+## How to build image
+
+### Prepare the environment
+
+To build openEuler AArch64 image for Raspberry Pi, Rockchip or other SoCs, the requirements of running scripts of this repository are as follows:
+
+- OS: openEuler or CentOS 8
+- Hardware: AArch64 hardware, such as Raspberry Pi, Firefly RK3399, Firefly ROC-RK3588S-PC
+
+For other architecture hardware, you can use [QEMU](https://www.qemu.org/) to build AArch64 system emulation.
+
+### Run the scripts to build image
+
+You can use the respective scripts of Raspberry Pi, Rockchip or other SoCs to build images. Refer to the specific documentation:
+- [Build Raspberry Pi images](./documents/树莓派.md#构建镜像)
+- [Build images for Rochchip and other SoCs](./documents/瑞芯微等开发板.md#镜像构建)
+
+Alternatively, you can use the unified entry point [build.sh](./scripts/build.sh) to build images for Raspberry Pi, Rockchip or other SoCs by executing the following command:
+
+`sudo bash scripts/build.sh --board BOARD_TYPE --in-docker [other_args...]`
+
+Parameter Definitions & Meaning:
+
+1. `--in-docker`
+ Build the image using a Docker container. Refer to the links below:
+ - [Build Raspberry Pi images in Docker](./documents/树莓派.md#docker-容器内构建)
+ - [Build images for Rockchip or other SoCs in Docker](./documents/瑞芯微等开发板.md#docker-容器内构建)
+
+2. `--board BOARD_TYPE`
+ Specifies the development board type. Currently supported parameters include:
+
+ - `rpi`: Build a Raspberry Pi image without compiling the kernel. For other parameters, refer to [Quick build for Raspberry Pi (no kernel compilation)](./documents/树莓派.md#快速构建无需编译内核推荐).
+ - `rpi-custom`: Build a Raspberry Pi image with kernel compilation. For other parameters, refer to [Build a Raspberry Pi image using a custom-compiled kernel](./documents/树莓派.md#完全构建包括编译内核).
+ - `firefly-itx-3588j`: Build a Firefly ITX-3588J image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+ - `firefly-rk3399`: Build a Firefly RK3399 image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+ - `firefly-roc-rk3566-pc`: Build a Firefly ROC-RK3566-PC image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+ - `firefly-roc-rk3568-pc`: Build a Firefly ROC-RK3568-PC image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+ - `firefly-roc-rk3568-pc-se`: Build a Firefly ROC-RK3568-PC-SE image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+ - `firefly-roc-rk3588s-pc`: Build a Firefly ROC-RK3588S-PC image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+ - `phytiumpi-4gb`: Build a Phytium Pi 4GB image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+ - `radxa-rock5b`: Build a Radxa Rock-5B image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+ - `radxa-rockpi-4a`: Build a Radxa RockPi-4A image. For other parameters, refer to [Build an image for Rockchip or other SoCs](./documents/瑞芯微等开发板.md#一次构建).
+
+3. `-h`, `--help`
+ Display help information.
diff --git a/README.md b/README.md
index 0b77e1d..87560d6 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,9 @@
- [最新镜像](#最新镜像)
- [树莓派](#树莓派)
- [瑞芯微等其他开发板](#瑞芯微等其他开发板)
+ - [镜像构建](#镜像构建)
+ - [准备环境](#准备环境)
+ - [构建镜像](#构建镜像)
## To Do List
@@ -286,3 +289,48 @@ SIG 组基本信息位于 [sig-SBC](https://gitee.com/openeuler/community/tree/m
压缩后的 RAW 原始镜像 |
+
+## 镜像构建
+
+### 准备环境
+
+本仓库的脚本运行环境要求如下:
+
+- 操作系统:openEuler、CentOS 8
+- 架构:AArch64,如树莓派、 RK3399 开发板、 RK3588 开发板
+
+其他架构可以使用 [QEMU](https://www.qemu.org/) 模拟器搭建 AArch64 运行环境。
+
+### 构建镜像
+
+可以使用树莓派或瑞芯微等开发板各自的脚本构建镜像,具体文档参考:
+- [树莓派镜像构建](./documents/树莓派.md#构建镜像)
+- [瑞芯微等开发板镜像构建](./documents/瑞芯微等开发板.md#镜像构建)
+
+也可以使用统一入口 [build.sh](./scripts/build.sh) 构建树莓派或瑞芯微等开发板镜像,执行命令:
+
+`sudo bash scripts/build.sh --board BOARD_TYPE --in-docker [other_args...]`
+
+各个参数含义:
+
+1. --in-docker
+ 使用 Docker 容器构建镜像,参考链接:
+ - [使用 Docker 容器构建树莓派镜像](./documents/树莓派.md#docker-容器内构建)
+ - [使用 Docker 容器构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#docker-容器内构建)
+
+2. --board BOARD_TYPE
+ 开发板类型和构建方式。当前支持的参数有:
+ - rpi,无需编译内核直接构建树莓派镜像,其他参数请参考 [无需编译内核快速构建树莓派镜像](./documents/树莓派.md#快速构建无需编译内核推荐)。
+ - rpi-custom,编译内核并构建树莓派镜像,其他参数请参考 [编译内核构建树莓派镜像](./documents/树莓派.md#完全构建包括编译内核)。
+ - firefly-itx-3588j,构建 Firefly ITX-3588J 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+ - firefly-rk3399,构建 Firefly RK3399 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+ - firefly-roc-rk3566-pc,构建 Firefly ROC-RK3566-PC 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+ - firefly-roc-rk3568-pc,构建 Firefly ROC-RK3568-PC 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+ - firefly-roc-rk3568-pc-se,构建 Firefly ROC-RK3568-PC-SE 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+ - firefly-roc-rk3588s-pc,构建 Firefly ROC-RK3588S-PC 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+ - phytiumpi-4gb,构建 Phytium Pi 4GB 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+ - radxa-rock5b,构建 Radxa Rock-5B 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+ - radxa-rockpi-4a,构建 Radxa RockPi-4A 开发板镜像,其他参数请参考 [构建瑞芯微等开发板镜像](./documents/瑞芯微等开发板.md#一次构建)。
+
+3. -h, --help
+ 显示帮助信息。
diff --git a/documents/树莓派.md b/documents/树莓派.md
index f607b0f..525530b 100644
--- a/documents/树莓派.md
+++ b/documents/树莓派.md
@@ -13,8 +13,7 @@
- [构建镜像](#构建镜像)
- [快速构建(无需编译内核,推荐)](#快速构建无需编译内核推荐)
- [完全构建(包括编译内核)](#完全构建包括编译内核)
- - [主机上构建](#主机上构建)
- - [Docker 容器内构建](#docker-容器内构建)
+ - [Docker 容器内构建](#docker-容器内构建)
@@ -41,8 +40,8 @@
- [openEuler 21.09 内测版(LXDE 桌面、中文输入法)更新日志](raspberrypi/changelog/changelog-21.09-LXDE.md)
- [scripts](../scripts/raspberrypi): 构建 openEuler 树莓派镜像的脚本
- [快速构建(不编译内核)](../scripts/raspberrypi/build-image.sh)
- - [主机上构建(编译内核)](../scripts/raspberrypi/build-image-common.sh)
- - [Docker 容器中构建(编译内核)](../scripts/raspberrypi/build-image-docker.sh)
+ - [完全构建(编译内核)](../scripts/raspberrypi/build-image-common.sh)
+ - [Docker 容器中构建](../scripts/raspberrypi/build-image-docker.sh)
## 最新镜像
@@ -140,8 +139,6 @@
包含编译内核、下载树莓派相关固件等过程,速度相对较慢。
-这里,提供两种构建方式。
-
> **须知:**
>当前支持三个 openEuler 版本,即 20.03 LTS、20.09、20.03 LTS SP1、21.03、20.03 LTS SP2、21.09、20.03 LTS SP3、22.03 LTS、22.09、22.03 LTS SP1、23.03、22.03 LTS SP2、22.03 LTS SP3、24.03 LTS、22.03 LTS SP4、24.09、24.03 LTS SP1、25.03 版本。
>如果构建包含 Xfce/UKUI/DDE 桌面环境或者 DevStation 开发者工作站的镜像,需要注意六点:
@@ -189,13 +186,11 @@
> - openEuler 25.03:需要选择 [openEuler-RaspberryPi 内核](https://gitee.com/openeuler/raspberrypi-kernel) 的 [openEuler-25.03](https://gitee.com/openeuler/raspberrypi-kernel/tree/openEuler-25.03/) 分支,即将参数 `-k/--kernel` 设置为 `git@gitee.com:openeuler/raspberrypi-kernel.git`,`-b/--branch` 设置为 `openEuler-25.03`。
>6. 根据需要设置 -s/--spec,其具体意义见该参数的介绍部分。
-##### 主机上构建
-
构建镜像需执行命令:
`sudo bash build-image-common.sh -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO -s SPEC --cores N`
-脚本运行结束后,会提示镜像的存储位置,镜像默认保存在脚本运行所在目录的 `raspi_output_common/img/` 下。
+脚本运行结束后,会提示镜像的存储位置,镜像默认保存在脚本运行所在目录的 `raspi_output/img/` 下。
各个参数意义:
@@ -244,17 +239,17 @@
并行编译的数量,根据运行脚本的宿主机 CPU 实际数目设定,默认为可用的 CPU 总数。
-##### Docker 容器内构建
+#### Docker 容器内构建
构建镜像需执行命令:
`sudo bash build-image-docker.sh -d DOCKER_FILE -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
-脚本运行结束后,镜像默认保存在脚本运行所在目录的 `raspi_output_common/img/` 下。
+脚本运行结束后,镜像默认保存在脚本运行所在目录的 `raspi_output/img/` 下。
-注意!!!运行该脚本前,需安装 Docker 运行环境。该脚本会自动将 DOCKER_FILE 参数对应的 Docker 镜像导入本机系统中。
+注意!!!运行该脚本前,需安装 Docker 运行环境。该脚本会自动将 `-d DOCKER_FILE` 参数对应的 Docker 镜像导入本机系统中。
-除参数 DOCKER_FILE 外,剩余参数与[主机上构建](#主机上构建)中对应参数一致:
+除参数 `-d DOCKER_FILE` 外,剩余参数与 [快速构建(无需编译内核,推荐)](#快速构建无需编译内核推荐) 或 [完全构建(包括编译内核)](#完全构建包括编译内核) 中对应参数一致:
1. -d, --docker DOCKER_FILE
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100644
index 0000000..26dd438
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+set -e
+
+usage() {
+ echo "Usage: $0 --board BOARD_TYPE --in-docker [other_args...]"
+ echo Options:
+ echo "--in-docker Build images in Docker."
+ echo "--board BOARD_TYPE Supported boards:"
+ echo " - rpi (Build a Raspberry Pi image without kernel compilation)"
+ echo " - rpi-custom (Build a Raspberry Pi image using a custom kernel compiled)"
+ for config in "${RK_BOARDS[@]}"; do
+ echo " - $config"
+ done
+ exit 1
+}
+
+cur_dir=$(cd $(dirname $0);pwd)
+rk_board_dir=$cur_dir/rockchip/boards
+
+BOARD=""
+HELP=false
+IN_DOCKER=false
+ARGS=()
+RK_BOARDS=()
+SUB_SCRIPT=""
+
+while IFS= read -r -d '' file; do
+ RK_BOARDS+=("$(basename "$file" .conf)")
+done < <(find "$rk_board_dir" -type f -name "*.conf" ! -name "sample.conf" -print0 | sort -z)
+
+if [ $# -eq 0 ]; then
+ usage
+fi
+
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --board)
+ BOARD="$2"
+ shift 2
+ ;;
+ --in-docker)
+ IN_DOCKER=true
+ shift
+ ;;
+ --help)
+ HELP=true
+ ARGS+=("--help")
+ shift
+ ;;
+ *)
+ ARGS+=("$1")
+ shift
+ ;;
+ esac
+done
+
+if [ -z "$BOARD" ]; then
+ if ! $HELP; then
+ echo "Error: --board parameter is required"
+ fi
+ usage
+fi
+
+case "$BOARD" in
+ rpi)
+ if $IN_DOCKER; then
+ SUB_SCRIPT="$cur_dir/raspberrypi/build-image-docker.sh"
+ else
+ SUB_SCRIPT="$cur_dir/raspberrypi/build-image.sh"
+ fi
+ ;;
+ rpi-custom)
+ if $IN_DOCKER; then
+ SUB_SCRIPT="$cur_dir/raspberrypi/build-image-docker.sh"
+ else
+ SUB_SCRIPT="$cur_dir/raspberrypi/build-image-common.sh"
+ fi
+ ;;
+ *)
+ for item in "${RK_BOARDS[@]}"; do
+ if [ "$item" == "$BOARD" ]; then
+ if $IN_DOCKER; then
+ SUB_SCRIPT="$cur_dir/rockchip/build-image-docker.sh"
+ else
+ SUB_SCRIPT="$cur_dir/rockchip/build.sh"
+ fi
+ ARGS+=("--board")
+ ARGS+=("$BOARD")
+ break
+ fi
+ done
+ ;;
+esac
+
+if [ -z "$SUB_SCRIPT" ]; then
+ echo "Error: Unknown board type '$BOARD'"
+ usage
+fi
+
+echo "Running: $SUB_SCRIPT ${ARGS[@]}"
+"$SUB_SCRIPT" "${ARGS[@]}"
diff --git a/scripts/raspberrypi/build-image-common.sh b/scripts/raspberrypi/build-image-common.sh
old mode 100644
new mode 100755
index 34caf33..76aafd8
--- a/scripts/raspberrypi/build-image-common.sh
+++ b/scripts/raspberrypi/build-image-common.sh
@@ -610,9 +610,9 @@ cur_dir=$(cd $(dirname $0);pwd)
workdir=${cur_dir}
if [ "x${workdir}" == "x/" ]; then
- workdir=/raspi_output_common
+ workdir=/raspi_output
else
- workdir=${workdir}/raspi_output_common
+ workdir=${workdir}/raspi_output
fi
buildid=$(date +%Y%m%d%H%M%S)
diff --git a/scripts/raspberrypi/build-image-docker.sh b/scripts/raspberrypi/build-image-docker.sh
old mode 100644
new mode 100755
index ba324ae..0b73ede
--- a/scripts/raspberrypi/build-image-docker.sh
+++ b/scripts/raspberrypi/build-image-docker.sh
@@ -48,6 +48,7 @@ parseargs()
elif [ "x$1" == "x-k" -o "x$1" == "x--kernel" ]; then
kernel_url=`echo $2`
params="${params} -k ${kernel_url}"
+ KERNEL_COMPILE="-common"
shift
shift
elif [ "x$1" == "x-b" -o "x$1" == "x--branch" ]; then
@@ -125,16 +126,17 @@ LOG(){
cur_dir=$(cd $(dirname $0);pwd)
docker_file="https://repo.openeuler.org/openEuler-20.03-LTS-SP1/docker_img/aarch64/openEuler-docker.aarch64.tar.xz"
+KERNEL_COMPILE=""
-workdir=${cur_dir}/raspi_output_common
+workdir=${cur_dir}/raspi_output
buildid=$(date +%Y%m%d%H%M%S)
builddate=${buildid:0:8}
log_dir=${workdir}/log
params_dir=${workdir}/params
-euler_dir=${cur_dir}/config-common
-params_dir_indocker=/work/raspi_output_common/params
+params_dir_indocker=/work/raspi_output/params
+euler_dir=${cur_dir}/config$KERNEL_COMPILE
if [ -d ${params_dir} ]; then
rm -rf ${params_dir}
@@ -168,16 +170,16 @@ LOG build raspi image with docker: ${docker_file}.
(echo "FROM $docker_img_name" && grep -v FROM ${euler_dir}/Dockerfile_makeraspi) | docker build -t ${docker_img_name}-${buildid} --no-cache -f- ${euler_dir}
echo docker run --rm --privileged=true \
- -v ${cur_dir}/build-image-common.sh:/work/build-image-common.sh \
+ -v ${cur_dir}/build-image$KERNEL_COMPILE.sh:/work/build-image.sh \
-v ${euler_dir}:/work/config-common \
-v ${cur_dir}/config:/work/config \
- -v ${workdir}:/work/raspi_output_common \
+ -v ${workdir}:/work/raspi_output \
${docker_img_name}-${buildid} ${params}
docker run --rm --privileged=true \
- -v ${cur_dir}/build-image-common.sh:/work/build-image-common.sh \
+ -v ${cur_dir}/build-image$KERNEL_COMPILE.sh:/work/build-image.sh \
-v ${euler_dir}:/work/config-common \
-v ${cur_dir}/config:/work/config \
- -v ${workdir}:/work/raspi_output_common \
+ -v ${workdir}:/work/raspi_output \
${docker_img_name}-${buildid} ${params}
chmod -R a+r ${workdir}/img
docker image rm ${docker_img_name}-${buildid}
diff --git a/scripts/raspberrypi/build-image.sh b/scripts/raspberrypi/build-image.sh
old mode 100644
new mode 100755
diff --git a/scripts/raspberrypi/config-common/Dockerfile_makeraspi b/scripts/raspberrypi/config-common/Dockerfile_makeraspi
deleted file mode 100644
index cfa8efb..0000000
--- a/scripts/raspberrypi/config-common/Dockerfile_makeraspi
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM openeuler-20.03-lts-sp1:latest
-
-RUN dnf clean expire-cache
-
-RUN dnf -y install cmake gdb gcc gcc-c++ libstdc++-static ncurses ncurses-devel make python bash coreutils && \
- dnf -y clean all
-
-RUN dnf -y install module-init-tools git openssl-devel bc bison flex dnf-plugins-core dosfstools parted wget device-mapper-multipath grep xz kpartx
-RUN dnf -y install rsync passwd diffutils
-ENV SHELL=/bin/bash
-
-ENTRYPOINT ["/bin/bash", "/work/build-image-common.sh"]
-
diff --git a/scripts/raspberrypi/config-common/Dockerfile_makeraspi b/scripts/raspberrypi/config-common/Dockerfile_makeraspi
new file mode 120000
index 0000000..0ad546b
--- /dev/null
+++ b/scripts/raspberrypi/config-common/Dockerfile_makeraspi
@@ -0,0 +1 @@
+../config/Dockerfile_makeraspi
\ No newline at end of file
diff --git a/scripts/raspberrypi/config/Dockerfile_makeraspi b/scripts/raspberrypi/config/Dockerfile_makeraspi
new file mode 100644
index 0000000..0ba1932
--- /dev/null
+++ b/scripts/raspberrypi/config/Dockerfile_makeraspi
@@ -0,0 +1,13 @@
+FROM openeuler-20.03-lts-sp1:latest
+
+RUN dnf clean expire-cache
+
+RUN dnf -y install cmake gdb gcc gcc-c++ libstdc++-static ncurses ncurses-devel make python bash coreutils && \
+ dnf -y clean all
+
+RUN dnf -y install module-init-tools git openssl-devel bc bison flex dnf-plugins-core dosfstools parted wget device-mapper-multipath grep xz kpartx
+RUN dnf -y install rsync passwd diffutils
+ENV SHELL=/bin/bash
+
+ENTRYPOINT ["/bin/bash", "/work/build-image.sh"]
+
diff --git a/scripts/rockchip/build-image-docker.sh b/scripts/rockchip/build-image-docker.sh
old mode 100644
new mode 100755
diff --git a/scripts/rockchip/build.sh b/scripts/rockchip/build.sh
index bb97ee0..21a0218 100755
--- a/scripts/rockchip/build.sh
+++ b/scripts/rockchip/build.sh
@@ -43,7 +43,7 @@ default_param() {
branch=openEuler-20.03-LTS
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
+ workdir=$cur_dir/build
name=${branch}-${board}-aarch64-alpha1
make_cores=$(nproc)
}
@@ -133,13 +133,13 @@ LOG(){
echo `date` - INFO, $* | tee -a ${log_dir}/${builddate}.log
}
+cur_dir=$(cd $(dirname $0);pwd)
+
default_param
parseargs "$@" || help $?
LOG "Selected board: ${board}."
-cur_dir=$(cd $(dirname $0);pwd)
-
source ${cur_dir}/boards/${board}.conf
LOG "Board config: ${board}."
@@ -170,15 +170,15 @@ else
fi
if [[ $(cat $workdir/.done | grep u-boot) != "u-boot" ]];then
- bash build_u-boot.sh
+ bash $cur_dir/build_u-boot.sh
fi
if [[ $(cat $workdir/.done | grep bootimg) != "bootimg" ]];then
- bash build_boot.sh
+ bash $cur_dir/build_boot.sh
fi
if [[ $(cat $workdir/.done | grep rootfs) != "rootfs" ]];then
- bash build_rootfs.sh
+ bash $cur_dir/build_rootfs.sh
fi
-bash gen_image.sh --board ${board}
+bash $cur_dir/gen_image.sh --board ${board}
diff --git a/scripts/rockchip/build_boot.sh b/scripts/rockchip/build_boot.sh
index 32f42f0..f51072b 100755
--- a/scripts/rockchip/build_boot.sh
+++ b/scripts/rockchip/build_boot.sh
@@ -21,7 +21,7 @@ help()
}
default_param() {
- workdir=$(pwd)/build
+ workdir=$cur_dir/build
branch=openEuler-20.03-LTS
default_defconfig=openeuler_rockchip_defconfig
board=firefly-rk3399
@@ -242,6 +242,7 @@ mk_boot() {
}
kernel_defconfig=""
+cur_dir=$(cd $(dirname $0);pwd)
default_param
local_param
@@ -260,11 +261,12 @@ elif [ -f $default_defconfig ]; then
kernel_defconfig=${workdir}/${default_defconfig##*/}
fi
-source $workdir/../boards/${board}.conf
-
if [ ! -d $workdir ]; then
mkdir $workdir
fi
+
+source $workdir/../boards/${board}.conf
+
if [ ! -d ${log_dir} ];then mkdir -p ${log_dir}; fi
if [ ! -f $workdir/.done ];then
touch $workdir/.done
diff --git a/scripts/rockchip/build_rootfs.sh b/scripts/rockchip/build_rootfs.sh
index d53ee0e..5c4c18e 100755
--- a/scripts/rockchip/build_rootfs.sh
+++ b/scripts/rockchip/build_rootfs.sh
@@ -24,7 +24,7 @@ default_param() {
board=firefly-rk3399
repo_file="https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-20.03-LTS/generic.repo"
tmp_dir=${workdir}/tmp
- workdir=$(pwd)/build
+ workdir=$cur_dir/build
branch=openEuler-20.03-LTS
nonfree_bin_dir=${workdir}/../bin
rootfs_dir=${workdir}/rootfs
@@ -325,6 +325,7 @@ mk_rootfsimg() {
}
set -e
root_need
+cur_dir=$(cd $(dirname $0);pwd)
default_param
local_param
parseargs "$@" || help $?
@@ -335,11 +336,12 @@ POST_BOARD_OVERLAY() {
echo "Initial POST_BOARD_OVERLAY function" # It will be overwritten by board.conf.
}
-source $workdir/../boards/${board}.conf
-
if [ ! -d $workdir ]; then
mkdir $workdir
fi
+
+source $workdir/../boards/${board}.conf
+
if [ ! -d ${log_dir} ];then mkdir -p ${log_dir}; fi
if [ ! -f $workdir/.done ];then
touch $workdir/.done
diff --git a/scripts/rockchip/build_u-boot.sh b/scripts/rockchip/build_u-boot.sh
index 762ac28..f303489 100755
--- a/scripts/rockchip/build_u-boot.sh
+++ b/scripts/rockchip/build_u-boot.sh
@@ -19,7 +19,7 @@ help()
default_param() {
board=firefly-rk3399
- workdir=$(pwd)/build
+ workdir=$cur_dir/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"
log_dir=$workdir/log
@@ -135,15 +135,17 @@ use_prebuild_u-boot() {
set -e
u_boot_ver="v2020.10"
+cur_dir=$(cd $(dirname $0);pwd)
default_param
local_param
parseargs "$@" || help $?
-source $workdir/../boards/${board}.conf
-
if [ ! -d $workdir ]; then
mkdir $workdir
fi
+
+source $workdir/../boards/${board}.conf
+
if [ ! -d ${log_dir} ];then mkdir -p ${log_dir}; fi
if [ ! -f $workdir/.done ];then
touch $workdir/.done
diff --git a/scripts/rockchip/gen_image-x86_64.sh b/scripts/rockchip/gen_image-x86_64.sh
index 8ebcec8..97fd960 100644
--- a/scripts/rockchip/gen_image-x86_64.sh
+++ b/scripts/rockchip/gen_image-x86_64.sh
@@ -17,8 +17,8 @@ help()
}
default_param() {
- workdir=$(pwd)/build
- bindir=$(pwd)/bin/rk3588-pack
+ workdir=$cur_dir/build
+ bindir=$cur_dir/bin/rk3588-pack
outputdir=${workdir}/$(date +'%Y-%m-%d')
name=openEuler-22.03-LTS-RK3588
rootfs_dir=${workdir}/rootfs
@@ -74,6 +74,7 @@ make_img(){
}
LOG "gen image..."
+cur_dir=$(cd $(dirname $0);pwd)
default_param
prepare_bin
prepare_img
diff --git a/scripts/rockchip/gen_image.sh b/scripts/rockchip/gen_image.sh
index 90ceb50..aaa0d35 100755
--- a/scripts/rockchip/gen_image.sh
+++ b/scripts/rockchip/gen_image.sh
@@ -18,7 +18,7 @@ help()
}
default_param() {
- workdir=$(pwd)/build
+ workdir=$cur_dir/build
outputdir=${workdir}/$(date +'%Y-%m-%d')
name=openEuler-Firefly-RK3399-aarch64-alpha1
board=firefly-rk3399
@@ -287,9 +287,14 @@ outputd(){
}
set -e
+cur_dir=$(cd $(dirname $0);pwd)
default_param
parseargs "$@" || help $?
+if [ ! -d $workdir ]; then
+ mkdir $workdir
+fi
+
source $workdir/../boards/${board}.conf
if [ ! -d ${log_dir} ];then mkdir -p ${log_dir}; fi