Kernel choice in LibreELEC (Matrix) 10.0.3 for Raspberry Pi 2B

  • Hi!

    I was struggling to replicate the Kodi 19.4 build from LE 10.0.3 on my own on a Raspberry Pi 2B and found out that apparently my kernel, upstream Raspberry official 5.15.33 release, is to new - Kodi makes it crash.

    More detail in the Kodi official forum here:

    Failing to build Kodi Matrix 19.4 on Raspberry Pi 2 - cmake issues

    Kernel crash:

    Kernel crash - Pastebin

    Noticed that LE 10.0.3 uses a pretty old kernel 5.10.110 and was wondering why. I presume it's because of the DRM/vc4 support & stability.. (?)

    I'm planing to grab the latest kernel code from Raspberry and build a new kernel (mainly due to the recent WiFi exploits) and worried now that it won't help with my Kodi issue.

    Any inputs/help appreciated.

    Planning to grab the latest code from here:

    https://github.com/raspberrypi/linux


    Noticed that there is plenty of (development) activity on the drm/vc4 driver:

    https://github.com/raspberrypi/linux/commits/rpi-5.15.y/drivers/gpu/drm/vc4



    P.S. It's my first post here and I'm shocked about how weird the forum engine works. Auto formatting like crazy and plenty of google toxic content (icons/fonts) that my browser is blocking... :cry:


  • Go to Best Answer
  • LE fixes a kernel major version for a specific release and then sticks with it. So LE10.x is built around 5.10.x (on RPi at least) and on LE11 we're currently at 6.0 but will probably end up on 6.2 by the time we enter beta and lock the kernel version. There's no trick to it, or penalty for being on 5.10 in the current stable release. If you want to replicate our stability you'll need to replicate all the same major versions and the patches that we use; kernel, kodi, mesa, firmware, etc. - it's not just the kernel.

  • Thank you chewitt for your help (nice nickname BTW). Well, you just mentioned the "trick to it" - the orchestration of patches ;)

    I could use LE and save myself from all these problems, but I have two big issues with LE .. that are not LE related. First I need to patch an USB DVB driver (also running tvheadend on the same system) and then I can't use Kodi without being able to simulate a shut down (shutdown timer). For the latter I need to hack a few power management source files - trivial stuff - just canceling some conditional statements and setting some bool values on true (like canShutDown), because I don't have any idea how to fake a user being able to shutdown without actually being able to in polkit. And .. shutting down a media center (a computer like Raspberry Pi) is IMO utter stupidity when it comes to comfort/normal usage

    Now, I played with Kodi 17 & 18, compiled and patched it a lot of times, still using Kodi 17 for years now, very stable, but it never occurred to me to crash a system due to Kodi. I believe this DRM & GBM implementation is still a work in progress and in my latest compilation I applied all the patches I could find for both FFmpeg & Kodi. The firmware I could use from LE, but I couldn't find kernel patches in the LE repo on github.

    Could you (or someone else that knows) be so kind and point me to the folder where I could inspect and cherry pick the kernel patches applied for the Raspberry Pi2/3 kernel?

    Thank you (again) in advance.

  • We are using pretty stock RPi kernels, from https://github.com/raspberrypi/linux (rpi-5.10.y branch for LE10, currently rpi-6.0.y for LE11, we'll switch to the LTS kernel, probably 6.1, when it's out as RPi folks use LTS kernels as a base, too).

    We only apply a few patches on top, you can find them in the packages/linux/patches/raspberrypi directory, eg here for LE10:

    LibreELEC.tv/packages/linux/patches/raspberrypi at libreelec-10.0 · LibreELEC/LibreELEC.tv
    Just enough OS for KODI. Contribute to LibreELEC/LibreELEC.tv development by creating an account on GitHub.
    github.com

    The only somewhat important patch is

    linux-020-eld-constraints-for-compressed-formats.patch - it's a bit hacky but helps getting TrueHD/DTS HD passthrough with some TVs/AVRs (most TVs/AVRs are fine without it).

    so long,

    Hias

  • Ah, and our config.txt might also play an important role. The LE specific settings are in distroconfig.txt (which is included in config.txt)

    LibreELEC.tv/distroconfig.txt at libreelec-10.0 · LibreELEC/LibreELEC.tv
    Just enough OS for KODI. Contribute to LibreELEC/LibreELEC.tv development by creating an account on GitHub.
    github.com

    Most important bit for RPi4 is using 512MB of CMA memory - otherwise several 4k HDR files lead to a crash (the default of 256MB CMA is not enough).

    so long,

    Hias

  • Thanks HiassofT !

    I was particularly looking after patches for the DRM & vc4 & v4l drivers, because apparently those look to be the ones causing my system to freeze.

    My Kodi 19.4 compilation tries to open the display and fails, freezing the system without any log entries (kernel included). Freezing so bad that I have to unplug the power cord (even freezing the ssh session). I was able to capture the kernel log I provided in my first post only once by killing Kodi manually immediately after I started it, a few more seconds and it would have been bye bye...

    Thank you for providing me with the path to the kernel patches, don't know why I didn't see them myself.

    None of those patches are interesting for my use case, I'll compile a new kernel without them. I just wanted to be sure I don't need something extra before starting the compilation.

    I'm only focusing on Pi2 & Pi3 (actually Pi Zero 2) and the content I'm playing is max. 1080p (50/60fps too). As for the sound, some PVR channels have 5.1 format, but I'm manually choosing 2 channels stereo sound format (all of them have multiple sound stream formats to choose from).

    In my config.txt I'm only loading the new gpu driver with:dtoverlay=vc4-kms-v3d

    For the GPU mem part (again inspired by LE 10.0.3) I'm using gpu_mem=76 and no CMA defined. Speaking of CMA, that's again a variable that is not well documented. The lowest value I observed to be 256, but on Kodi 17.4 with legacy vc4 driver (vc4-kms-v3d not loaded) I'm using gpu_mem=192 and it fits Kodi just fine, 128 could be also enough.

    Will set this thread on resolved, since both of you helped a lot and I have now the answers I was looking after,

    Thank you again!(both)