VMware,Ubuntu编译OpenHarmony3.0

下载文件与工具软件:

下载虚拟机VMware Workstation 下载地址:

下载Ubuntu 下载地址 文件名:ubuntu-20.04.3-desktop-amd64.iso

OpenHarmony3.0 LTS源码下载,使用获取方式3:从镜像站点获取。 下载地址: 下载文件名:code-v3.0-LTS.tar.gz,7,521,572,740 字节

编译步骤:

1 使用虚拟机安装Ubuntu。硬盘容量70GB。

2 修改Ubuntu的下载源

选择Software&Update

将Download from改为 china mirrors.huaweicloud.com

运行SoftwareUpdater

等待检查更新完成。

点击 “Remind Me Later”,关闭SoftwareUpdater。

3 将ubuntu shell 改为 bash sudo dpkg-reconfigure dash 选择<No>

查看shell : ls -l /bin/sh lrwxrwxrwx 1 root root 4 10月 15 09:15 /bin/sh -> bash

4 安装ssh server 安装命令: sudo apt-get install openssh-server 启动ssh server: sudo /etc/init.d/ssh start Starting ssh (via systemctl): ssh.service.

如果只是使用虚拟机的命令行,则不需要安装ssh server。

5 安装依赖工具 sudo apt-get install gcc-9-arm-linux-gnueabi

sudo apt-get update && sudo apt-get install gnutls-bin gcc-arm-linux-gnueabi build-essential fakeroot dpkg-dev git-lfs build-essential gcc g++ make zlib* zip xsltproc x11proto-core-dev wget vim unzip u-boot-tools tzdata texinfo ssh scons python3-minimal python3-setuptools python3-pip python3-distutils python3-apt python3.8-distutils npm nfs-kernel-server mtools mtd-utils m4 locales libxml2-utils libx11-dev libreadline-dev libgl1-mesa-dev libffi* libc6-dev-x32 libc6-dev-i386 lib32z-dev lib32ncurses5-dev gperf gnupg git-lfs git-core g++ flex dosfstools default-jre default-jdk curl ccache build-essential bison binutils bc genext2fs ruby

6 复制源码文件: mkdir ~/harmony && cd ~/harmony

使用复制粘贴将code-v3.0-LTS.tar.gz复制到~/harmony

解压文件:tar -xvf code-v3.0-LTS.tar.gz cd code-v3.0-LTS/OpenHarmony

7 预编译工具下载 ./build/prebuilts_download.sh

预编译下载完成后, 会多出一个OpenHarmony_2.0_canary_prebuilts目录。

8 执行编译

回到~/harmony/code-v3.0-LTS/OpenHarmony目录,然后执行编译命令: ./build.sh --product-name Hi3516DV300

经过几小时的等待后,编译完成。

镜像文件保存在~/harmony/code-v3.0-LTS/OpenHarmony/out/ohos-arm-release/packages/phone/images目录下:

经验分享 程序员 微信小程序 职场和发展