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:52, 30 May 2020 by Stephen (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
    ROCK Pi S >  Development >  Build vendor kernel(Rockchip 4.4)

Build verdor kernel (Rockchip 4.4)

This guide describes how to build verdor 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.

FAQs

1.I have built one ROCK Pi S system image using rockchip-bsp SDK. With an USB to TTL serial cable connected with UART0 pins (pin#10, pin#8, ping#6 on colorful 26-PIN Header) on ROCK Pi S, the last one line of system logs is shown as follows.
[    1.072493] bootconsole [uart0] disabled

In fact the system starts up. If your ROCK Pi S system supports Ethernet/WiFi and SSH, you can access ROCK Pi S via SSH.

If you read the kernel command line of system log, you will find that the default console is ttyS0 (1500000n8). But due to uart0 is disabled by default in file rk3308-rock-pi-s.dts, there will be no more system logs on the screen.

To enable console ttyS0, you need to enable uart0 node. Add the following lines at the end of file rk3328-rock-pi-s.dts.

&uart0 {
    status = "okay";
};

Troubleshooting