Kodi 18.0 - codename Leia has been released, it contains a lot of optimizations and it's apparently able to play DRM content (NetFlix, Amazon Prime, etc. included).
Announcement:
https://kodi.tv/article/kodi-180
The build method has changed, somewhat simplified/automated, it's all wrapped in cmake now, not really properly documented for Raspberry builds and a little difficult to fine-tune/optimize.
But I did receive some proper help and I'm thankful for that.
Inspiration&Credits&Thanks:
- first, The Kodi Team
- then:
https://github.com/xbmc/xbmc/blob/ma...EADME.Linux.md
https://forum.kodi.tv/showthread.php?tid=340082
(I'm not so familiar with cmake and had to ask for help for the Raspberry target compilation details)
Important!
Before you follow the instructions presented here, look after & read the follow-up posts from this thread, as they may contain some corrections or adaptations.
Due to the way LQ works, I won't be able to update this original post after a while.
If you already have Kodi 17.x installed and would like to upgrade it, you'll be able to - upgrade is supported. Backup your /home/kodi/.kodi/ directory (just in case), uninstall the previous Kodi version, make sure you manually delete the 3-4 directories removepkg will not delete and install this version.
Do not launch it in case you built some add-ons for Kodi 17.x, you'll need to rebuild them - follow the ADD-ONS sections from this How-To for the details.
As with Kodi 17, I'll cover both Slackware ARM releases and the Raspberry P1 1/0, Pi2B, Pi3B boards:
Using "pi1" will imply Slack ARM 14.2 - SoftFloat on armv6 (RaspberryPi 1/0)
Using "pi2" will imply Slack ARM current - HardFloat on armv7 (RaspberryPi 2B)
Using "pi3" will imply Slack ARM current - HardFloat on armv8 (Raspberry Pi3B(+))
To avoid any confusions, I'm going to use absolute paths in my instructions and again using /kit/kodi-slack-build/ as the top tree for the compilation work.
There will be some steps you might find absurd, but you'll find the reasons behind them in the Kodi Forum thread I posted above.
During the Kodi compilation, you'll need to be online, because the Kodi build scripts will need to download a few source packages.
Edit: - some more "idiot-proof-ness"
Prepare the working directory and enter the deps subdirectory for resolving the dependencies first.
If you're not building as the user root (I do it all the time), then don't forget to chown (needs root privileges) the working directory for your user.
Substitute
your-username with your actual user in the command in bold from the following section:
Code:
# as root
mkdir -p /kit/kodi-slack-build/
# then, only if you're not building as root
chown -R your-username:users /kit/kodi-slack-build/
# exit root / switch to your user if you're not planning to stay & build as root
mkdir -p /kit/kodi-slack-build/deps/
cd /kit/kodi-slack-build/deps/
--- DEPENDENCIES ---
The dependencies, plenty of, are the same as with Kodi 17, and there are some more.
1. FFmpeg:
- there are 3 ways I documented to build the required FFmpeg 4.x for Kodi:
a. The way the Kodi Team is doing with their "endorsed" FFmpeg 4.0.3-Leia-RC5.tar.gz (OMX Player is broken):
https://www.linuxquestions.org/quest...5/#post5958276
b. The way FFmpeg 4.0.3-Leia-RC5.tar.gz is officially designed to support the MMAL & OMX HW Acceleration (OMX Player is broken):
https://www.linuxquestions.org/quest...ml#post5956641
c. The way FFmpeg 4.1 is officially designed to support the MMAL & OMX HW Acceleration (OMX Player is broken):
https://www.linuxquestions.org/quest...5/#post5960801
- in any of these 3 cases don't forget to resolve the FFmpeg dependencies described here:
https://www.linuxquestions.org/quest...7/#post5751491
- build it & install it, run ldconfig
- there is a possibility to let Kodi build FFmpeg internally&statically (highly recommended), but ATM the FFmpeg configure script is broken and I'm not sure if the compiler CPU optimization flags are passed to the FFmpeg build and if the Raspberry specific FFmpeg HW accelerations are enabled (MMAL, OMX) by cmake.
- to build FFmpeg internally/statically, make sure you have no FFmpeg available on the system, Kodi won't find one to link with, and do some investigation and patching in the files: CMakeLists.txt, autobuild.sh, Makefile, before you start the Kodi compilation. There you could also patch the configure script.
https://github.com/xbmc/xbmc/tree/ma.../target/ffmpeg
- just in case you're interested, these files will be available in your /kit/kodi-slack-build/xbmc-18.0-Leia/tools/depends/target/ffmpeg/ folder.
2. for java / libbluray (this should be already available in Slackware ARM) / libgpg-error / lirc / yajl follow the dependencies section from Kodi 17:
https://www.linuxquestions.org/quest...2/#post5759079
- there might be newer versions available for all of the above - I didn't bother to upgrade
- alternatively, look for slackbuilds at
http://www.slackbuilds.org/
3. tinyXML
http://www.slackbuilds.org/repositor...aries/tinyxml/
- use the Slackbuild fix (add -fPIC) that stormtracknole presented here:
https://www.linuxquestions.org/quest...ml#post5897038
4. fstrcmp - no slackbuild available
Code:
wget http://fstrcmp.sourceforge.net/fstrcmp-0.7.D001.tar.gz
tar -xzpf fstrcmp-0.7.D001.tar.gz
cd fstrcmp-0.7.D001/
./configure
make && make install
ldconfig
cd /kit/kodi-slack-build/deps/
# or, create a package
# https://docs.slackware.com/howtos:slackware_admin:building_a_package
5. rapidjson
http://slackbuilds.org/repository/14...ies/rapidjson/
for pi2 & pi3 - Slackware ARM -current, use ponce's slackbuild:
https://github.com/Ponce/slackbuilds...ries/rapidjson
and patch it according to this post:
https://www.linuxquestions.org/quest...0/#post5956599
6. libxkbcommon
http://slackbuilds.org/repository/14.../libxkbcommon/
7. only for pi1 you'll need libinput and there's a little extra effort to put in building its deps.
- build & install these in the following order:
http://www.slackbuilds.org/repositor...ython/python3/
http://www.slackbuilds.org/repositor...lopment/ninja/
http://www.slackbuilds.org/repository/14.2/python/pip/
then follow:
https://stackoverflow.com/questions/...ide-python-2-x
run:
Code:
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
- the above will install the python3 module setuptools needed by meson
http://www.slackbuilds.org/repositor...lopment/meson/
http://slackbuilds.org/repository/14...ries/libwacom/
and finally:
http://www.slackbuilds.org/repositor...ries/libinput/
8. CEC support - if you want to control Kodi through your CEC enabled TV set (works through HDMI)
http://slackbuilds.org/repository/14...raries/libcec/
9. libmicrohttpd - only needed if you plan to control Kodi remotely and unsecurely (doesn't use HTTPS) through a web browser or the official Kodi android remote application (Kore)
http://slackbuilds.org/repository/14...libmicrohttpd/
- just for reference:
https://kodi.wiki/view/Kore
10. don't forget to run:
--- DEPENDENCIES END ---
--- COMPILATION ---
- get the source code and unpack it:
Code:
cd /kit/kodi-slack-build/
wget https://github.com/xbmc/xbmc/archive/18.0-Leia.tar.gz
tar -xzpf 18.0-Leia.tar.gz
- preparing the compilation environment:
- only for pi1, the Kodi build scripts will look after /usr/bin/grep
Code:
cp /usr/sbin/grep /usr/bin/grep
- absurd step - playing hide and seek - uninstall mesa as the build scripts from Kodi will link to it. You'll install it back after the Kodi compilation (if you don't forget about it).
Code:
ls -al /var/log/packages/mesa*
# get the name and then remove it - substitute mesa-name with the actual package name
removepkg /var/log/packages/mesa-name
- to get it back, just run:
Code:
slackpkg install mesa
- edit the project build script for optimizing the compiler flags:
/kit/kodi-slack-build/xbmc-18.0-Leia/cmake/scripts/linux/ArchSetup.cmake
- for pi1 modify the CPU flags section like this:
Code:
elseif(CPU STREQUAL arm1176jzf-s)
set(ARCH arm)
set(NEON False)
set(NEON_FLAGS "-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft")
- for pi2 and pi3 modify the two CPU flags sections (ATM only modifying the second section would suffice, but better be sure and mod both) like this:
Code:
elseif(CPU MATCHES "cortex-a7")
set(ARCH arm)
set(NEON True)
set(NEON_FLAGS "-fPIC -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard")
elseif(CPU MATCHES "cortex-a53")
set(ARCH arm)
set(NEON True)
set(NEON_FLAGS "-fPIC -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard")
&
Code:
# temp until further cleanup is done
# add Raspberry Pi 2 and 3 specific flags
if(CORE_PLATFORM_NAME_LC STREQUAL rbpi)
if(CPU MATCHES "cortex-a7")
set(NEON_FLAGS "-fPIC -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard")
elseif(CPU MATCHES "cortex-a53")
set(NEON_FLAGS "-fPIC -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard")
endif()
endif()
- set up the environment and prepare the cmake project.
- create the working directory - cmake project directory:
Code:
mkdir /kit/kodi-slack-build/kodi-build/ && cd /kit/kodi-slack-build/kodi-build/
- for pi1 run:
Code:
export PATH="$PATH:/opt/java/bin"
CFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft"
CXXFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft"
cmake ../xbmc-18.0-Leia -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/vc -DENABLE_INTERNAL_CROSSGUID=ON -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_FMT=ON -DCORE_SYSTEM_NAME=linux -DCORE_PLATFORM_NAME=rbpi -DWITH_CPU=arm1176jzf-s -DCMAKE_C_FLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft" -DCMAKE_CXX_FLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft"
- for pi2 run:
Code:
export PATH="$PATH:/opt/java/bin"
CFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard"
CXXFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard"
cmake ../xbmc-18.0-Leia -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/vc -DENABLE_INTERNAL_CROSSGUID=ON -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_FMT=ON -DCORE_SYSTEM_NAME=linux -DCORE_PLATFORM_NAME=rbpi -DWITH_CPU=cortex-a7 -DCMAKE_C_FLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard" -DCMAKE_CXX_FLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard"
- for pi3 run:
Code:
export PATH="$PATH:/opt/java/bin"
CFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard"
CXXFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard"
cmake ../xbmc-18.0-Leia -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/vc -DENABLE_INTERNAL_CROSSGUID=ON -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_FMT=ON -DCORE_SYSTEM_NAME=linux -DCORE_PLATFORM_NAME=rbpi -DWITH_CPU=cortex-a53 -DCMAKE_C_FLAGS="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard" -DCMAKE_CXX_FLAGS="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard"
- in all cases follow the output of cmake and look after unresolved dependencies - you might want to add something.
- to restart the process, just clean the content of /kit/kodi-slack-build/kodi-build/ and start over again with the last cmake command, don't forget to cd to that dir:
Code:
cd /kit/kodi-slack-build/kodi-build/
- if everything went well, you can start the compilation, but first some considerations about the space&time(continuum).
I used a Pi 2B loaded with Slackware ARM 14.2 SF and 4 make jobs to build for Kodi Pi Zero and I had 960MB RAM available (set the GPU RAM on 32MB for the compilation period). Even so, it was using my swap on a few occasions, writing around 60MB in it. The compilation took well over 4 hours!
On the native Pi 2B compilation under Slackware ARM -current (new toolchain), I could only use 3 make jobs, because with 4 jobs the compilation crashed - at around 30% during the build, it went over both the available RAM and the 200MB swap space. This compilation took around 5-6 hours!
- on pi1, make sure you're still in the /kit/kodi-slack-build/kodi-build/ directory, run:
Code:
nohup cmake --build . -- VERBOSE=1 -j 1 2>&1 | tee kodi-build.log &
- on pi2 and pi3, make sure you're still in the /kit/kodi-slack-build/kodi-build/ directory, run:
Code:
nohup cmake --build . -- VERBOSE=1 -j 3 2>&1 | tee kodi-build.log &
- go out and play, or take a nap and tail the kodi-build.log from time to time, the cmake will inform you about the stage of the build [percentage%]
- if your build is successful, you'll end up with something like this:
Code:
gmake[2]: Leaving directory '/kit/kodi-slack-build/kodi-build'
[100%] Built target kodi
gmake[1]: Leaving directory '/kit/kodi-slack-build/kodi-build'
/usr/bin/cmake -E cmake_progress_start /kit/kodi-slack-build/kodi-build/CMakeFiles 0
--- COMPILATION END ---
--- INSTALLATION ---
- the compilation results will be available in /kit/kodi-slack-build/kodi-build/ and you only need to run make install in that directory, or, create a package:
https://docs.slackware.com/howtos:sl...ding_a_package
- for those of you lazier than me, I didn't write a slackbuild for this compilation, here is what I did - copy-paste:
Code:
cd /kit/kodi-slack-build/kodi-build/
rm -rf /tmp/build
mkdir /tmp/build
make install DESTDIR=/tmp/build
strip -s /tmp/build/usr/local/lib/* /tmp/build/usr/local/bin/*
cd /tmp/build
mkdir install/
cd install/
mcedit slack-desc
- put the following in slack-desc
Code:
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
kodi: kodi 18 - Leia
kodi: Raspberry Pi specific compilation
- then back in the console:
Code:
cd /tmp/build/
makepkg -l y -c n ../kodi-18-0-Leia-Raspberry-1-2-3-SF-HF.tgz
mv /tmp/kodi-18-0-Leia-Raspberry-1-2-3-SF-HF.tgz /kit/kodi-slack-build/
cd /kit/kodi-slack-build/
rm -rf /tmp/build/
rm -rf /kit/kodi-slack-build/kodi-build/
- for a new installation, just install the package:
Code:
installpkg /kit/kodi-slack-build/kodi-18-0-Leia-Raspberry-1-2-3-SF-HF.tgz
--- INSTALLATION END ---
- If this is your first installation, DO NOT yet launch Kodi!
--- ADD-ONS ---
- some important add-ons that you need to build. Prepare the working dir:
Code:
mkdir -p /kit/kodi-slack-build/addons-18/ && cd /kit/kodi-slack-build/addons-18/
- the platform add-on, required to be able to build&install other add-ons:
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/Pulse-Eight/platform.git
cd /kit/kodi-slack-build/addons-18/platform/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- the kodi-platform add-on, required to be able to build&install other add-ons:
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/xbmc/kodi-platform.git
cd /kit/kodi-slack-build/addons-18/kodi-platform/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- the pvr.hts add-on, in case you want to connect to a TVheadend backend and watch TV:
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/kodi-pvr/pvr.hts.git
cd /kit/kodi-slack-build/addons-18/pvr.hts/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- the inputstream.adaptive add-on, might be required for some other add-ons (listening/watching online streams):
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/peak3d/inputstream.adaptive.git
cd /kit/kodi-slack-build/addons-18/inputstream.adaptive/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- the rest of the add-ons you can install from within the Kodi GUI > Add-Ons - from their official repository
--- ADD-ONS END ---
--- CLEAN UP ---
- install back mesa!
- clean ccache
- only for pi1, remove the grep alter ego
Code:
rm -f /usr/bin/grep
--- CLEAN UP END ---
- in my previous Kodi 17 How-To I wasn't using proper formatting (was new on LQ, and on forums in general) and the kodi user setup section looks pretty bad, here you have it again:
- create the kodi user & group and add the user to the required groups:
Code:
groupadd kodi
adduser kodi
- for the user kodi use the following settings:
Code:
Group: kodi
Directory: /home/kodi
Shell: /bin/bash
- add kodi to the required groups (you might want to add some more, related to storage/power/etc.):
Code:
usermod -a -G cdrom,audio,video,plugdev,input,pulse,messagebus kodi
- the /kit/glx and /kit/glkodi scripts from this post (towards the end of the post) might be required:
https://www.linuxquestions.org/quest...2/#post5759079
- launch kodi:
Code:
/usr/local/bin/kodi
- the configuration hasn't changed too much and you can use the hints I provided in the Kodi 17 How-To post, again the very end of the post - section ------Configuration - Optimization--------
https://www.linuxquestions.org/quest...2/#post5759079
Sharing my personal experience, Kodi 18 doesn't run well on Raspberry Pi Zero (audio&video stuttering) with OMX and analogue out, there are reports in the Kodi Forum about Pi 2B too, and the FFmpeg is in a RC state.
That doesn't mean it won't work well over digital audio - HDMI, the GPU will be less busy with the analogue audio generation.
I'll stick with the solid Kodi 17.4 for the moment. Just wanted to write down all these instructions because I'll forget the details soon, getting older...

Go on and play with it, maybe on a more powerful Pi3B it's running fine with OMX and analogue out, although the GPU is the same on all boards.
Enjoy! And do "annoy" me with errors/inconsistencies you spot in this post & with Slackware/Raspberry related questions.

For the Kodi related ones please address the Kodi Forum.