OpenHarmonyOS for Hi3516dv300

mkdir openHarmony
cd openHarmony
sudo snap install docker

# 获取docker镜像
sudo docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.1

# 运行镜像
sudo docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.1

二、更新环境

apt update -y
apt install -y git
apt install -y git-lfs
apt install -y ccache
apt install -y tzdata
apt install -y python3.8
rm /usr/bin/python /usr/bin/python3
ln -s /usr/bin/python3.8 /usr/bin/python
ln -s /usr/bin/python3.8 /usr/bin/python3
apt-get install python3-pip
pip3 install --upgrade pip

# 时区设置
TIME_ZONE=Asia/Shanghai
ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone

# git设置
git config --global user.name "test"
git config --global user.email "test@163.com"
git config --global credential.helper store

# repo安装
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
cd /home/openharmony
echo y | repo init -u https://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/lite

四、编译镜像

# 编译依赖二进制包准备
../scripts/prepare.sh

# 启动编译:支持摄像头+屏幕
./build.sh --product-name Hi3516DV300 --ccache
# 出现以下报错信息,执行下面指令更新预编译文件
bash ./build/prebuilts_download.sh
# 再启动编译,出现以下打印信息,表示编译成功
# 查看编译结果:
ls -l out/ohos-arm-release/packages/phone/images/
经验分享 程序员 微信小程序 职场和发展