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?


#4

Hi,

I don’t know if you succeed to build and boot from a linux 5 kernel with your ROCK960 BUT for me, it does not boot… I am interested in your defconfig and dts files…

Anyway, if your are willing to have LED support with a linux 4.4 kernel, you just have to use my rk3399-rock960.dts file below after having renamed your current dts file to rk3399-rock960.dtsi…

It’s widely inspired by from @96rocks android dts file BUT with some modifications… It should work OOTB, if not, check your defconfig file for LED support…

Green LEDs are labelled from 0 to 3 : 0 is the one which is the closest from the SBC PCB edge (hearbeat), 1 and 2 are emmc / sdcard, 3 is panic, yellow and blue are for wifi and bluetooth respectively.

Regards

-> rk3399-rock960.dts

 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2018 Linaro Ltd.
 */

/dts-v1/;
#include "rk3399-rock960.dtsi"

/ {
	model = "96boards Rock960";
	compatible = "vamrs,rock960", "rockchip,rk3399";

	chosen {
		stdout-path = "serial2:1500000n8";
	};

	leds {
		compatible = "gpio-leds";
		status = "okay";

		green@0 {
			label = "rock960:green:user0";
			linux,default-trigger = "heartbeat";
			gpios = <&gpio4 18 GPIO_ACTIVE_HIGH>;
		};
		green@1 {
			label = "rock960:green:user1";
			linux,default-trigger = "mmc0";
			gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>;
		};
		green@2 {
			label = "rock960:green:user2";
			linux,default-trigger = "mmc1";
			gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>;
		};
		green@3 {
			label = "rock960:green:user3";
			linux,default-trigger = "none";
			gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>;
		};
		yellow {
			label = "rock960:yellow:wifi";
			linux,default-trigger = "rfkill2";
			default-state = "on";
			gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
		};
		blue {
			label = "rock960:blue:bluetooth";
			linux,default-trigger = "rfkill1";
			default-state = "on";
			gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
		};
	};
};

#5

I’ve not tried to build Linux 5 yet. I’ve been working on a Docker container that will build a Rock960 image. Once I’ve got that reliably working and I’ve figured out what extra things I want compiled in, I’m going to give it a go. :slight_smile:

I might add your .dts as a build step though, if I don’t get it working otherwise.


#6

OK, good luck with your project.