01
环境搭建
①搭建 ubuntu 环境,下载必须要的软件和 Docker:
sudo apt-get install openssh-server vim net-tools openssh-server vim git curl samba samba-common python3 python3-pip git-lfs
curl -sSL https://get.daocloud.io/docker | sh
②配置 git:
git config --global user.name “yourname”
git config --global user.email “your-email-address”
git config --global credential.helper store
③装 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
④下载代码:
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c ‘git lfs pull’
02
编译
①下载 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
在源码的根目录执行预处理脚本:
。./scripts/prepare.sh
编译代码:
。/build.sh --product-name Hi3516DV300
编译所生成的文件都归档在 out/ohos-arm-release/ 目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。
②使用 samba 方便写代码:
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 ## 重启
03
烧录
①烧录前的准备
烧录之前需要设置 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
②开始烧录
打开 HITOOL,选择 EMMC,然后选择之前编译出来的 XML 文件,点击烧录开始烧录。
责任编辑:haq
全部0条评论
快来发表一下你的评论吧 !