PREEMPT-RT Kernel

Has anyone been able to compile a Linux kernel with PREEMPT-RT patches for the Rock Pi 4?

Regards!

1 Like

Yesterday I tried to apply latest RT patch to the radxa’s kernel repo. The result is 15 files with rejected hunks (about 10 Kb in total, RT patch size is 1Mb). All rejected hunks must be added manually. And kernel building results is undefined (:

One more possible solution - using the develop-4.4-rt176 branch from the upstream rockchip repo.

Here is my topic about this - What about RT linux?

Thanks for your feedback!

My current status trying to get a RT kernel to run:

Branch develop-4.4-rt from github/radxa does not have the correct DTS for Rock Pi 4. After copying necessary files (rockpi4-linux.dts, rk3399.dtsi, rk3399-linux.dtsi, rk3399-opp.dtsi) the kernel builds, but hangs in an endless loop while starting (failed to bind ff960000.dsi). I could not find enough useful information on Google to resolve this.

Branch release-4.4-rockpi4 with version 4.4.154 can be patched with patch-4.4.157-rt174.patch; the patch needs to be adapted slightly to fit the modified Radxa kernel tree. Additional patches for drivers/input/keyboard/rk_keys.c and drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pno.c were necessary to fix build errors (diffed from develop-4.4-rt).

The resulting kernel boots, but will panic as soon as peripheral hardware (e.g. WLAN) is accessed, due to improper use of the new interrupt framework in the RT kernel. To resolve this, it would be necessary to adapt all the additional drivers not present in mainline 4.4, but present in Radxa 4.4 for use with PREEMPT_RT.

I decided to wait for PREEMPT_RT 5.1 to become available and try again with a mainline kernel.

Kind regards,
Andreas

1 Like

another approach is to use instead of single preempt-rt patch quilt patch queue archive
it is easier to figure out which one failed.
in fact debian rt images are made this way

https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.4/older/patches-4.4.144-rt161.tar.xz

is there documentation how to generate kernel (repos config etc)?

i need 4.4 with rt on rockpi s

regards indy

what about disable wifi

Hi indy,

Might help, but from later experiments I would assume that WLAN is not the only driver that is affected.

After the availability of kernel 5.4.y and the corresponding patch, I switched to a mainline kernel. Around the beginning of this year it regularly panicked trying to access devices over MDIO; neither WLAN nor ethernet were useable:

[ 123.879355] 002: Call trace:
[ 123.879629] 002: mdiobus_get_phy+0x4/0x20
[ 123.880006] 002: __dev_open+0xc0/0x170
[ 123.880363] 002: __dev_change_flags+0x164/0x1d0
[ 123.880787] 002: dev_change_flags+0x20/0x60
[ 123.881180] 002: devinet_ioctl+0x3e8/0x750
[ 123.881566] 002: inet_ioctl+0x1f4/0x370
[ 123.881930] 002: sock_do_ioctl+0x48/0x2c0
[ 123.882308] 002: sock_ioctl+0x374/0x4a0
[ 123.882672] 002: do_vfs_ioctl+0xb8/0xae0
[ 123.883043] 002: ksys_ioctl+0x78/0xb0
[ 123.883391] 002: __arm64_sys_ioctl+0x1c/0x30
[ 123.883792] 002: el0_svc_common.constprop.2+0x88/0x150
[ 123.884269] 002: el0_svc_handler+0x20/0x80
[ 123.884655] 002: el0_svc+0x8/0xc
[ 123.884955] 002: Code: 00000000 00000000 00000000 8b21cc00 (f941c000)
[ 123.885529] 002: —[ end trace 69e2f303956fa148 ]—

At that point I gave up, sold the hardware and switched to Raspberry Pi 4. Pi’s hardware is inferior, but the kernel tree is better by orders of magnitude. This system is up and running a 5.4.y-rt kernel patched regularly from the vendor’s github repository.

My personal view is, that arm64 within the mainline kernel will need 1-2 years more to mature.

Kind regards,
Andreas

what about 5.6 tree where ended rk3308 patches?

5.6.y-rt was not available before April. From what I read elsewhere, support for Rockchip improved with this kernel release.

Hi luc, I am new in the rock pi platform and I want to know how to install rt-patch in my rock pi 4b. It looks that you finally achive this goal. Please, can you tell us how to do it? maybe in a tutorial or something like this. Please, it will help me a lot.

Thanks in advance to read my message.
abvg.

Hi abvg,

Essentially, I used a mainline kernel, at that time 5.4.y and the corresponding PREEMPT_RT patch. It booted, but had problems with the SDIO subsystem.

For the firmware build I rely on Buildroot (buildroot.org). Support for Radxa has been removed 2021 and the defconfig will probably not work without adaption. If you are willing to familiarize yourself with Buildroot, the old config still exists on Github.

It might be a good idea to start with a fresh Buildroot installation and only copy the parts that are needed. The SD card layout might be useful, kernel and uboot configuration should be adapted from mainline.

Board specific parts are in board/radxa/rockpi4.

Regards,
luc