下载和编译
以下文档基于ubuntu22.04描述.
环境准备
安装依赖
sudo apt install build-essential clang flex bison g++ gawk \
gcc-multilib g++-multilib gettext git libncurses-dev libssl-dev \
python3-distutils rsync unzip zlib1g-dev file wget jq device-tree-compiler
下载代码
代码仓库分为 bl-v1.0.y,bl-v2.0.y 两个分支,分别对应 linux-6.1、linux-6.6。后续主要维护 bl-v2.0.y 分支。
git clone https://gitee.com/bianbu-linux/openwrt.git -b bl-v2.0.y
拉取feeds
首次或想更新包时需要运行以下命令。更新包会从 OpenWrt 官网等下载压缩包,请确保网络可用。如果出现某些包下载失败,可重复执行命令
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -f -p spacemit_openwrt_feeds -a
./scripts/feeds install -a
固件编译
以下编译命令的可选参数V=s为输出详细日志。目前提供两种方案的编译启动。
cp feeds/spacemit_openwrt_feeds/spacemit_k1_defconfig .config
make -j12 V=s
固件位于bin/targets/spacemit/DEVICE_debX/*.zip
清理
- 全部清理命令,会把
bin、build_dir、staging_dir、feeds、dl等目录以及.config文件都删掉,代码仓库为最原始的状态
make distclean
- 局部清理命令,会把编译输出目录
bin、build_dir、staging_dir删掉,不包含dl目录、.config文件等
make dirclean
单包编译
单编uboot
- 编译
make package/boot/uboot-spacemit/compile V=s
- 清理
make package/boot/uboot-spacemit/clean V=s
单编opensbi
- 编译
make package/boot/opensbi-spacemit/compile V=s
- 清理
make package/boot/opensbi-spacemit/clean V=s
单编linux
- 编译
make target/linux/compile V=s
- 清理
make target/linux/clean V=s
单编adb包
其他包的编译都类似一下的编译方式
- 编译
make package/utils/adb/compile V=s
- 清理
make package/utils/adb/clean V=s
烧写
固件 *.zip,使用 Titan Flasher 工具刷写至设备板载存储介质,刷机工具使用参考刷机工具使用
固件 *sdcard.img,可使用 dd 命令写至卡上,设备插卡上电即可实现卡启动
支持设备列表
- BPI-F3
- MUSE-Pi
软路由
在以上支持设备列表的板型默认开启软路由功能。系统开机后默认开启WiFi AP模式,其中:
SBC方案有线网卡eth1为lan口,eth2为wan
FAQ
内核编译链接 pthread_once 出错
基于 ubuntu 20.04 编译 openwrt 出现pthread_once的编译报错,可修改linux-*/certs/Makefile
openwrt/build_dir/target-riscv64_riscv64_musl_*/linux-spacemit_*/linux-6.1.15/certs/Makefile
最后一行改成:
HOSTLDLIBS_extract-cert = -lcrypto -pthread
如何更新uboot/opensbi/linux版本
-
openwrt跟踪
https://gitee.com/bianbu-linux的uboot/opensbi/linux仓库版本。openwrt会不定期更新该仓库的版本 -
如果需要手 动更新最新的
uboot/opensbi/linux版本,可参考一下方式- 确认 gitee 仓库的最新版本的 tar 包已经上传到
https://archive.spacemit.com/openwrt/dl/,如linux-6.1-v1.0.15.tar.xz

- 更改Makefile版本号
- 确认 gitee 仓库的最新版本的 tar 包已经上传到
diff --git a/package/boot/opensbi-spacemit/Makefile b/package/boot/opensbi-spacemit/Makefile
index d4572af253..208d2fae6d 100644
--- a/package/boot/opensbi-spacemit/Makefile
+++ b/package/boot/opensbi-spacemit/Makefile
@@ -16,7 +16,7 @@ else
PKG_NAME:=opensbi
PKG_RELEASE:=1
PKG_VERSION:=1.3
-PKG_SOURCE_VERSION:=1.0.5
+PKG_SOURCE_VERSION:=v1.0.15
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=https://archive.spacemit.com/openwrt/dl/
diff --git a/package/boot/uboot-spacemit/Makefile b/package/boot/uboot-spacemit/Makefile
index 51e6e97fb7..c69173cfa8 100644
--- a/package/boot/uboot-spacemit/Makefile
+++ b/package/boot/uboot-spacemit/Makefile
@@ -18,7 +18,7 @@ else
PKG_NAME:=uboot
PKG_RELEASE:=1
PKG_VERSION:=2022.10
-PKG_SOURCE_VERSION:=1.0.5
+PKG_SOURCE_VERSION:=v1.0.15
PKG_SOURCE:=uboot-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=https://archive.spacemit.com/openwrt/dl/
diff --git a/target/linux/spacemit/Makefile b/target/linux/spacemit/Makefile
index ac230af366..148e5a79b8 100644
--- a/target/linux/spacemit/Makefile
+++ b/target/linux/spacemit/Makefile
@@ -20,7 +20,7 @@ CONFIG_EXTERNAL_KERNEL_TREE=$(TOPDIR)/../bsp-src/linux-6.1
CONFIG_KERNEL_GIT_CLONE_URI=""
else
## download tar.xz from url.
-LINUX_VERSION_CUSTOM:=linux-6.1-1.0.5
+LINUX_VERSION_CUSTOM:=linux-6.1-v1.0.15
LINUX_SOURCE:=$(LINUX_VERSION_CUSTOM).tar.xz
LINUX_KERNEL_HASH:=skip
endif
```sh
* 更新kernel config
```sh
make kernel_menuconfig