系统安装
安装Ubuntu Server
Ubuntu Server 20.04.3 LTS 安装图解
必备工具
NODEJS
方式1(目前失败)
# 安装nodejs 12 通过 snap (https://snapcraft.io/node)
sudo snap install node --channel=12/stable --classic
# 安装 hpm (使用snap安装的nodejs会报错 cannot create user data directory: cannot create "/nonexistent/snap/node/5480": mkdir /nonexistent: permission denied)
sudo npm install -g @ohos/hpm-cli --registry=https://registry.npmmirror.com
方式2
https://github.com/Schniz/fnm#using-a-script-macoslinux
$ sudo apt install unzip
$ curl -fsSL https://fnm.vercel.app/install | bash
# 查询 node 版本
$ fnm list-remote
# 增加 node-dist-mirror 加速下载
$ fnm install v12.12.0 --node-dist-mirror http://npm.taobao.org/mirrors/node/
$ npm install -g @ohos/hpm-cli --registry=https://registry.npmmirror.com
make
$ sudo apt install make
gcc
$ sudo apt install gcc
python
$ sudo apt install python-is-python3
scons
#
$ sudo apt install scons
构建准备
mkdir bearpi
cd bearpi
hpm init -t default
hpm i @bearpi/bearpi_hm_nano
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
开始构建
$ hpm dist