
想了解更多关于开源的内容,请访问:
51CTO 开源基础软件社区
https://ost.51cto.com
准备VM ubuntu虚拟机
下载ubuntu镜像:
打开阿里云镜像下载网站https://developer.aliyun.com/mirror/。
点击OS镜像:

选择发行版和版本号,点击下载。

VM虚拟机选择Ubuntu。

网络选择桥接。

硬盘需要大于20G。

虚拟机全部配置信息。

选择下载好的镜像。

一直下一步默认安装好Ubuntu并重启。
切换root:
sudo passwd root
su root下载安装SSH。
apt-get install ssh配置SSH远程登录。
vim /etc/ssh/sshd_config找到 PermitRootLogin without-password修改为PermitRootLogin yes,启动SSH服务。
/etc/init.d/ssh start在Windows电脑上远程连接虚拟机。
ssh root@192.168.3.2下载安装所需要的软件
cd /opt
## 更新源
apt update
## 下载所需要的软件
apt-get install openssh-server vim net-tools vim git curl samba samba-common python3 python3-pip git-lfs
## 下载安装Docker
curl -sSL https://get.daocloud.io/docker | sh
## 更改python软链接
ln -s /usr/bin/python3 /usr/bin/python## 设置Gitee邮箱和账号
git config --global user.name "yourusername"
git config --global user.email "your-email-address"
git config --global credential.helper store## 安装码云repo工具
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 # 应用环境变量下载OpenHarmony代码
HMDTU的硬件代码会及时适配OpenHarmony上线的最新Releases,编译HMDTU代码前请看硬件代码仓库的md文件。
OpenHarmony不同版本下载说明请看https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/Readme.md。
接下来已OpenHarmony 3.2 Release作为演示:
cd /opt
mkdir HMDTUOHCode
cd HMDTUOHCode
repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-3.2-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
bash build/prebuilts_download.sh编译下载好的OpenHarmony代码。
## 获取Docker镜像。
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
## Docker构建环境
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
## 开始编译
hb set
.
## 选择 wifiiot_hispark_pegasus@hisilicon
hb build -f准备Windows编码环境
下载安装Vscode并安装Remote SSH。

打开Windows系统的Visual Studio Code,点击:

在SSH TARGETS下,单击+。

在弹出的SSH连接命令输入框中输入“ssh username@ip_address”,其中ip_address为要连接的远程计算机的IP地址,username为登录远程计算机的帐号。

在弹出的输入框中,选择SSH configuration文件,选择默认的第一选项即可。

在SSH TARGETS中,找到远程计算机,点击

打开远程计算机。

下载安装WinSCP。
填入Ubuntu虚拟机相关SSH连接信息。

下载HMDTU硬件代码
https://gitee.com/hmdtu/harmony-code。

把在HMDTU代码加入OpenHarmony代码中
在applications/sample/wifi-iot/app中创建文件夹wl。
cd /opt/HMDTUOHCode
cd applications/sample/wifi-iot/app
mkdir wl使用WinSCP复制HMDTU代码进OpenHarmony代码。

修改applications/sample/wifi-iot/app/BUILD.gn添加编译模块。
"wl/HMNetDTU_IO1:HMNetDTU_IO1"
修改/openharmony/device/soc/hisilicon/hi3861v100/sdk_liteos/build/config/usr_config.mk文件。
## 把下面文件复制替换到usr_config.mk中
https://gitee.com/hmdtu/harmony-code/blob/master/usr_config.mkHMDTU硬件代码编译烧录
hb build -f从虚拟机下载bin文件。

打开HiBurn.exe进行烧录。
HiBurn.exe文件下载地址:
https://gitee.com/hmdtu/harmony-code/blob/master/HiBurn.zip。

重启HMDTU就可以下载程序了。
想了解更多关于开源的内容,请访问:
51CTO 开源基础软件社区
https://ost.51cto.com