OpenHarmony2.0 编译烧录

视频教程:

视频链接:https://www.bilibili.com/video/BV1G44y167Y2

鸿蒙2.0开发环境搭建教程

视频链接:https://www.bilibili.com/video/BV1to4y1y76W 

手机鸿蒙2.0编译烧录教程

 

WSL编译烧录教程

1.环境搭建

1.1 搭建ubuntu环境,下载必须要的软件和Docker

sudo apt-get install openssh-server vim net-tools vim git curl samba samba-common python3 python3-pip git-lfs

curl -sSL https://get.daocloud.io/docker | sh

1.2 配置git

git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store

1.3 装repo

curl 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://repo.huaweicloud.com/repository/pypi/simple requests

1.4 下载代码

repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
2.编译

2.1 下载docker镜像并运行编译代码

2.1.1 手机鸿蒙

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

在源码的根目录执行预处理脚本

../scripts/prepare.sh

编译代码

./build.sh --product-name Hi3516DV300

编译所生成的文件都归档在out/ohos-arm-release/目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。

2.1.2 liteos_a & liteos_m

docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.4

docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.4

HI3516编译选择ipcamera_hispark_taurus HI3518编译选择ipcamera_hispark_aries HI3861编译选择wifiiot_hispark_pegasus

root@05735e8fc988:/home/openharmony# hb set
[OHOS INFO] Input code path: .
OHOS Which product do you need?  (Use arrow keys)

hisilicon
 ❯ ipcamera_hispark_taurus
   wifiiot_hispark_pegasus
   ipcamera_hispark_aries
root@05735e8fc988:/home/openharmony# hb build -f

 

2.2 使用samba方便写代码(如果使用WSL忽略这步)

mm@mm-virtual-machine:~$ sudo vim /etc/samba/smb.conf 
 
## 在最后面添加
 
[work]
    comment = samba home directory
    path = /home/mm/
    public = yes
    browseable = yes
    public = yes
    writeable = yes
    read only = no
    valid users = mm
    create mask = 0777
    directory mask = 0777
    #force user = nobody
    #force group = nogroup
    available = yes
 
 
mm@mm-virtual-machine:~$ sudo smbpasswd -a mm     ## 设置密码 mm是名字
mm@mm-virtual-machine:~$ sudo service smbd restart     ## 重启
3.烧录

3.1 烧录前的准备

烧录之前需要设置root,如果设置过了就不需要设置了

setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; go 0x80000000";
setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rootaddr=10M rootsize=20M rw";
saveenv
reset

3.2 开始烧录

3.2.1 烧录手机鸿蒙

打开HITOOL,选择EMMC,然后选择之前编译出来的XML文件,点击烧录开始烧录

OpenHarmony2.0 编译烧录

 3.2.2 烧录HI3516

 

 3.2.3 烧录HI3861

 

 

OpenHarmony2.0 编译烧录

OpenHarmony2.0 编译烧录

OpenHarmony2.0 编译烧录

 

上一篇:OpenHarmony轻量系统开发【3】代码编译和烧录


下一篇:《HarmonyOS实战——前端开发华为鸿蒙系统应用 OpenHarmony JS》