Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Rock5/guide/build-kernel-on-5b"

< Rock5‎ | guide
Line 69: Line 69:
  
 
==== Build kernel package ====
 
==== Build kernel package ====
Because the cross compiler is not used, this line needs to be deleted out in the file kernel-package.mk.
 
...
 
KERNEL_MAKE ?= make \
 
ARCH=arm64 \
 
CROSS_COMPILE="path/aarch64-linux-gnu-"
 
...
 
 
change to:
 
...
 
KERNEL_MAKE ?= make \
 
ARCH=arm64 \
 
...
 
  
 
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.  
 
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.  

Revision as of 03:51, 28 October 2022

    ROCK 5 >  Guide >  Build Kernel on ROCK 5B

Build Kernel on ROCK 5B

Below is the instructions of how to build kernel for ROCK 5 on rock5 board.

Available boards:

  • ROCK 5B

Install essential pacakges

sudo apt-get update
sudo apt-get install -y git  device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools bc python dosfstools bison flex rsync

Get the source code

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

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.
  • rkbin:
    • Prebuilt Rockchip binaries, include first stage loader and ATF(Arm Trustzone Firmware).

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

build kernel

cd ~/rk3588-sdk
./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 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

After a while, you will find that some files are generated in the /boot directory.then you may modify the default boot kernel.

$ vim /boot/extlinux/extlinux.conf
...
default l0
menu title U-Boot menu
prompt 0
timeout 10
...

change to:

...
default l1
menu title U-Boot menu
prompt 0
timeout 10
...

Now,you can reboot your board.After entering the system, enter the following command to check whether the version is the same as the version you built

$ uname -r

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.