Welcome to Firefly
Switch language
Firefly Docsss
Last Updated: 2026-07-27 18:01:24

Mainline Linux Kernel User Guide

Overview

This document describes the basic workflow for using the mainline Linux Kernel on the platform, including obtaining the source code, checking the Firefly boards supported by mainline, and configuring and building the Kernel.

The Firefly ROC-RK3588-RT is used as an example. Its device tree is:

arch/arm64/boot/dts/rockchip/rk3588-roc-rt.dts

The mainline Kernel and the Rockchip BSP Kernel do not provide exactly the same feature coverage. The presence of a board-level DTS in a mainline release and the ability to boot with it do not mean that features such as the VPU, NPU, GPU, ISP, HDMI, camera, PCIe, and low-power modes have reached the same level of support as in the BSP Kernel.

Obtaining the Source Code

The official mainline Linux source code is maintained by Linus Torvalds:

git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux

If the selected version does not contain the DTS for the target board, use a newer mainline version that includes it.

Firefly Boards Supported by Mainline

SoCBoardDTSBuild Target
PX30Core-PX30-JD4 + MB-JD4-PX30px30-firefly-jd4-core-mb.dtsrockchip/px30-firefly-jd4-core-mb.dtb
RK3308ROC-RK3308-CCrk3308-roc-cc.dtsrockchip/rk3308-roc-cc.dtb
RK3328ROC-RK3328-CCrk3328-roc-cc.dtsrockchip/rk3328-roc-cc.dtb
RK3328ROC-RK3328-PCrk3328-roc-pc.dtsrockchip/rk3328-roc-pc.dtb
RK3399Firefly-RK3399rk3399-firefly.dtsrockchip/rk3399-firefly.dtb
RK3399ROC-RK3399-PCrk3399-roc-pc.dtsrockchip/rk3399-roc-pc.dtb
RK3399ROC-RK3399-PC Mezzaninerk3399-roc-pc-mezzanine.dtsrockchip/rk3399-roc-pc-mezzanine.dtb
RK3399ROC-RK3399-PC-PLUSrk3399-roc-pc-plus.dtsrockchip/rk3399-roc-pc-plus.dtb
RK3566Station M2rk3566-roc-pc.dtsrockchip/rk3566-roc-pc.dtb
RK3568Station P2rk3568-roc-pc.dtsrockchip/rk3568-roc-pc.dtb
RK3576ROC-RK3576-PCrk3576-roc-pc.dtsrockchip/rk3576-roc-pc.dtb
RK3588ITX-3588Jrk3588-firefly-itx-3588j.dtsrockchip/rk3588-firefly-itx-3588j.dtb
RK3588ROC-RK3588-RTrk3588-roc-rt.dtsrockchip/rk3588-roc-rt.dtb
RK3588SStation M3rk3588s-roc-pc.dtsrockchip/rk3588s-roc-pc.dtb

The board list varies with the Linux version. The presence of a DTS only means that mainline includes the board-level description. Whether specific interfaces are available still depends on driver support in the version being used.

Preparing the Build Environment

Install the following packages on a Debian/Ubuntu host:

sudo apt update
sudo apt install \
  build-essential bc bison flex libssl-dev libelf-dev \
  device-tree-compiler gcc-aarch64-linux-gnu lz4 u-boot-tools

Set up the ARM64 cross-compilation environment:

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-

If you use another AArch64 toolchain, change CROSS_COMPILE to its actual prefix. Do not mix aarch64-linux-gnu- and aarch64-none-linux-gnu- in the same build.

Building the Kernel

5.1 Configuring the Kernel

Use the ARM64 default configuration together with the custom configuration file linux-rockchip-rk3588-current.config:

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig linux-rockchip-rk3588-current.config

5.2 Building the Image, DTB, and Modules

Set the board name:

export BOARD=rk3588-roc-rt

Build the kernel, compressed kernel, ROC-RK3588-RT DTB, and modules:

make -j$(nproc) \
  ARCH=arm64 \
  CROSS_COMPILE=aarch64-linux-gnu- \
  Image Image.lz4 "rockchip/${BOARD}.dtb" modules

The main output files are:

arch/arm64/boot/Image
arch/arm64/boot/Image.lz4
arch/arm64/boot/dts/rockchip/rk3588-roc-rt.dtb

Check the output files:

ls -lh \
  arch/arm64/boot/Image \
  arch/arm64/boot/Image.lz4 \
  arch/arm64/boot/dts/rockchip/rk3588-roc-rt.dtb

5.3 Installing the Modules

Install the modules to a temporary directory:

mkdir -p output/extboot

make -j$(nproc) \
  ARCH=arm64 \
  CROSS_COMPILE=aarch64-linux-gnu- \
  INSTALL_MOD_STRIP=1 \
  INSTALL_MOD_PATH="$PWD/output/extboot" \
  modules_install

The modules are installed to:

output/extboot/lib/modules/<kernel-release>/

Display the Kernel release for the current build:

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- kernelrelease

When deploying the modules to the root file system, ensure that /lib/modules/<kernel-release>/ exactly matches the Kernel that is actually booted.

On this page