前言:根据ubuntu2004的chroot开发环境的内容我们已经具备ubuntu2004的chroot环境了,基于此我们从零搭建OH的开发环境步骤如下
#!/bin/bash CHROOT_DIR=/data/squashfs-root/ # 挂载dev/proc/sys ! mountpoint -q /${CHROOT_DIR}/dev/ && mount -o bind /dev /${CHROOT_DIR}/dev/ ! mountpoint -q /${CHROOT_DIR}/dev/pts && mount -t devpts devpts /${CHROOT_DIR}/dev/pts ! mountpoint -q /${CHROOT_DIR}/proc/ && mount -t proc proc /${CHROOT_DIR}/proc/ ! mountpoint -q /${CHROOT_DIR}/sys/ && mount -t sysfs sys /${CHROOT_DIR}/sys/
根据此脚本可以正常进入2004的chroot环境
根据OH官网的文档,需要安装如下包
apt install default-jdk genext2fs mtd-utils scons gcc-arm-none-eabi gcc-arm-linux-gnueabi ccache apt install libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev curl python3-pip apt-get install git git-lfs
配置repo,拉取代码,安装hb脚本如下
mkdir ~/bin curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o ~/bin/repo chmod a+x ~/bin/repo pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests vim ~/.bashrc # 编辑环境变量 export PATH=~/bin:$PATH # 在环境变量的最后添加一行repo路径信息 source ~/.bashrc # 应用环境变量 repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify repo sync -c repo forall -c 'git lfs pull' python3 -m pip install --user build/hb export PATH=~/.local/bin:$PATH build/prebuilts_download.sh
repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-4.0-Release --no-repo-verify -g ohos:standard repo sync -c repo forall -c 'git lfs pull'
./build.sh --product-name rk3568 --ccache --no-prebuilt-sdk
build/prebuilts_download.sh ./build.sh --product-name dayu210 --ccache
out/rk3568/packages/phone/images/