Raspberry Pi 4 + Linux Slackware ARM -current + Popcornmix's Kodi leia_pi4 18.x

Update 31.03.2020: It seems that the latest version of libgmp causes Kodi to segfault on some video plugins (for example plugin.video.netflix). If that is the case then please downgrade libgmp to a version below 10.4.0. I have tried "/usr/lib/libgmp.so.10.3.2" and it does not cause a segfault.

Please feel free to modify these steps and the attached slackbuild package if you need to.

Please note that this instruction is only for
Raspberry Pi 4 based on a fresh installation of Slackware arm current. If you have problems building your own Kodi package then please make sure you have upgraded your Slackware with the latest packages. For those of you who do not want to go through the below steps of building the package yourself you can download the complete Kodi package for Slackware arm here ( make sure the rpi-update + "# Setup some required libraries links" /boot/config.txt are set, see below ).  

This version of SlackBuild is taken from slaxbmc Kodi 17.6 Krypton at http://slackware.uk/slaxbmc/14.2/slaxbmcsrc-14.2/patches/xbmc/ (thanks to Konstantinos Mantzaris) and optimised according to instructions from Popcornmix's found on github at https://github.com/popcornmix/omxplayer/issues/714

Thanks to the great job made by Popcornmix creating pi4 packages for Linux and with the below instruction I was able to successfully build and install Kodi leia_pi4 18.x on the Raspberry Pi 4 with Slackware ARM. The configuration is adjusted to get the standalone version of Kodi (gbm)

--- Prerequisites Start ----

Please make sure that you have at least 32GB (64GB recommended) SD card on your Pi 4 and at least 1GB swap space (even when you have 4GB RAM, see errors below for more info). There is around 90 dependencies which will be downloaded into /usr/xbmc-tarballs/ by Kodi build and they need some space. You can also use some extra space for your local media archive.

Before we go ahead with preparations of the required packages, first you need to install Slackware ARM -current on your Raspberry Pi 4. I have done mine according to the instructions found at http://sarpi.fatdog.eu/.

After the Slackware ARM -current is installed please install and run the rpi-update && reboot to get the required mmal libs and headers in /opt/vc. Instructions can be found at http://sarpi.fatdog.eu/.
   
# Remove system FFmpeg to make sure Kodi build process picks its own optimized FFmpeg
removepkg ffmpeg

# Setup some required libraries links
echo '/usr/arm-linux-gnueabihf-debug/lib' >> /etc/ld.so.conf
echo '/opt/vc/lib' >> /etc/ld.so.conf

# Install java jdk

wget https://slackware.uk/sarpi/pkg/arm-current/jdk-8u261-armv7-1_slackcurrent_sp1.txz           
installpkg jdk-8u261-armv7-1_slackcurrent_sp1.txz


reboot


To avoid broken downloads and compiling errors
(see below errors) I highly recommend to download the needed dependency packages (listed here) from Kodi repository (http://mirrors.kodi.tv/build-deps/sources/) into /usr/xbmc-tarballs before continuing with the next steps.

--- Prerequisites End ----

    build & install Kodi:
install Kodi
    wget http://axes2solution.com/kodi/files/xbmc-leia_pi4-slackware.tar.gz
    tar xvf xbmc-leia_pi4-slackware.tar.gz
    cd kodi.leia
    wget https://github.com/popcornmix/xbmc/archive/leia_pi4_18.9-Leia.tar.gz
    ./xbmc.SlackBuild (will take a couple of hours)

    installpkg /tmp/xbmc-leia_pi4-18.9-arm-gbm.txz
   

If you have problems building Kodi then you may want to download the complete txz package here
( make sure the rpi-update + "# Setup some required libraries links" +
/boot/config.txt are set, see above )


edit the /boot/config.txt and make sure you have the following two set:
    gpu_mem=512 (please do not go above the 1GB limit or you won't boot your system)
    dtoverlay=vc4-fkms-v3d
 

If you want to run Kodi as user please make sure the user is added to groups:
       video
       input
    and
      
chown root.video /dev/vchiq /dev/vcio /dev/vc-mem /dev/rpivid*
       chmod 660 /dev/vchiq /dev/vcio /dev/vc-mem /dev/rpivid*


Add power options to Kodi for a user kodi ( put your own user which runs kodi ):

vi /etc/polkit-1/rules.d/30-kodi-power-options.rules
    polkit.addRule(function(action, subject) {
     if (action.id.indexOf("org.freedesktop.consolekit.system") == 0 &&
         subject.user=="kodi") {
         return polkit.Result.YES;
     }
    });


reboot  & enjoy!

    Errors:
        make[2]: *** [Makefile:19: /usr/xbmc-tarballs/libusb-0.1.12.tar.gz] Error 56
        make[2]: Leaving directory '/tmp/xbmc-leia_pi4/tools/depends/target/libusb'
        make[1]: *** [Makefile:128: libusb] Error 2
        make[]: *** Waiting for unfinished jobs...

        make[2]: *** [Makefile:28: /usr/xbmc-tarballs/gettext-0.19.8.tar.gz] Error 28
        make[2]: Leaving directory '/tmp/xbmc-leia_pi4/tools/depends/native/gettext-native'
        make[1]: *** [Makefile:64: gettext-native] Error 2

         /usr/bin/tar: Unexpected EOF in archive

        /usr/bin/tar: Unexpected EOF in archive
        /usr/bin/tar: Error is not recoverable: exiting now
       
            check the last downloaded tar archive in /usr/xbmc-tarballs/ if it is not corrupted and download it again and/or see the error below (increase swap space)

        g++: fatal error: Killed signal terminated program as

        compilation terminated.
        ./configure: line 41081: 12690 Killed
   
            make sure you have at least 1 GB of swap

                dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
                mkswap /var/swap.img
                swapon /var/swap.img


Last updated on 13.11.2020


WE TAKE NO RESPONSIBILITY FOR ANY DAMAGE OR HARM THAT MAY ARISE AS A RESULT OF YOUR OR ANYONE'S USE OF THIS INSTRUCTION.


Slackware® is a registered trademark of Patrick Volkerding and Slackware Linux, Inc.
Kodi is a trademark of the XBMC Foundation
Raspberry Pi™ is a trademark of the Raspberry Pi Foundation
Linux® is the registered trademark of Linus Torvalds