DVB issue since LE switched to kernel 4.9.x

  • mchehab I managed to get LibreELEC 8.2.2 with upstream 4.14.13 booting on RPi3. The process is a bit tricky/hacky and Kodi won't start - not sure if LibreELEC's Kodi can work at all on upstream kernel, could well be that the graphics layer relies on some downstream kernel changes. popcornmix should be able to tell more.


    The official way to use a different kernel in LE is to fully rebuild it from source, but this shortcut could be enough for a few quick tests:


    I've done this by starting with a plain LE 8.2.2 installation on sdcard - it'd probably be best if you follow the same route, then you can enable ssh and install tvheadend from Kodi. Even if kodi won't work with upstream kernel tvheadend should run and you can test it over the net.


    LE uses an initrd to mount the read-only rootfs (that's the SYSTEM) file on the FAT partition. It's compresses with LZ4 so you'll also need to enable LZ4 squashfs support in the kernel.


    I used this (hacky) script to extract the initramfs from the kernel image (KERNEL file on FAT partition):

    I started that with "./extract-initramfs KERNEL initrd-8.2.2" and copied the initrd-8.2.2 file to the root of the FAT partition. Fortunately there are no kernel modules in the initramfs, so we don't need to change that.


    I then compiled a 32bit (ARCH="arm") upstream kernel using multi_v7_defconfig. I patched the the rpi3 DT so I could use PL011 as serial console and manually enabled CONFIG_SQUASHFS_LZ4. Then I copied zImage and the bcm283*.dtb files to a "upstream" directory on the FAT partition.


    To get the upstream kernel booting I used these additional settings in config.txt - the initramfs entry brings in the previously extracted initrd

    Code
    1. [PI3]
    2. kernel=upstream/zImage
    3. device_tree=upstream/bcm2837-rpi-3-b.dtb
    4. avoid_warnings=2
    5. initramfs initrd-8.2.2

    and this cmdline.txt:

    Code
    1. boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ssh root=/dev/ram0 console=ttyAMA0,115200 earlycon=pl011,mmio32,0x3f201000

    This is enough to get LE booting, but the initramfs will complain loudly because it doesn't find matching kernel modules in the rootfs (SYSTEM file) - after a minute it will continue booting up, but of course without modules it's a bit meh.


    So I simply installed the modules to a temp directory on my PC, unsquashed the SYSTEM in a fakeroot, copied the modules into the unsquashed rootfs and then ran mksquashfs

    Code
    1. cd ~/upstream-kernel
    2. mkdir /tmp/modules
    3. INSTALL_MOD_PATH=/tmp/modules make modules_install
    4. cd ~/le-test
    5. fakeroot
    6. unsquashfs SYSTEM
    7. cp -r /tmp/modules/lib/modules/4.14.13-dirty squashfs-root/usr/lib/modules/
    8. mksquashfs squashfs-root SYSTEM-4.14 -comp lz4

    Then I copied that SYSTEM-4.14 file to the root of the FAT partition, naming it SYSTEM. LE then booted up fine and could load at least some modules.


    Hope I didn't miss an important step, if you have problems or questions just ping me.


    so long,


    Hias

  • @HiassofT: Thanks for the detailed explanation! it worked as a charm.
    The only detail is that here, I installed it via NOOBS, dual-booted with raspbian and LibreELEC. The kernel image file is named kernel.img. I'm also using the standard serial interface (with is ttyS1 on Kernel 4.14), instead of PL011.


    It is funny that Kodi didn't work. I don't think it is due to a DRM module, as 4.14 comes with VC4 driver (with is enabled here and works on raspbian here). Maybe it requires some other Kernel feature that it is not enabled (like some namespace feature). Anyway, this shouldn't matter for tvheadend to work. The only thing is that, without Kodi, it won't be possible to test recording while watching a movie on RPi.


    As a reference, this is my .config file, with contains several media drivers enabled:


  • Yeah, the issue with Kodi is due to some VC4 issue:

    * failed to open vchiq instance

    Segmentation fault (core dumped)

    Crash report available at /storage/.kodi/temp/kodi_crashlog_20180112123144.log

  • Kodi / LibreELEC on RPi doesn't use the vc4 drm driver, AFAIK it uses the (downstream) bcm2708 framebuffer driver and the (also downstream) video core shared memory driver (vcsm) to interface to the GPU.


    Could well be that other downstream drivers are involved, but I leave this to popcornmix to answer, he's the expert in this area, my knowledge about RPi graphics stuff is quite limited.


    so long,


    Hias

  • Part of the fix for upstream Kernel is to add vchiq DT data:


    That makes it to create /dev/vchiq devnode.

    With that, kodi doesn't crash anymore, but those messages are generated:


    Code
    1. [ 6.846340] vchiq: module is from the staging directory, the quality is unknown, you have been warned.
    2. [ 6.851573] vchiq: vchiq_init_state: slot_zero = ea880000, is_master = 0
    3. [ 7.027647] [<bf00c794>] vchiq_doorbell_irq [vchiq]
    4. [ 8.022814] Modules linked in: cfg80211(+) vc4(+) snd_soc_core ac97_bus snd_pcm_dmaengine snd_pcm snd_timer snd crc32_arm_ce brcmutil soundcore vchiq(C)
    5. [ 106.220212] vchiq: vchiq: connect: could not lock mutex for state 0: -4
    6. [ 149.432097] vchiq: vchiq: could not connect: 1


    Maybe vchiq DT data changed since Kernel 4.11 (the last time I used my RPi3).

  • Hey all,


    I have x86_64 with 8.2.0 (kernel 4.11.12) and have issues with dvb. I have a DVBSky T9580 V3.

    Could somebody provide me a 8.2.2 release with linus torvalds fix?


    Best regards,

    Marcel

  • Hi jahutchi


    Just want to thank you for taking the time for finding this commit. Watching TV is a pleasure now without those artifacts.


    We owe ya one bud 👍


  • Thanks, but stupid Question: How can I update my system with these files? Usually I place these images (img.gz) in the update folder of libreelec.

    Can I create an image of your files?


    Best regards,

    Marcel

  • LE 8.2.3 will be released with the revert/fix included this evening. Then the default/normal in-GUI update process can be used.

  • Just so there is no confusion - LE 8.2.3 will include the revert of the ksoftirqd commit which is just a short-term/interim solution (but one we know works, particularly with the older 4.11.y kernel in 8.2.x). Hopefully a better long term fix will be added upstream, maybe along the lines of the suggestion from Linus, in time for LE 9.0.

  • Hey guys,


    I applied the 8.2.3, but I still have some artifacts when watching some TV channels. But I dont see continuity errors in the tvheadend webinterface.

    I have a PCIe DVBSky T9580 V3.

  • But I dont see continuity errors in the tvheadend webinterface.

    Then It's an unrelated issue.

    Quote

    I have a PCIe DVBSky T9580 V3

    I don't think that PCIe cards are even affected by the kernel softirq problem.

  • Hey guys,


    I applied the 8.2.3, but I still have some artifacts when watching some TV channels. But I dont see continuity errors in the tvheadend webinterface.

    I have a PCIe DVBSky T9580 V3.

    Hi all,


    Thanks for the hard work resolving these DVB issues. I'e updated to 8.2.3 and thought I'd mention that I'm also still getting artifacts on mpeg DVB streams. Usually every 5 seconds or so when there's fast motion eg. F1 racing. Turning de-interlace off doesn't make a difference.


    This happens on both my USB and PCI tuners. I'm running generic build 8.2.3 with this (old) hardware :


    Intel core2duo T9500

    Nvidia GT218

    DVBSky T982

    Sundtek MediaTV Pro


    Given that the fix for the issue jahutchi resolved is now released, is there also some other unidentified problem that came with LE 8 ?


    Cheers,


    Neil

  • This happens on both my USB and PCI tuners. I'm running generic build 8.2.3 with this (old) hardware :

    Record some program and play it at your PC (VLC ...) and have a look if the same problems appear there. Is quite possible that your gpu (driver) the the problem.

  • Record some program and play it at your PC (VLC ...) and have a look if the same problems appear there. Is quite possible that your gpu (driver) the the problem.

    Hi CvH,


    Thanks for quick reply and thanks for your help (again lol).


    OK I can confirm that the recorded stream plays fine on PC. The recording plays back with the same artifacts on LE.


    Any suggestions on how I could possibly resolve ?

  • I can confirm that the recorded stream plays fine on PC. The recording plays back with the same artifacts on LE.


    Any suggestions on how I could possibly resolve ?

    Have you enabled hardware acceleration (VDPAU in your case) in settings>system>display?


    My graphics card is also NVidia ION-based, and my machine cannot cope unless i turn on the h/w acceleration.


    Also, is your cpu overloaded when playing back the stream? As this would be another indicator that the stream is not being decoded by your gpu.