Build the Rockchip Linux Kernel (Vendor BSP and Mainline)
Cross-compile a Rockchip kernel on an x86 host, install the Image, DTB and modules, and know when to choose the vendor BSP or mainline.
Vendor BSP or mainline?
- Vendor BSP (rockchip-linux/kernel, branches such as
develop-5.10anddevelop-6.1): NPU, ISP, MPP video codec, RGA and every vendor driver. Most board-vendor images use it. - Mainline (kernel.org / linux-rockchip): cleaner, long-term maintainable, excellent for RK3399/RK3568/RK3566 and improving fast for RK3588. Some multimedia and NPU features may be missing or different.
Board vendors often maintain their own branch (e.g. Radxa, Armbian, Joshua Riek's Ubuntu Rockchip). If your board is supported there, start from it.
1. Toolchain
sudo apt install -y gcc-aarch64-linux-gnu build-essential bc bison flex \
libssl-dev libncurses-dev device-tree-compiler git cpio kmod
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
For 32-bit Cortex-A7 parts (RV1106, RV1126, RK3506) use ARCH=arm and CROSS_COMPILE=arm-linux-gnueabihf-, or the toolchain shipped with the SDK.
2. Configure
# Vendor BSP
make rockchip_linux_defconfig
# Mainline
make defconfig
# Adjust (drivers, filesystems, debug options)
make menuconfig
3. Build
make -j"$(nproc)" Image dtbs modules
# Outputs:
# arch/arm64/boot/Image
# arch/arm64/boot/dts/rockchip/*.dtb
Build a single DTB: make rockchip/rk3588-rock-5b.dtb.
4. Install to the board
# Stage modules into a directory, then copy to the board's rootfs
make modules_install INSTALL_MOD_PATH=./out INSTALL_MOD_STRIP=1
# On the board (extlinux-based images):
sudo cp Image /boot/vmlinuz-custom
sudo cp rk3588-rock-5b.dtb /boot/dtbs/custom/
sudo cp -r out/lib/modules/* /lib/modules/
Then point /boot/extlinux/extlinux.conf at the new kernel and DTB. Keep the old entry as a fallback label so you can pick it from the U-Boot menu over serial.
label custom
kernel /boot/vmlinuz-custom
fdt /boot/dtbs/custom/rk3588-rock-5b.dtb
append root=UUID=... console=ttyS2,1500000 console=tty1 rw rootwait
5. Packaging for vendor images
Vendor SDKs usually wrap the kernel in a boot.img (Android format or FIT). Inside the SDK, use its build script, e.g. ./build.sh kernel, so the image format, DTB and resource partition stay consistent.
Checklist when the new kernel doesn't boot
- Watch the serial console with
earlyconadded to the kernel command line. - DTB from the same tree as the kernel. Mixing vendor DTBs with mainline kernels (and vice versa) fails.
- Storage driver (
MMC_DW_ROCKCHIP,MMC_SDHCI_OF_DWCMSHCfor eMMC on newer SoCs, NVMe) built-in, not as a module, if the rootfs lives there. uname -rmust match the/lib/modulesdirectory name.
Spotted an error or have something to add? Suggest an improvement.