BPI-RV2 RISC-V开源路由器之开发环境搭建及编译
背景
BPI-RV2 RISC-V开源路由器相关的资料文档很少,需要自己慢慢摸索。
前面已经下载了开发板的BSP,今天来搭建下开发环境,并手动编译下openwrt的ipk试试。
该BSP其实就是一套openwrt的构建环境。
开发环境搭建
构建 openwrt 可以在不同的系统下完成,比如 Linux, BSD 或 MacOSX。
安装依赖包
不同的系统发行版可能需要安装不同的包,具体可参考openwrt的官方文档: https://openwrt.org/docs/guide-developer/build-system/install-buildsystem
这里我使用的是 WSL:Ubuntu 20.04 LTS。
所以需要安装以下的包:
sudo apt update
sudo apt install build-essential clang flex bison g++ gawk
gcc-multilib g++-multilib gettext git libncurses-dev libssl-dev
python3-distutils python3-setuptools rsync swig unzip zlib1g-dev file wget
### 更新 feeds
进入 openwrt 仓库后,首先需要更新软件包列表 feeds,它是在 OpenWrt 中共用位置的包的集合。
运行以下命令即可更新内置软件包列表并链接到编译工具中:
```shell
cd BPI-RV2-SF21H8898-OPENWRT-BSP/
# obtain all the latest package definitions defined in feeds.conf / feeds.conf.default
./scripts/feeds update -a
# install symlinks for all obtained packages into package/feeds/
./scripts/feeds install -a
因为很多东西都在github等其他国外的服务器上,所以这里如果没搭梯子,需要花费很长的时间,而且可能还不会成功。
于是参考了 https://www.cnblogs.com/thammer/p/13531058.html 使用了别人国内的镜像仓库,修改默认的 feeds.conf.default 文件:
[url=home.php?mod=space&uid=1999721]@@[/url] -1,4 +1,4 @@
src-git-full packages https://git.openwrt.org/feed/packages.git;openwrt-22.03
-src-git-full luci https://git.openwrt.org/project/luci.git;openwrt-22.03
+src-git-full luci https://gitee.com/openwrt-mirror/luci.git;openwrt-22.03
src-git-full routing https://git.openwrt.org/feed/routing.git;openwrt-22.03
src-git-full telephony https://git.openwrt.org/feed/telephony.git;openwrt-22.03
编译
选择并确认配置:
# select your preferred configuration for the toolchain, target system & firmware packages.
make menuconfig
这里BSP默认已经配置好,默认的如下,然后根据自己的需要增减相关配置(比如不同的包等):

开始编译:
# build your firmware. This will download all sources,
# build the cross-compile toolchain and then cross-compile the GNU/Linux kernel
# & all chosen applications for your target system.
make -j8

剩下就是耐心等待,修复一些异常了。
|