Documentation¶
The following links contain the “Product Brief,” “Datasheet,” and “User Manual.”
Compiling Linux Firmware¶
Note:
Builds in a container by default. To build on the host machine, configure the environment variable
export DIRECT_BUILD=1. When switching between container and host machine builds, you need to clean the output directory.A new set of commands has been added. These are incompatible with older commands. To use the new commands, delete the
env.mkfile generated by the old commands in the project root directory. You can then usemake helpto view the list of new commands. For example, you can usemake k3-buildto directly compile a specified solution.$ cd ~/k3-buildroot-sdk-1.0 $ rm -rf env.mk $ make help Buildroot Build System - Help Available solutions: aibox-k3 k3 k3_ci k3_fpga k3_plt Development Commands: make vars # Show project information make <solution>-supported # Check if solution is supported make <solution>-config # Apply solution defconfig make <solution>-menuconfig # Configure buildroot for solution make <solution>-linux-menuconfig # Configure Linux kernel for solution make <solution>-uboot-menuconfig # Configure U-Boot for solution make <solution>-busybox-menuconfig # Configure BusyBox for solution make <solution>-build # Build specified solution make <solution>-pkg PKG=<package> # Build specified package for solution make <solution>-shell # Enter build container for solution make <solution>-source # Download all source packages for solution make <solution>-clean # Clean solution build artifacts make <solution>-cleanbuild # Clean and rebuild solution make build-docker-image # Build Docker image make update-docker-image # Update Docker image Quick Start: Run 'make <solution>-build' to get started, e.g.: make k3-build
Compiling Buildroot Firmware¶
Pre-compilation Configuration¶
$ cd ~/k3-buildroot-sdk-1.0
$ make envconfig
Available configs in /home2/lvsx/ext/project/k3/buildroot-ext/configs:
1. spacemit_aibox-k3_defconfig
2. spacemit_k3_ci_defconfig
3. spacemit_k3_defconfig
4. spacemit_k3_fpga_defconfig
5. spacemit_k3_plt_defconfig
Your choice (1-5):
Enter 1 here and select spacemit_aibox-k3_defconfig.
The compilation process may require downloading some third-party packages; the exact time depends on your network environment. If you download the third-party packages that buildroot depends on beforehand, the recommended compilation time is approximately 1 hour based on your hardware configuration.
The compilation output is located in the /output/k3/images/ directory. A successful compilation and packaging log is shown below:
Generating sdcard image...................................
INFO: cmd: "mkdir -p "/aibox-k3/build/genimage.tmp"" (stderr):
INFO: cmd: "rm -rf "/aibox-k3/build/genimage.tmp"/*" (stderr):
INFO: cmd: "mkdir -p "/aibox-k3/images"" (stderr):
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition 'env' from 'env.bin' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition 'bootinfo' from 'factory/bootinfo_block.bin' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition 'fsbl' from 'factory/FSBL.bin' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition 'esos' from 'esos.itb' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition 'opensbi' from 'fw_dynamic.itb' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition 'uboot' from 'u-boot.itb' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition 'bootfs' (in MBR) from 'bootfs.img' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition 'rootfs' (in MBR) from 'rootfs.ext4' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition '[MBR]' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition '[GPT header]' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition '[GPT array]' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): adding primary partition '[GPT backup]' ...
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): writing GPT
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): writing protective MBR
INFO: hdimage(Buildroot-aibox-k3-20260508163419-sdcard.img): writing MBR
INFO: cmd: "rm -rf "/aibox-k3/build/genimage.tmp/"" (stderr):
Successfully generated at /aibox-k3/images/Buildroot-aibox-k3-20260508163419-sdcard.img
The Buildroot-K3-xxx.zip file is suitable for Titan Flasher, or can be unzipped and flashed using fastboot; Buildroot-K3-xxx-sdcard.img is the SD card firmware, which can be written to the SD card using the dd command or balenaEtcher after unzipping.
The default username for the firmware is root, and the password is firefly.
Compiling Bianbu Firmware¶
Preparation¶
Download the root filesystem: Bianbu Root Filesystem (64-bit)
After downloading, extract the filesystem to SDK/buildroot-ext/board/spacemit/k3/ and rename it.
7z x Bianbu-Lxqt_rootfs_xxx.7z
# Move the extracted rootfs image to the specified directory in the SDK. The name must be rootfs.ext4.
mv Bianbu-Lxqt_rootfs_xxx.ext4 /SDK/buildroot-ext/board/spacemit/k3/rootfs.ext4
Pre-compilation configuration¶
$ cd ~/k3-buildroot-sdk-1.0
$ make envconfig
Available configs in /home2/lvsx/ext/project/k3/buildroot-ext/configs:
1. spacemit_aibox-k3_defconfig
2. spacemit_k3_ci_defconfig
3. spacemit_k3_defconfig
4. spacemit_k3_fpga_defconfig
5. spacemit_k3_plt_defconfig
Your choice (1-5):
Enter 1 here and select spacemit_aibox-k3_defconfig.
The compilation process will replace the buildroot file system with the /SDK/buildroot-ext/board/spacemit/k3/rootfs.ext4 file system.
Configuration¶
Configuration requires entering the Docker build environment.
make aibox-k3-shell
buildroot¶
Configuration:
make menuconfig
The configuration is saved to buildroot-ext/configs/spacemit_aibox-k3_defconfig by default.
make savedefconfig
Linux¶
Configuration:
make linux-menuconfig
Save the configuration, which by default is saved to bsp-src/linux-6.18/arch/riscv/configs/k3_bianbu_defconfig:
make linux-update-defconfig
u-boot¶
Configuration:
make uboot-menuconfig
Save the configuration, which by default is saved to bsp-src/uboot-2022.10/configs/k3_defconfig:
make uboot-update-defconfig
Recompile Completely¶
If you have already compiled completely using make envconfig, you can directly use make to compile completely again.
Compile a Specific Package¶
Buildroot supports compiling a specific package. You can use make help to view the guide.
Common Commands:
Delete the compilation directory of
<pkg>:make <pkg>-dircleanCompile
<pkg>:make <pkg>Recompile
<pkg>:make <pkg>-rebuild
u-boot¶
#Compilation
make uboot
#Cleanup
make uboot-dirclean
#Recompile
make uboot-rebuild
Linux¶
The kernel’s default configuration is k3_bianbu_defconfig
#Compilation
make linux
#Cleanup
make linux-dirclean
#Recompile
make linux-rebuild
opensbi¶
#Compilation
make opensbi
#Cleanup
make opensbi-dirclean
#Recompile
make opensbi-rebuild
After compiling the specified package, it can be downloaded separately to the device for verification, or compiled into the firmware:
make