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
(Get the source code)
Line 5: Line 5:
  
 
== Build Kernel on ROCK 5B ==
 
== Build Kernel on ROCK 5B ==
=== Rockchip Debian SDK ===
 
  
 
Below is the instructions of how to build kernel for ROCK 5 on rock5 board.
 
Below is the instructions of how to build kernel for ROCK 5 on rock5 board.
Line 13: Line 12:
 
* ROCK 5B
 
* ROCK 5B
  
==== Get the source code ====
+
=== Install essential pacakges ===
  
You need Git to get multiple git repositories to build the image.
+
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
  
Install Git if you don't have it.
+
=== Get the source code ===
 
+
sudo apt-get update
+
sudo apt-get install git
+
  
 
Clone the source code
 
Clone the source code
Line 41: Line 38:
 
** Prebuilt Rockchip binaries, include first stage loader and ATF(Arm Trustzone Firmware).
 
** Prebuilt Rockchip binaries, include first stage loader and ATF(Arm Trustzone Firmware).
  
==== Install other build tools ====
+
=== Build kernel ===
 
+
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'''.
 
Need to checkout branch to '''stable-5.10-rock5'''.
Line 54: Line 47:
 
  ./build/mk-kernel.sh rk3588-rock-5b    #For ROCK 5B
 
  ./build/mk-kernel.sh rk3588-rock-5b    #For ROCK 5B
  
===== Change kernel config =====
+
==== Change kernel config ====
  
 
Optionally, if you want to change the default kernel config
 
Optionally, if you want to change the default kernel config
Line 64: Line 57:
 
  make savedefconfig
 
  make savedefconfig
 
  cp defconfig arch/arm64/configs/rockchip_linux_defconfig
 
  cp defconfig arch/arm64/configs/rockchip_linux_defconfig
  cd ..
+
 
 +
==== build kernel ====
 +
 
 +
  cd ~/rk3588-sdk
 
  ./build/mk-kernel.sh rk3588-rock-5b    #For ROCK 5B
 
  ./build/mk-kernel.sh rk3588-rock-5b    #For ROCK 5B
  
Line 72: Line 68:
 
  Image  rk3588-rock-5b.dtb
 
  Image  rk3588-rock-5b.dtb
  
==== Build kernel deb package ====
+
==== Build kernel package ====
 
Because the cross compiler is not used, this line needs to be deleted out in the file kernel-package.mk.
 
Because the cross compiler is not used, this line needs to be deleted out in the file kernel-package.mk.
 
  ...
 
  ...
Line 79: Line 75:
 
  CROSS_COMPILE="path/aarch64-linux-gnu-"
 
  CROSS_COMPILE="path/aarch64-linux-gnu-"
 
  ...
 
  ...
 +
 
change to:
 
change to:
 
  ...
 
  ...
Line 84: Line 81:
 
  ARCH=arm64 \
 
  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.  
Line 122: Line 118:
 
  $ uname -r
 
  $ uname -r
  
==== Flash the image ====
+
=== FAQs ===
 
+
==== FAQs ====
+
  
==== Troubleshooting ====
+
=== Troubleshooting ===
  
 
Check [[rock5/FAQs |ROCK 5 FAQs]] first, if it doesn't help, start a new post on the forum https://forum.radxa.com/c/rock5.
 
Check [[rock5/FAQs |ROCK 5 FAQs]] first, if it doesn't help, start a new post on the forum https://forum.radxa.com/c/rock5.

Revision as of 03:33, 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

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.

./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.