Build Bianbu OS 1.0
The Bianbu 1.0 OS Image is based on Ubuntu 23.10.
Compilation environment
The recommended host machine is Ubuntu 20.04/22.04, with docker ce and qemu-user-static (8.0.4, customized version, Vector 1.0 support is enabled by default) installed.
docker
For docker ce installation, please refer to https://docs.docker.com/engine/install/.
qemu
-
Uninstall binfmt-support
The customized version of qemu-user-static conflicts with binfmt-support because the
/etc/init.d/binfmt-supportprovided by binfmt-support is a traditional SysVinit startup script, while the/lib/systemd/system/systemd-binfmt.serviceprovided by the customized version of qemu-user-static is a systemd service unit file./etc/init.d/binfmt-supportwill be executed later than/lib/systemd/system/systemd-binfmt.service, resulting in overwriting systemd settings.sudo apt-get purge binfmt-support -
Download the customized version of qemu
wget https://archive.spacemit.com/qemu/qemu-user-static_8.0.4%2Bdfsg-1ubuntu3.23.10.1_amd64.deb -
Install a customized version of qemu
sudo dpkg -i qemu-user-static_8.0.4+dfsg-1ubuntu3.23.10.1_amd64.deb -
Register qemu-user-static to the kernel so that the entire system (including containers) can directly execute riscv binaries
sudo systemctl start systemd-binfmt.service -
Verify that qemu-user-static is successfully registered
Download the test program:
wget https://archive.spacemit.com/qemu/rvvAdd executable permissions to the test program:
chmod a+x rvvExecute the test program:
./rvvThe following message appears, indicating that the registration is successful.
helloworld
spacemit
Prepare base rootfs
1. Create a working directory
mkdir ~/bianbu-workspace
2. Create and start the container
docker run --privileged -itd -v ~/bianbu-workspace:/mnt --name build-bianbu-rootfs ubuntu:24.04
3. Entering the container
docker exec -it -w /mnt build-bianbu-rootfs bash
4. Install basic tools
apt-get update
apt-get -y install wget uuid-runtime
5. Configure environment variables
export BASE_ROOTFS_URL=https://archive.spacemit.com/bianbu-base/bianbu-base-23.10-base-riscv64.tar.gz
export BASE_ROOTFS=$(basename "$BASE_ROOTFS_URL")
export TARGET_ROOTFS=rootfs
6. Download the base file system
wget $BASE_ROOTFS_URL
7. Extract to the specified directory
mkdir -p $TARGET_ROOTFS && tar -zxpf $BASE_ROOTFS -C $TARGET_ROOTFS
8. Mount some system resources into rootfs
mount -t proc /proc $TARGET_ROOTFS/proc
mount -t sysfs /sys $TARGET_ROOTFS/sys
mount -o bind /dev $TARGET_ROOTFS/dev
mount -o bind /dev/pts $TARGET_ROOTFS/dev/pts