Building a Linux 5 kernel


#1

I’ve been playing around with my board and I saw that there’s quite a bit of updated support for the Rock 960 in Linux 5 (including support for user leds etc). But, it looks like the only kernel that’s officially available is 4.4. Is there a recommended way to build mainline Linux? I’ve tried in the past to upgrade the kernel on the board (i.e. building on the Rock960 itself), but I couldn’t get it to boot into the new system, it’d keep loading 4.4.

I’ve had a look at this: http://rock960.blogspot.com/2018/12/custom-kernel-compilation.html

Thanks!


#2

Hi,

To build mainline kernel, you can just follow the link you posted:

Build the kernel:

make ARCH=arm64 menuconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j 12 Image dtbs

arch/arm64/boot/Image and arch/arm64/boot/dts/rockchip/rk3399-rock960.dtb is what you get.

To update the kernel for current image, make sure /dev/mmcblkp4 is mounted on /boot

copy arch/arm64/boot/Image to /boot/Image-5.0 and arch/arm64/boot/dts/rockchip/rk3399-rock960.dtb to /boot/rk3399-rock960.dtb.

Edit /boot/extlinux/extlinux.conf, add an entry on the top.

label kernel-mainline
    kernel /Image-5.0
    fdt /rk3399-rock960.dtb
    append  earlycon=uart8250,mmio32,0xff130000 rw root=PARTUUID=b921b045-1d rootwait rootfstype=ext4 init=/sbin/init

Then reboot, u-boot will load the kernel in the first entry by default.


#3

Great, thanks for the confirmation. I did try something similar before (I think with a 4.21 branch), but I was having trouble generating the dtb file. I’ll give that a go tomorrow and update!

Can I just copy the config file from the rockchip repository? Or if I start from scratch, is there anything I should enable that isn’t by default?