Rock 5B switch to mainline kernel

Is it recomended/safe to switch to the mainline kernel? I’m currently running 6.1.115-vendor-rk35xx on my Rock 5B.

If so, can you provide the steps needed in order to switch?

Also, will this automatically be done in some future version of Dietpi? Thanks.

Sorry for the late reply: Safe and recommended, unless you use Jellyfin (which does not support the mainline Linux VPU driver).

packages=('linux-image-current-rockchip64' 'linux-u-boot-rock-5b-current')
dpkg-query -l | grep -q '^ii[[:blank:]]*linux-headers-vendor-rk35xx[[:blank:]:]' && packages+=('linux-headers-current-rockchip64')
dpkg-query -l | grep -q '^ii[[:blank:]]*linux-libc-dev-vendor-rk35xx[[:blank:]:]' && packages+=('linux-libc-dev-current-rockchip64')
G_AGI "${packages[@]}"
G_AGP linux-{image,dtb,headers,libc-dev}-vendor-rk35xx
[[ -d '/boot/dtb' ]] || sudo dpkg-reconfigure linux-image-current-rockchip64
/boot/dietpi/func/dietpi-set_hardware flash-u-boot-mmc
sudo sed --follow-symlinks -i 's/ttyFIQ0/ttyS2/' /boot/dietpiEnv.txt
if systemctl -q is-enabled serial-getty@ttyFIQ0
then
	/boot/dietpi/func/dietpi-set_hardware serialconsole 0 ttyFIQ0
	/boot/dietpi/func/dietpi-set_hardware serialconsole 1 ttyS2
fi

Thank you so much for responding :smiley: .

I switched to the kernel using your instructions. I have a couple questions:

  1. Since I run dietpi on an nvme ssd, do I need to flash u-boot to SPI before I reboot the system?
  2. I use xfce as a desktop and since the switch, I notice that everything I open is so sluggish now (file browser, terminal, chromium, etc). For context, my monitor is connected via HDMI. I’m guessing that it has something to do with the GPU. On the about page in XFCE, GPU in vendor kernel says llvmpipe and in mainline kernel it says Mali-G610.
  3. How do I go back to the vendor kernel if I’m unhappy with the performance of mainline kernel (related to question #2)?
  4. Am I safe from those CVE problems that the dietpi team posted about several weeks ago? I’m currently on 6.18.29-current-rockchip64

Thank you so much for your help. I love Dietpi!

Edit: I noticed something strange related to question #2. Whenever my mouse is moving, the screen is frozen (except for the mouse cursor). For example, if i’m in a text editor and hold down the letter ‘d’ while the mouse is moving, I don’t see a list of d’s, but when I let go of the mouse they all appear. If I don’t move the mouse and hold down the letter ‘d’, I see them populate like normal. Something similar happens when watching youtube videos: video is choppy when the mouse is moving but smooth when not moving. Maybe this can help you guys diagnose the problem?

It wouldn’t hurt, but actually it is still the same vendor U-Boot sources.

Do you did reboot already? The GPU driver is of course a very different one. Check whether the panthor driver is loaded:

lsmod

It does probably not perform as good as the vendor driver yet, but it shouldn’t be “sluggish” for GUI elements.

Invert above steps:

packages=('linux-image-vendor-rk35xx' 'linux-u-boot-rock-5b-vendor')
dpkg-query -l | grep -q '^ii[[:blank:]]*linux-headers-current-rockchip64[[:blank:]:]' && packages+=('linux-headers-vendor-rk35xx')
dpkg-query -l | grep -q '^ii[[:blank:]]*linux-libc-dev-current-rockchip64[[:blank:]:]' && packages+=('linux-libc-dev-vendor-rk35xx')
G_AGI "${packages[@]}"
G_AGP linux-{image,headers,libc-dev}-current-rockchip64
/boot/dietpi/func/dietpi-set_hardware flash-u-boot-mmc
sudo sed --follow-symlinks -i 's/ttyS2/ttyFIQ0/' /boot/dietpiEnv.txt
if systemctl -q is-enabled serial-getty@ttyS2
then
	/boot/dietpi/func/dietpi-set_hardware serialconsole 0 ttyS2
	/boot/dietpi/func/dietpi-set_hardware serialconsole 1 ttyFIQ0
fi

Both are branches are safe in regards of Copy Fail and Dirty Frag vulnerabilities.

Hmm, I’ll try to replicate on another RK3588 board (I do not own any from Radxa). But if it is related to the driver, there is not much we can do, aside of verifying X11 loads with modesetting and glamor.

EDIT: Actually, the vendor kernel ships with Panthor as well. Could be checked as well via lsmod if loaded by default, IIRC it is.

I can replicate the general issue on the Orange Pi 5 Plus, that the GUI visually freezes, while the cursor is moving, with mainline + Panthor + X11 modesetting + glamor stack. This happens on all desktop environments and LightDM, regardless how it is started (service, console, root).

Is has been mentioned in the Radxa forum here, but indeed affects all RK3588 boards.

@usual-user
As you commented on that issue, and have more knowledge than me in this context: You did not comment the freezing GUI in particular, but verified that hardware acceleration and VPU are functional, which is true, and this on Wayland. The freeze is on a different level, probably specific to X11, like cursor plane updates prevent primary framebuffer syncs :thinking:. Did you ever face/test this on X11?

Worth to play with X11 settings, accelerator, page flipping, …

I’m glad to hear that I’m not the only one facing this problem. I’m not really good with linux/x11 and so I don’t really know how to change the settings to experiment. If you have time, could you do me a huge favor and tinker with them and let me know what works for you? Thank you SO much.

EDIT: I decided to switch back to vendor because the issue was unbearable for me since I use my Rock 5B as my daily driver. But I would like to switch back to mainline if the isssue gets fixed.

With mainline, I saw panthor loaded. With vendor, it isn’t and shows the following output. How do I load it?

Module Size Used by
wireguard 81920 0
libchacha20poly1305 16384 1 wireguard
chacha_neon 24576 1 libchacha20poly1305
libchacha 16384 1 chacha_neon
poly1305_neon 20480 1 libchacha20poly1305
ip6_udp_tunnel 16384 1 wireguard
udp_tunnel 20480 1 wireguard
libcurve25519_generic 36864 1 wireguard
binfmt_misc 20480 1
pwm_fan 20480 0
rk805_pwrkey 16384 0
hci_uart 110592 0
btqca 20480 1 hci_uart
btrtl 24576 1 hci_uart
btbcm 24576 1 hci_uart
btintel 36864 1 hci_uart
panfrost 61440 0
drm_shmem_helper 20480 1 panfrost
gpu_sched 40960 1 panfrost
input_leds 16384 0
joydev 24576 0
fuse 118784 1
nfnetlink 20480 1
ip_tables 28672 0
x_tables 28672 1 ip_tables
ipv6 462848 99 wireguard
r8169 77824 0
rockchip_cpuinfo 16384 0
uio_pdrv_genirq 16384 0
uio 20480 1 uio_pdrv_genirq

I see now: there are two nodes: gpu and gpu_panthor. The first defines itself as bifrost, hence loads the panfrost driver, and that one is enabled by default. The second defines itself (correctly) as valhall and hence loads the panthor driver, which is patched/backported from mainline Linux.

However, the “panfrost” driver from vendor kernel is surely a very different one than the same-named driver from mainline kernel. Would be actually interesting to get impressions whether panthor performs better, and whether it introduces the same cursor blocks with vendor kernel.

There is an overlay to switch to panthor on vendor kernel: add panthor-gpu to the overlays= line in /boot/dietpiEnv.txt, in case separated by space if it contains another overlay already. Note that these settings much not use any quotation, as the way these are loaded would take them literally. Verify with lsmod that the panthor module is loaded instead of panfrost.

I added panthor-gpu to overlays using vendor kernel. It’s loaded properly and works fine. No cursor blocks. Can’t speak to if it performs better… I don’t play any games on my Rock 5B.

Good to know that Panthor is not the issue in general with X11. But of course, the driver version is also a different one 1.8 in mainline vs 1.5 in vendor kernel sources … ah wait, on Linux 6.18 it is v1.5 as well. It got quite a bunch of commits since then.

If someone finds the time: the edge kernel could be tested, which would be only one commit behind master. But possible that the issue is at a different layer.

Gotcha. Is it safe for me to be using vendor kernel? I use my Rock 5B for daily computing tasks and don’t want to be hacked or have my passwords stolen.

I asked google ai about it. Will this work?:

1. Force a Software Cursor (Most Common Fix)
Your GPU or display server is struggling to render the hardware cursor in real-time, causing a hard freeze when the mouse moves.

  • Open your X11 configuration file (e.g., /etc/X11/xorg.conf or a drop-in file in /etc/X11/xorg.conf.d/).

  • In the Section "Device" block, add the following line:
    Option "SWCursor" "True"

  • Save the file and restart your X session or reboot.

If there were known major security issues with the kernel, we wouldn’t ship it. Copy Fail, Dirty Frag, and Fragnesia were mitigated by removing the respective kernel modules from our builds.

Using a software cursor is one of the things I wanted to test as well. Also disabling glamor can be tested:

Option "AccelMethod" "none"

and disabling page flipping:

Option "PageFlip" "0"

Thanks for the info. I’ll try it some time.