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

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

< RockpiS‎ | dev
(Created page with "{{rockpiS_header}} {{Languages|rockpiS/dev/kernel-4.4}} ROCK Pi S > Development > rockpiS/dev/kernel-4.4 | Build vendor kernel(Rockchip...")
 
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
     [[rockpiS | ROCK Pi S]] > [[rockpiS/dev | Development]] > [[rockpiS/dev/kernel-4.4 | Build vendor kernel(Rockchip 4.4)]]
 
     [[rockpiS | ROCK Pi S]] > [[rockpiS/dev | Development]] > [[rockpiS/dev/kernel-4.4 | Build vendor kernel(Rockchip 4.4)]]
  
 +
__TOC__
 +
 +
=== Build verdor kernel (Rockchip 4.4) ===
 +
 +
This guide describes how to build verdor kernel (Rockchip 4.4).
 +
<br />
 
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.
 
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 ===
+
==== Get the kernel source ====
  
    git clone -b stable-4.4-rockpis https://github.com/radxa/kernel.git
+
radxa@x86_64:~$ git clone -b stable-4.4-rockpis https://github.com/radxa/kernel.git
    cd kernel
+
radxa@x86_64:~$ 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
+
==== Install toolchain from Linaro ====
    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===
+
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/
  
    make rk3308_linux_defconfig
+
==== 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
 
If you need to build kernel modules that are not in the default config, you can select it in menu config
  
    make menuconfig    #(optional)
+
radxa@x86_64:~/kernel$ make menuconfig    #(optional)
  
 
Now build it
 
Now build it
  
    make -j8
+
radxa@x86_64:~/kernel$ make -j8
  
The built targets we are interested are '''arch/arm64/boot/Image''', dtb file '''arch/arm64/boot/dts/rockchip/rockpi-4b-linux.dtb''', dtbo files '''arch/arm64/boot/dts/rockchip/overlays-rockpis/*.dtbo''' and '''arch/arm64/boot/dts/rockchip/overlays-rockpis/hw_intfc.conf'''
+
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 ===
+
==== 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.
 
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.
  
First, setup the version number, make sure the format is right.
+
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.
+
radxa@x86_64:~/kernel$ export build_id="999"            # make sure it's big enough so that our kernel is the newest.
    export kgid="g$(git rev-parse --short HEAD)"
+
radxa@x86_64:~/kernel$ export kgid="g$(git rev-parse --short HEAD)"
    export lv="-$build_id-rockchip"
+
radxa@x86_64:~/kernel$ export lv="-${build_id}-rockchip"
    export kv=$(make kernelversion)
+
radxa@x86_64:~/kernel$ export kv=$(make kernelversion)
    export debv="$kv$lv"
+
radxa@x86_64:~/kernel$ export debv="$kv$lv"
 
+
    make  bindeb-pkg -j8    LOCALVERSION=$lv-$kgid    KDEB_PKGVERSION=$debv
+
radxa@x86_64:~/kernel$ make  bindeb-pkg -j8    LOCALVERSION=$lv-$kgid    KDEB_PKGVERSION=$debv
  
 
The generated packages are(the kernel revision name maybe different):  
 
The generated packages are(the kernel revision name maybe different):  
  
 
<pre>
 
<pre>
ls ../*.deb
+
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-gea65ae4_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-gea65ae4_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-gea65ae4-dbg_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
 
../linux-libc-dev_4.4.143-999-rockchip_arm64.deb
 
 
</pre>
 
</pre>
  
Copy '''linux-headers-4.4.143-999-rockchip-*_arm64.deb''' and '''linux-image-4.4.143-999-rockchip-*_arm64.deb''' to your ROCK Pi S.
+
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.
  
==== Install it on ROCK Pi S.====
+
To enable console ttyS0, you need to enable uart0 node. Add the following lines at the end of file rk3328-rock-pi-s.dts.
  
    rockpiS# dpkg -i linux-headers-4.4.143-999-rockchip-*_arm64.deb linux-image-4.4.143-999-rockchip-*_arm64.deb
+
&uart0 {
 +
    status = "okay";
 +
};
  
Reboot. You will have the new kernel booting.
+
==== Troubleshooting ====
 +
* Post your issue at the forum: https://forum.radxa.com/c/rockpiS.

Latest revision as of 03:52, 30 May 2020

    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