Bianbu 2.1/2.2 ROOTFS Creation
Environment Requirements
It is recommended to use Ubuntu 20.04/22.04 as the host system, with Docker CE and a customized version of qemu-user-static (version 8.0.4, with Vector 1.0 support enabled by default) installed.
Docker
For docker ce installation, refer to https://docs.docker.com/engine/install/.
QEMU
-
Remove
binfmt-supportThe customized
qemu-user-staticconflicts withbinfmt-supportdue to:binfmt-supportuses a legacy SysVinit script:/etc/init.d/binfmt-support- The customized
qemu-user-staticrelies on a systemd unit:/lib/systemd/system/systemd-binfmt.service
Since the SysVinit script runs after the systemd service, it can override the systemd settings, causing conflicts.
To avoid this, remove
binfmt-support:sudo apt-get purge binfmt-support -
Download the customized qemu
wget https://archive.spacemit.com/qemu/qemu-user-static_8.0.4%2Bdfsg-1ubuntu3.23.10.1_amd64.deb -
Install the customized qemu
sudo dpkg -i qemu-user-static_8.0.4+dfsg-1ubuntu3.23.10.1_amd64.deb -
Register
qemu-user-staticwith the kernel, so the system (including containers) can directly execute RISC-V binaries:sudo systemctl restart systemd-binfmt.service -
Verify if
qemu-user-staticis registered successfullywget https://archive.spacemit.com/qemu/rvv
chmod a+x rvv
./rvvOutput like the following indicates success:
helloworld
spacemit
Prepare Base ROOTFS
-
Create a working directory
mkdir ~/bianbu-workspace -
Create and start the container
docker run --privileged -itd -v ~/bianbu-workspace:/mnt --name build-bianbu-rootfs harbor.spacemit.com/bianbu/bianbu:latest -
Enter the container
docker exec -it -w /mnt build-bianbu-rootfs bash -
Install basic tools
apt-get update
apt-get -y install wget uuid-runtime -
Set environment variables
-
For Version 2.1
export BASE_ROOTFS_URL=https://archive.spacemit.com/bianbu-base/bianbu-base-24.04-base-riscv64.tar.gz
export BASE_ROOTFS=$(basename "$BASE_ROOTFS_URL")
export TARGET_ROOTFS=rootfs -
For Version 2.2
export BASE_ROOTFS_URL=https://archive.spacemit.com/bianbu-base/bianbu-base-24.04.1-base-riscv64.tar.gz
export BASE_ROOTFS=$(basename "$BASE_ROOTFS_URL")
export TARGET_ROOTFS=rootfs
-
-
Download the base rootfs
wget $BASE_ROOTFS_URL -
Extract to a specified directory
mkdir -p $TARGET_ROOTFS && tar -zxpf $BASE_ROOTFS -C $TARGET_ROOTFS -
Mount system resources into the 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
Essential Configurations
Configure Repository Sources
-
Set environment variables
export REPO="archive.spacemit.com/bianbu" -
Configure
sources.sources-
For Version 2.1
cat <<EOF | tee $TARGET_ROOTFS/etc/apt/sources.list.d/bianbu.sources
Types: deb
URIs: https://$REPO/
Suites: noble/snapshots/v2.1 noble-security/snapshots/v2.1 noble-updates/snapshots/v2.1 noble-porting/snapshots/v2.1 noble-customization/snapshots/v2.1 bianbu-v2.1-updates
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/bianbu-archive-keyring.gpg
EOF -
For Version 2.2
cat <<EOF | tee $TARGET_ROOTFS/etc/apt/sources.list.d/bianbu.sources
Types: deb
URIs: https://$REPO/
Suites: noble/snapshots/v2.2 noble-security/snapshots/v2.2 noble-updates/snapshots/v2.2 noble-porting/snapshots/v2.2 noble-customization/snapshots/v2.2 bianbu-v2.2-updates
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/bianbu-archive-keyring.gpg
EOF
-
Configure DNS
echo "nameserver 8.8.8.8" >$TARGET_ROOTFS/etc/resolv.conf
Install Hardware-Related Packages
chroot $TARGET_ROOTFS /bin/bash -c "apt-get update"
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y --allow-downgrades upgrade"
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y --allow-downgrades install initramfs-tools"
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y --allow-downgrades install bianbu-esos img-gpu-powervr k1x-vpu-firmware k1x-cam spacemit-uart-bt spacemit-modules-usrload opensbi-spacemit u-boot-spacemit linux-generic"
Install Metapackages
Different variants have different metapackages:
- Minimal:
bianbu-minimal - Desktop:
bianbu-desktop,bianbu-desktop-zh,bianbu-desktop-en,bianbu-desktop-minimal-en,bianbu-standard,bianbu-development - NAS:
bianbu-nas - Desktop Lite:
bianbu-desktop-lite
Desktop, Desktop Lite, and NAS variants are all based on Minimal. It is recommended to install the Minimal meta-package first, then install the corresponding meta-packages.
- Minimal variant:
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y --allow-downgrades install bianbu-minimal"
- Desktop variant:
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y --allow-downgrades install bianbu-minimal"
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y --allow-downgrades install bianbu-desktop bianbu-desktop-zh bianbu-desktop-en bianbu-desktop-minimal-en bianbu-standard bianbu-development"
- Desktop Lite variant:
Since the user setup program is not yet fully adapted, you need to manually create a user to enter the desktop environment.
Note: This variant is only supported in Bianbu 2.2.
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y --allow-downgrades install bianbu-minimal"
chroot $TARGET_ROOTFS /bin/bash -c "apt-get -y install adduser"
chroot $TARGET_ROOTFS /bin/bash -c "adduser --gecos \"\" --disabled-password bianbu"
chroot $TARGET_ROOTFS /bin/bash -c "echo bianbu:bianbu | chpasswd"
chroot $TARGET_ROOTFS /bin/bash -c "usermod -aG adm,cdrom,sudo,plugdev bianbu"
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y --allow-downgrades install bianbu-desktop-lite"
Tip: After installing all packages, you can clean up the cache to reduce the final firmware size:
chroot $TARGET_ROOTFS /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get clean"