Custom Linux Kernel
When developing for the BL808, you may want to customize the Linux kernel or add your own device drivers. This guide walks through the SDK setup, Linux source checkout, configuration, and kernel build process.
You can download the SDK from the OpenBouffalo Buildroot releases page, or build it from source.
If you choose to download a prebuilt SDK, extract it somewhere convenient and skip to Relocate the SDK.
Set up the Buildroot environment first, up to but not including the main build step.
Buildroot provides an SDK target intended to simplify application and kernel development for the BL808:
make SDK
This creates the SDK under ~/buildroot_bouffalo/buildroot/output/host/.
The following example copies the generated SDK so it sits next to buildroot/ and buildroot_bouffalo/:
cd ~/buildroot_bouffalo/
cp -r ~/buildroot_bouffalo/buildroot/output/host/ ~/buildroot_bouffalo/bl808-sdk/
cd bl808-sdk
./relocate-sdk.sh
In the environment-setup file, add:
PS1="(riscv) $PS1"
This makes the shell prompt show (riscv) while the SDK environment is active.
Source the environment-setup file:
source environment-setup
Normally you would fork the project and use your own repository, but this example uses the upstream tree directly:
cd ~/buildroot_bouffalo/
git clone https://github.com/openbouffalo/linux
The repository contains several BL808-related branches:
bl808/allcontains the stable driver set.bl808/boardscontains the board configuration for the drivers.- Other
bl808/*branches contain individual feature or driver work.
If you want to create a new driver that does not depend on other in-progress drivers, start from bl808/boards. If your work depends on another feature branch such as pinctrl or DMA, base it on the relevant branch instead.
The proposed branching structure is discussed here.
If you only want to configure the kernel without adding new drivers, use the stable branch:
git checkout bl808/all
Use the default BL808 kernel config:
cp arch/riscv/configs/bl808_defconfig .config
You can now modify the kernel configuration:
make menuconfig
Build the kernel:
make -jN
Replace N with the number of CPU cores you want to dedicate to the build.
Example:
make -j20
This produces the kernel image in arch/riscv/boot/ and device trees in arch/riscv/boot/dts/bouffalolab/.
Main output files:
arch/riscv/boot/Imagearch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dtsarch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s.dts
If you used the method described in Flashing, copy these files to the root of the SD card and replace the corresponding existing files.
