Skip to main content

Kernel Development

Using bsp

bsp is a set of tools provided by Radxa to quickly build U-Boot Kernels. It is very easy to build your own U-Boot and Kernel with bsp.

The following shows you how to build a kernel with bsp using Radxa ROCK 5B as an example.

bsp environment configuration

The following is the recommended environment for bsp.
Hardware: x86_64 PC recommended
System: Ubuntu or Debian

Install dependencies

sudo apt update
sudo apt install -y git qemu-user-static binfmt-support

# Podman (recommended)
sudo apt install -y podman podman-docker
sudo touch /etc/containers/nodocker
# Docker
# sudo apt install docker.io

# Optional dependencies for minor features
sudo apt install -y systemd-container

Getting the code

bsp uses the git submodule. Therefore, use the following command to get the code:

git clone --recurse-submodules https://github.com/radxa-repo/bsp.git

Understanding bsp usage

Once you have the bsp code on your machine, you can run bsp to see the built-in help:

cd bsp
. /bsp

Build the kernel

Running ./bsp will show you all the arguments and their explanations, and the command bsp [options] <linux|u-boot> <profile> [product] will be available at the prompt.
Taking Radxa ROCK 5B as an example, the linux profile is "rk2410". The following are profiles for other products:

productprofileproductprofileproductprofileproductprofile
rock-4serockchipradxa-cm3-iork356xradxa-zerostablerock-5ark2410
rock-pi-4a-plusrockchipradxa-cm3-rpi-cm4-iork356xradxa-zero-2prostablerock-5brk2410
rock-pi-4b-plusrockchipradxa-cm3-sodimm-iork356xrock-s0stablerock-5b-plusrk2410
rock-4c-plusrockchipradxa-cm3i-iork356xrock-pi-sstablerock-5crk2410
rock-pi-4arockchipradxa-cm3j-rpi-cm4-iork356xrock-pi-n10stablerock-5drk2410
rock-pi-4brockchipradxa-e23rk356xrock-pi-establerock-5trk2410
rock-pi-4crockchipradxa-e25rk356xrock-5-itxrk2410
rock-4-core-iorockchipradxa-zero3rk356xradxa-e52crk2410
rock-3ark356xradxa-e54crk2410
rock-3brk356xradxa-nx5-iork2410
rock-3crk356xradxa-cm4-rpi-cm4-iork2410
rock-2rk356xradxa-cm5-iork2410
radxa-cm5-rpi-cm4-iork2410

Then fill in the profile parameter of the bsp command with the product's corresponding profile: rk2410 to pull and configure the code, for example:

./bsp linux rk2410 --no-build
# `--no-build` only configure the code without compile

The path to the kernel source code is located in .src/linux in the bsp directory, and the kernel can be built again after modifying the kernel source code:

cd bsp
./bsp --no-prepare-source linux rk2410 -r 999
# Parameter description:
# `--no-prepare-source` # This parameter is not needed for first time compilation, it is added to compile with local modifications, if this parameter is not added, the latest code will be synchronized from the Radxa kernel repository and overwrite the local modifications.
# `-r 999` # Specify the kernel version as 999 for priority use.

After compilation, a number of deb packages will be generated in the current directory, you only need to install the following two deb packages

info

The software package file name will change according to the parameters of propile and -r

linux-headers-6.1.84-999-rk2410_6.1.84-999_arm64.deb
linux-image-6.1.84-999-rk2410_6.1.84-999_arm64.deb

Copy the above two deb packages to the board and install them with the dpkg command to complete the kernel installation

sudo dpkg -i linux-headers-6.1.84-999-rk2410_6.1.84-999_arm64.deb
sudo dpkg -i linux-image-6.1.84-999-rk2410_6.1.84-999_arm64.deb
sudo reboot

After the reboot is complete, you can check if the installation was successful by checking the version number of the currently booted kernel with uname -a.

Compile manually

tip

bsp is the only compilation method currently being maintained, and it makes additional changes to the source code when compiling. If you want to develop based on our officially released software, you should at least use bsp to download and configure the code.

If you want to build with a custom make command, please refer to the Prepare working tree section to configure the code.

Documentation