更新交叉编译工具链,修复跨架构构建
This commit is contained in:
parent
e243f3edf5
commit
9f43ee92bc
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@
|
||||
/scripts/boot
|
||||
/scripts/rootfs*
|
||||
/scripts/img
|
||||
/scripts/build
|
||||
|
||||
@ -237,3 +237,16 @@
|
||||
1. -d, --docker DOCKER_FILE
|
||||
|
||||
Docker 镜像的 URL 或者路径, 默认为 `https://repo.openeuler.org/openEuler-20.03-LTS-SP1/docker_img/aarch64/openEuler-docker.aarch64.tar.xz`。使用该默认参数时,脚本会自动下载 openEuler 20.03 LTS SP1 的 Docker 镜像,并导入本机系统中。
|
||||
|
||||
使用 Docker 构建镜像支持在不同的操作系统(例如 Ubuntu、Fedora)以及不同的架构(x86_64)上构建树莓派镜像,经过测试的版本构建命令举例如下,其他版本待测试:
|
||||
|
||||
```
|
||||
sudo bash build.sh \
|
||||
--board raspberrypi \
|
||||
-n openEuler-24.03-LTS-RaspberryPi-aarch64-alpha1 \
|
||||
-k https://gitee.com/openeuler/raspberrypi-kernel.git \
|
||||
-b OLK-6.6 \
|
||||
-c bcm2712_defconfig \
|
||||
-r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo \
|
||||
-s headless
|
||||
```
|
||||
@ -323,7 +323,51 @@
|
||||
|
||||
2. 使用 x86_64 的主机进行构建时的注意事项:
|
||||
|
||||
- 由于 openEuler x86_64 软件仓库没有交叉编译工具链,在使用 x86_64 进行构建时,需要从 [Firefly 的 Gitlab 仓库](https://gitlab.com/firefly-linux/prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.git)下载交叉编译工具链,请确保网络状态良好。
|
||||
(1) 由于 openEuler x86_64 软件仓库没有交叉编译工具链,在使用 x86_64 进行构建时,需要使用 [openEuler Embedded Toolchains](https://gitee.com/openeuler/yocto-meta-openeuler/releases/tag/toolchains-v0.1.8) 交叉编译工具链。
|
||||
|
||||
- 在使用 x86_64 进行构建时,需要构建主机支持 Qemu-User-Static 的运行条件。目前使用的 Qemu-User-Static 是基于 openEuler 24.03 LTS 预构建的软件包,使用其他版本跨架构构建时可能会出现问题。openEuler 软件仓库暂时还没有引进该软件包,目前正在将该软件包添加到 openEuler 软件仓库。
|
||||
(2) 在使用 x86_64 进行构建时,需要构建主机支持 Qemu-User-Static 的运行条件。目前使用的 Qemu-User-Static 是基于 openEuler 24.03 LTS 预构建的软件包,使用其他版本跨架构构建时可能会出现问题。openEuler 软件仓库暂时还没有引进该软件包,目前正在将该软件包添加到 openEuler 软件仓库。
|
||||
|
||||
(3) 本框架支持在不同的操作系统(例如 Ubuntu、Fedora)以及不同的架构(x86_64)上构建 openEuler,经过测试的目标开发板及构建命令举例如下,其他开发板型号待测试:
|
||||
|
||||
- Rockchip: Firefly ROC-RK3588S-PC
|
||||
|
||||
```
|
||||
sudo bash build-image-docker.sh \
|
||||
--board firefly-roc-rk3588s-pc \
|
||||
-d https://repo.openeuler.org/openEuler-22.03-LTS-SP3/docker_img/aarch64/openEuler-docker.aarch64.tar.xz \
|
||||
-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
|
||||
```
|
||||
|
||||
- Allwinner: Orange Pi Zero 2
|
||||
|
||||
```
|
||||
sudo bash build-image-docker.sh \
|
||||
--board orangepi-zero2 \
|
||||
-d https://repo.openeuler.org/openEuler-22.03-LTS-SP3/docker_img/aarch64/openEuler-docker.aarch64.tar.xz \
|
||||
-n openEuler-24.03-LTS-OrangePi-Zero2-aarch64-alpha1 \
|
||||
-k https://gitee.com/openeuler/allwinner-kernel.git \
|
||||
-b openEuler-24.03-LTS \
|
||||
-c openeuler_allwinner_defconfig \
|
||||
-r https://gitee.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo \
|
||||
-s headless
|
||||
```
|
||||
|
||||
- Phytium: Phytium Pi 4GB
|
||||
|
||||
```
|
||||
sudo bash build-image-docker.sh \
|
||||
--board phytiumpi-4gb \
|
||||
-d https://repo.openeuler.org/openEuler-22.03-LTS-SP3/docker_img/aarch64/openEuler-docker.aarch64.tar.xz \
|
||||
-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
|
||||
```
|
||||
|
||||
|
||||
@ -156,7 +156,8 @@ if [ ! -d ${workdir} ]; then
|
||||
fi
|
||||
|
||||
# Firefly Toolchain Repo
|
||||
aarch64_toolchain_bin_repo="https://gitlab.com/firefly-linux/prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.git"
|
||||
aarch64_toolchain_base_url="https://gitee.com/openeuler/yocto-meta-openeuler/releases/download"
|
||||
aarch64_toolchain_verson="toolchains-v0.1.8"
|
||||
|
||||
host_arch=$(arch)
|
||||
|
||||
@ -177,8 +178,25 @@ else
|
||||
oe_deppkg_install
|
||||
if [[ "${host_arch}" == "x86_64" && "${arch}" == "arm64" ]];then
|
||||
LOG "Cloning linux arm64 cross compile toolchain for x86_64..."
|
||||
if [ -d ${workdir}/aarch64-toolchain ];then rm -rf ${workdir}/aarch64-toolchain; fi
|
||||
git clone --depth=1 ${aarch64_toolchain_bin_repo} ${workdir}/aarch64-toolchain
|
||||
if [[ -d ${workdir}/openeuler_gcc_arm64le && ! -f ${workdir}/openeuler_gcc_arm64le/.done ]];then
|
||||
rm -rf ${workdir}/openeuler_gcc_arm64le
|
||||
fi
|
||||
|
||||
cd ${workdir}
|
||||
|
||||
i=$((1))
|
||||
get_toolchain() {
|
||||
local block="$(printf $1)"
|
||||
echo "${aarch64_toolchain_base_url}/${aarch64_toolchain_verson}/${block}_openeuler_gcc_arm64le.tar.gz"
|
||||
}
|
||||
while wget "$(get_toolchain "$i")"; do
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
cat *_openeuler_gcc_arm64le.tar.gz >> openeuler_gcc_arm64le.tar.gz
|
||||
tar -zxvf openeuler_gcc_arm64le.tar.gz
|
||||
|
||||
rm *openeuler_gcc_arm64le.tar.gz
|
||||
else
|
||||
LOG "You are running this script on a ${host_arch} mechine, progress...."
|
||||
fi
|
||||
|
||||
@ -172,9 +172,6 @@ make_kernel(){
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "${cross_compile}" ]; then
|
||||
export CROSS_COMPILE=${cross_compile}
|
||||
fi
|
||||
make distclean
|
||||
kernel_ver=""
|
||||
if [ "x${board}" == "xraspberrypi" ]; then
|
||||
@ -217,9 +214,6 @@ install_kernel() {
|
||||
mkdir -p ${workdir}/kernel/kernel-modules
|
||||
pushd ${workdir}/kernel
|
||||
|
||||
if [ ! -z "${cross_compile}" ]; then
|
||||
export CROSS_COMPILE=${cross_compile}
|
||||
fi
|
||||
if [ "x${board}" == "xraspberrypi" ]; then
|
||||
mkdir -p ${boot_dir}/overlays
|
||||
if [ -z "${kernel_defconfig}" ] && [ "x${branch}" == "xOLK-6.6" ]; then
|
||||
@ -311,6 +305,8 @@ default_param
|
||||
local_param
|
||||
parseargs "$@" || help $?
|
||||
|
||||
source ${cur_dir}/boards/${board}.conf
|
||||
|
||||
rockchip_bootargs="earlyprintk console=ttyS2,1500000 rw root=UUID=614e0000-0000-4b53-8000-1d28000054a9 rootfstype=ext4 init=/sbin/init rootwait"
|
||||
phytium_bootargs="console=ttyAMA1,115200 earlycon=pl011,0x2800d000 rw root=UUID=614e0000-0000-4b53-8000-1d28000054a9 rootfstype=ext4 rootwait cma=256m"
|
||||
allwinner_bootargs="console=tty0 console=ttyS0,115200 rw root=UUID=614e0000-0000-4b53-8000-1d28000054a9 rootfstype=ext4 rootwait earlycon clk_gnore_unused"
|
||||
@ -329,12 +325,11 @@ elif [ "x${board}" != "xraspberrypi" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cross_compile=""
|
||||
host_arch=$(arch)
|
||||
|
||||
if [[ "${host_arch}" == "x86_64" && "${arch}" == "arm64" ]];then
|
||||
LOG "You are running this script on a ${host_arch} mechine, use cross compile...."
|
||||
cross_compile="${workdir}/aarch64-toolchain/bin/aarch64-none-linux-gnu-"
|
||||
export CROSS_COMPILE="${workdir}/openeuler_gcc_arm64le/bin/aarch64-openeuler-linux-gnu-"
|
||||
else
|
||||
LOG "You are running this script on a ${host_arch} mechine, progress...."
|
||||
fi
|
||||
@ -343,8 +338,6 @@ if [ ! -d ${workdir} ]; then
|
||||
mkdir ${workdir}
|
||||
fi
|
||||
|
||||
source ${cur_dir}/boards/${board}.conf
|
||||
|
||||
if [ ! -d ${log_dir} ];then mkdir -p ${log_dir}; fi
|
||||
if [ ! -f ${workdir}/.done ];then
|
||||
touch ${workdir}/.done
|
||||
|
||||
@ -107,9 +107,6 @@ build_u-boot() {
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -z "${cross_compile}" ]; then
|
||||
export CROSS_COMPILE=${cross_compile}
|
||||
fi
|
||||
make ARCH=arm ${ubootconfig}
|
||||
make ARCH=arm -j${make_cores}
|
||||
make ARCH=arm u-boot.itb -j${make_cores}
|
||||
@ -150,12 +147,13 @@ default_param
|
||||
local_param
|
||||
parseargs "$@" || help $?
|
||||
|
||||
cross_compile=""
|
||||
source ${cur_dir}/boards/${board}.conf
|
||||
|
||||
host_arch=$(arch)
|
||||
|
||||
if [[ "${host_arch}" == "x86_64" && "${arch}" == "arm64" ]];then
|
||||
LOG "You are running this script on a ${host_arch} mechine, use cross compile...."
|
||||
cross_compile="${workdir}/aarch64-toolchain/aarch64-none-linux-gnu-"
|
||||
export CROSS_COMPILE="${workdir}/openeuler_gcc_arm64le/aarch64-openeuler-linux-gnu-"
|
||||
else
|
||||
LOG "You are running this script on a ${host_arch} mechine, progress...."
|
||||
fi
|
||||
@ -164,8 +162,6 @@ if [ ! -d ${workdir} ]; then
|
||||
mkdir ${workdir}
|
||||
fi
|
||||
|
||||
source ${cur_dir}/boards/${board}.conf
|
||||
|
||||
if [ ! -d ${log_dir} ];then mkdir -p ${log_dir}; fi
|
||||
if [ ! -f ${workdir}/.done ];then
|
||||
touch ${workdir}/.done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user