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

RockpiS/dev/kernel-4.4

< RockpiS‎ | dev
Revision as of 03:59, 14 May 2020 by Stephen (Talk | contribs)

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

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

Get the kernel source

radxa@x86_64:~$ git clone -b stable-4.4-rockpis https://github.com/radxa/kernel.git
radxa@x86_64:~$ cd kernel

Install toolchain from Linaro

radxa@x86_64:~/kernel$ 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
radxa@x86_64:~/kernel$ sudo tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz  -C /usr/local/

Set environment variables

radxa@x86_64:~/kernel$ export ARCH=arm64
radxa@x86_64:~/kernel$ export CROSS_COMPILE=/usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

Build kernel

radxa@x86_64:~/kernel$ make rk3308_linux_defconfig

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

radxa@x86_64:~/kernel$ make menuconfig    #(optional)

Now build it

radxa@x86_64:~/kernel$ make -j8

The built targets we care about are arch/arm64/boot/Image, dtb file arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dtb, dtbo files arch/arm64/boot/dts/rockchip/overlay/*.dtbo.

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

Setup the version number, make sure the format is right.

radxa@x86_64:~/kernel$ export build_id="999"             # make sure it's big enough so that our kernel is the newest.
radxa@x86_64:~/kernel$ export kgid="g$(git rev-parse --short HEAD)"
radxa@x86_64:~/kernel$ export lv="-${build_id}-rockchip"
radxa@x86_64:~/kernel$ export kv=$(make kernelversion)
radxa@x86_64:~/kernel$ export debv="$kv$lv"

radxa@x86_64:~/kernel$ make  bindeb-pkg -j8    LOCALVERSION=$lv-$kgid    KDEB_PKGVERSION=$debv

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

radxa@x86_64:~/kernel$ ls ../*.deb
../linux-firmware-image-4.4.143-999-rockchip-g9512142776c9_4.4.143-999-rockchip_arm64.deb
../linux-headers-4.4.143-999-rockchip-g9512142776c9_4.4.143-999-rockchip_arm64.deb
../linux-image-4.4.143-999-rockchip-g9512142776c9_4.4.143-999-rockchip_arm64.deb
../linux-image-4.4.143-999-rockchip-g9512142776c9-dbg_4.4.143-999-rockchip_arm64.deb
../linux-libc-dev_4.4.143-999-rockchip_arm64.deb

Copy linux-firmware-image-4.4.143-999-rockchip-*_arm64.deb, linux-headers-4.4.143-999-rockchip-*_arm64.deb and linux-image-4.4.143-999-rockchip-*_arm64.deb to your ROCK Pi S.

Install packages on ROCK Pi S in order

root@rockpis:~# dpkg -i linux-headers-4.4.143-999-rockchip-*_arm64.deb
root@rockpis:~# dpkg -i linux-image-4.4.143-999-rockchip-*_arm64.deb
root@rockpis:~# dpkg -i linux-firmware-image-4.4.143-999-*_arm64.deb

Reboot ROCK Pi S. You will have the new kernel booting.