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

Difference between revisions of "Rockpi4/dev/kernel-4.4"

< Rockpi4‎ | dev
(Install toolchain from Linaro)
(Build kernel)
Line 31: Line 31:
 
     make -j8
 
     make -j8
  
The built targets we are interested are '''arch/arm64/boot/Image''' and dtb file '''arch/arm64/boot/dts/rockchip/rockpi-4b-linux.dtb'''.
+
The built targets we are interested are '''arch/arm64/boot/Image''' and dtb file '''arch/arm64/boot/dts/rockchip/rockpi-4b-linux.dtb''' and all the dtbo files in '''arch/arm64/boot/dts/rockchip/overlays'''
  
 
=== Build kernel deb package ===
 
=== Build kernel deb package ===

Revision as of 07:56, 10 July 2019

    ROCK Pi 4 >  Development >  Build vendor kernel(Rockchip 4.4)

The vendor kernel is based on the Rockchip 4.4 kernel with hardware support for ROCK Pi 4. Below is how to build it on a X86 Linux host PC.

Get the kernel source

   git clone -b release-4.4-rockpi4 https://github.com/radxa/kernel.git
   cd kernel
   

Install toolchain from Linaro

   wget https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
   sudo tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz  -C /usr/local/
   export ARCH=arm64
   export CROSS_COMPILE=/usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

Build kernel

   make rockchip_linux_defconfig

If you need to build kernel modules that are not in the default config, you can select it in menu config

   make menuconfig    #(optional)

Now build it

   make -j8

The built targets we are interested are arch/arm64/boot/Image and dtb file arch/arm64/boot/dts/rockchip/rockpi-4b-linux.dtb and all the dtbo files in arch/arm64/boot/dts/rockchip/overlays

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 Pi 4.

First, setup the version number, make sure the format is right.

   export build_id="999"             # make sure it's big enough so that our kernel is the newest.
   export lv="-$build_id-rockchip"
   export kv=$(make kernelversion)
   export debv="$kv$lv"
   make  bindeb-pkg -j8    LOCALVERSION=$lv    KDEB_PKGVERSION=$debv

The generated packages are(the kernel revision name maybe different):

ls ../*.deb

../linux-firmware-image-4.4.154-999-rockchip-g8b7b311_4.4.154-999-rockchip_all.deb
../linux-headers-4.4.154-999-rockchip-g8b7b311_4.4.154-999-rockchip_all.deb
../linux-image-4.4.154-999-rockchip-g8b7b311_4.4.154-999-rockchip_all.deb
../linux-image-4.4.154-999-rockchip-g8b7b311-dbg_4.4.154-999-rockchip_all.deb
../linux-libc-dev_4.4.154-999-rockchip_all.deb


copy linux-image-4.4.154-999-rockchip-*_all.deb and linux-firmware-image-4.4.154-999-rockchip-*_all.deb to your ROCK Pi 4.

Install it on ROCK Pi 4.

   rockpi4# dpkg -i linux-image-4.4.154-999-rockchip-*_all.deb linux-firmware-image-4.4.154-999-rockchip-*_all.deb

Reboot you will have the new kernel booting.