系统环境准备:
Ubuntu系统要求:Ubuntu18.04及以上版本,内存推荐16 GB及以上。
安装对应库和环境:
sudo apt-get update
sudo apt-get install binutils binutils-dev git git-lfs gnupg flex bison
sudo apt install gperf build-essential zip curl zlib1g-dev gcc-multilib
sudo apt install g++-multilib gcc-arm-linux-gnueabi libc6-dev-i386 libc6-dev-amd64
sudo apt install lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache
sudo apt install libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8
sudo apt install python3-pip ruby genext2fs device-tree-compiler make libffi-dev e2fsprogs
sudo apt install pkg-config perl openssl libssl-dev libelf-dev libdwarf-dev u-boot-tools mtd-utils
sudo apt install cpio doxygen liblz4-tool openjdk-8-jre gcc g++ texinfo dosfstools mtools default-jre
sudo apt install default-jdk libncurses5 apt-utils wget scons python3.8-distutils tar rsync git-core
sudo apt install libxml2-dev lib32z-dev grsync xxd libglib2.0-dev libpixman-1-dev kmod jfsutils reiserfsprogs
sudo apt install xfsprogs squashfs-tools pcmciautils quota ppp libtinfo-dev libtinfo5 libncurses5-dev libncursesw5
sudo apt install libstdc++6 gcc-arm-none-eabi vim ssh locales
将python 3.8设置为默认python版本。查看python 3.8的位置:
which python3.8
将python和python3切换为python3.8:
sudo update-alternatives --install /usr/bin/python python {python3.8 路径} 1 #{python3.8 路径}为上一步查看的python3.8的位置
sudo update-alternatives --install /usr/bin/python3 python3 {python3.8 路径} 1 #{python3.8 路径}为上一步查看的python3.8的位置
安装DevEcoTool
通过Windows系统远程访问Ubuntu环境进行烧录等操作,需要先在Windows和Ubuntu下分别安装DevEco Device Tool。
说明:DevEco Device Tool 是OpenHarmony的一站式开发工具,支持源码开发、编译、烧录,调测等,本文主要用其远端链接Ubuntu环境进行烧录和运行。
安装Windows和Linux版本:https://device.harmonyos.com/cn/develop/ide#download
获取源码
#step1 准备工作
sudo apt-get update
sudo apt-get install git git-lfs
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o /usr/local/bin/repo #如果没有权限,可下载至其他目录,并将其配置到环境变量中
chmod a+x /usr/local/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
#step2 获取源码
repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
编译
#step1 执行prebuild
bash build/prebuilts_download.sh
#step2 安装编译工具
pip3 install --user build/lite
vim ~/.bashrc
export PATH=~/.local/bin:$PATH
source ~/.bashrc
hb set (选择Hi3516DV300)
hb build -f
参考文档:
https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-standard-env-setup.md#https://gitee.com/link?target=https%3A%2F%2Fdevice.harmonyos.com%2Fcn%2Fide%23download
网友评论