Rock5/guide/build-kernel-on-5b
ROCK 5 > Guide > Build Kernel on ROCK 5B
Contents
Build Kernel on ROCK 5B
Rockchip Debian SDK
Below is the instructions of how to build image for ROCK 5 on a HOST PC.
Available boards:
- ROCK 5B
Get the source code
You need Git to get multiple git repositories to build the image.
Install Git if you don't have it.
sudo apt-get update sudo apt-get install git
Clone the source code
mkdir ~/rk3588-sdk && cd ~/rk3588-sdk git clone -b stable-5.10-rock5 https://github.com/radxa/kernel.git git clone -b master https://github.com/radxa/rkbin.git git clone -b debian https://github.com/radxa/build.git git clone -b main https://github.com/radxa/debos-radxa.git
And you will get
build kernel rkbin
Directories usage introductions:
- build:
- Some script files and configuration files for building u-boot, kernel and rootfs.
- kernel:
- kernel source code, current version is 4.19.193.
- rkbin:
- Prebuilt Rockchip binaries, include first stage loader and ATF(Arm Trustzone Firmware).
Install other build tools
sudo apt-get install device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools bc python dosfstools bison flex rsync
Build kernel
Need to checkout branch to stable-5.10-rock5.
Build kernel with default rockchip_linux_defconfig.
cd ~/rk3588-sdk ./build/mk-kernel.sh rk3588-rock-5b #For ROCK 5B
Change kernel config
Optionally, if you want to change the default kernel config
cd ~/rk3588-sdk cd kernel make rockchip_linux_defconfig make menuconfig make savedefconfig cp defconfig arch/arm64/configs/rockchip_linux_defconfig cd .. ./build/mk-kernel.sh rk3588-rock-5b #For ROCK 5B
You will get the kernel image and dtb file
ls out/kernel/ Image rk3588-rock-5b.dtb
Build kernel deb package
The kernel package build can pack the kernel, device tree, modules and firmware into Debian packages, which makes it easier to install on the ROCK 5.
./build/pack-kernel.sh -d rockchip_linux_defconfig -r 10 # rockchip_linux_defconfig: kernel defconfig; 1: release number
The generated packages will be copied to out/packages directory.
ls out/packages/ linux-5.10.66-10-rockchip-ge5013df5e066_5.10.66-10-rockchip_arm64.changes linux-image-5.10.66-10-rockchip-ge5013df5e066-dbg_5.10.66-10-rockchip_arm64.deb linux-headers-5.10.66-10-rockchip-ge5013df5e066_5.10.66-10-rockchip_arm64.deb linux-libc-dev_5.10.66-10-rockchip_arm64.deb linux-image-5.10.66-10-rockchip-ge5013df5e066_5.10.66-10-rockchip_arm64.deb
When you want to install specified kernel packages to your OS, try the following steps.
# dpkg -i linux-image-5.10.66-10-rockchip-ge5013df5e066-dbg_5.10.66-10-rockchip_arm64.deb
Flash the image
FAQs
Troubleshooting
Check ROCK 5 FAQs first, if it doesn't help, start a new post on the forum https://forum.radxa.com/c/rock5.