系统安装
安装Ubuntu Server
Ubuntu Server 20.04.3 LTS 安装图解
必备工具
make
$ sudo apt install make
gcc
$ sudo apt install gcc
python
$ sudo apt install python-is-python3
scons
#
$ sudo apt install scons
mtools
# mcopy: command not found
$ sudo apt install mtools
下载mkimage.stm32
下载地址: 详见官方文档
# mkimage.stm32: not found
$ sudo mv mkimage.stm32 /usr/local/sbin/
# mkimage.stm32: Permission denied
$ sudo chmod +x /usr/local/sbin/mkimage.stm32
Java
# No such file or directory: 'java'
sudo apt install openjdk-11-jre-headless
构建准备
$ mkdir -pv bearpi-micro
$ cd bearpi-micro
$ git clone https://gitee.com/bearpi/bearpi-hm_micro_small.git
$ cd bearpi-hm_micro_small
python depend
$ sudo apt install python3-pip
# No module named 'Crypto'
$ pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pycrypto
# No module named 'ecdsa'
$ pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple ecdsa
# 鸿蒙构建指令(hb)
$ pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple ohos-build
开始构建
# 进入源码目录,构建配置
$ hb set
# 输入 . 标识当前目录
# 然后输入确定 确定编译的名称(bearpi_hm_micro)
# 执行构建命令 (耗时比较久 2000多个文件包需要编译) -f (强制重头构建)
$ hb build -t notest --tee -f
# 安装过程剖析
## 1. 先安装llvm
## 2. 编译遇到问题(mkimage.stm32) 查看上面
## 3. No such file or directory: 'java'
## 4. arm-linux-ohoseabi-strip: not found 切换 sh 为 bash
## ine 89: mcopy: command not found