Skip to main content

Kernel Develop

Build Kernel

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 3A 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

# 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

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

Once you've finished configuring your bsp environment, you need to compile the kernel once before pulling the kernel code from the repository.  
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 3A as an example, the linux profile is "rk356x". The following are profiles for other products:
|       Model      | Profile  |
| :--------------: | :------: |
|  Radxa ROCK 5A   | rockchip |
|  Radxa ROCK 5B   | rockchip |
|  Radxa ROCK 5C   | rockchip |
| Radxa ROCK 5 ITX | rockchip |
|  Radxa ROCK 3A   |  rk356x  |
|  Radxa ROCK 3B   |  rk356x  |
|  Radxa ROCK 3C   |  rk356x  |
|  Radxa CM3 Series|  rk356x  |
| Radxa ROCK PI S  |  stable  |
Then fill in the **profile** parameter of the bsp command with the product profile **rk356x** e.g.: **. /bsp linux rk356x** to build the kernel.  
The kernel source code is located in **.src/linux** in the bsp directory, and you can build the kernel again after modifying the kernel source code:

    cd bsp
    . /bsp --no-prepare-source linux rk356x -r 999
    Parameter description:
    --no-prepare-source # Compile with local changes, without this parameter the latest code will be synchronized from the Radxa kernel repository and overwrite the local changes.
    -r 999 # Specify the kernel version number 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


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-image-5.10.160-999-rk356x_5.10.160-20_arm64.deb
    sudo dpkg -i linux-headers-5.10.160-999-rk356x_5.10.160-20_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


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.