I compiled here some basic instructions and tips to build Kodi on your RockPi X and have a good experience with the board.
The tips below can be optimized or simplified depending on your skill and knowledge, feel free to extend, modify or fix them to suit your need.
I used Ubuntu Server LTS 20.04 (CLI), but you can use your preferred distro.
I suggest Ubuntu Server with snapd, whoopsie, apparmor and some systemd services removed and also journaling reduced so you can have plenty of memory available for building KODI. The instructions provided here if for KODI stand-alone and will not run within Xorg (X11), additional dependencies will be needed if you want X11 support, and if you have a 4GB model you could try to build one with X11 support.
The board used is the RockPi X rev 1.4 which comes with the latest BIOS. If you have an older version you need to update the BIOS only IF you have some missing hw feature or issue.
Ubuntu kernel is sufficiently optimized for a build process but has a tone of modules, you can use a Kernel tailored to the embedded system available on the forum (Debian) or build your own Kernel. In Kernel 5.4 and 5.8 (hwe) throttling occurs at a temperature of 75C, while 5.10 seems to throttle at 80C in some experiments.
Enhanced htop is from here: https://github.com/avafinger/htop_2.2.2-amd64
Preparing your RockPi X
A heat sink is mandatory, the more you cool the board, the better and faster you will compile and finish the job.
16 GB eMMC has not enough free space to build KODI although the mainline kernel can be built with 8 GB free space, attach an SD CARD, USB disk, or any storage. In this small tutorial, I used a 32 GB sd card. Using a CLI (Command Line Interface) like this you need to mount the storage manually.
I tried to summarize the dependencies here for a basic KODI experience. Depending on which add-on you want in your KODI, you will need to find out which dependencies are missing.
sudo apt-get install build-essential dialog flex bison libelf-dev libtool libncurses-dev libncurses5-dev libpci-dev libstdc++-9-dev acpica-tools sudo apt-get install pulseaudio pulseaudio-utils pulseaudio-module-bluetooth alsa-utils libasound2 alsa-base rfkill bluez ffmpeg sudo apt-get install sox libsox-fmt-mp3 sudo apt-get install libva-dev libgbm-dev libdrm-dev libgles2-mesa-dev sudo apt-get install libmp3lame-dev libx264-dev libpulse-dev libpulse-dev libv4l-dev libvdpau-dev libinput-dev sudo apt-get install autoconf automake autopoint gettext autotools-dev cmake curl default-jre gawk gcc g++ cpp gdc gperf libasound2-dev libass-dev libbluetooth-dev libbluray-dev libbz2-dev libcdio-dev libcec-dev libp8-platform-dev libcrossguid-dev libcurl4-openssl-dev libcwiid-dev libdbus-1-dev libenca-dev libflac-dev libfontconfig1-dev libfmt-dev libfreetype6-dev libfribidi-dev libfstrcmp-dev libgcrypt20-dev libgif-dev libgnutls28-dev libgpg-error-dev libiso9660-dev libjpeg-dev liblcms2-dev liblirc-dev libltdl-dev liblzo2-dev libmicrohttpd-dev libmysqlclient-dev libnfs-dev libogg-dev libomxil-bellagio-dev libpcre3-dev libplist-dev libpng-dev libpulse-dev libsmbclient-dev libsqlite3-dev libssl-dev libtag1-dev libtiff5-dev libtinyxml-dev libtool libudev-dev libva-dev libvdpau-dev libvorbis-dev libxkbcommon-dev libxmu-dev libxrandr-dev libxslt1-dev libxt-dev netcat lsb-release nasm python-dev python-pil rapidjson-dev swig unzip uuid-dev yasm zip zlib1g-dev libegl1-mesa-dev libgles2-mesa-dev libglew-dev libglu1-mesa-dev libspdlog-dev libxcb-xfixes-dev
Install and configure PulseAudio to have HDMI sound output and headphone sound output.
and enable/unmute the headphone.
Kodi knows how to deal with PulseAudio:
Decoding / file formats
RockPi X has Video decode hardware acceleration including support for H.263, MPEG4, H.264, H.265 (HEVC,8bit), VP8, VP9, MVC, MPEG2, VC1, JPEG.
If you try to decode HEVC-10bit, KODI will complain and you will need to restart it, although Kodi tries to use SW decoding in some formats. If using SW decoding, the card will heat up.
RockPi X is capable of decoding some H.264 4K.
cd xbmc/ git clone https://github.com/xbmc/xbmc -b Leia leia mkdir -p kodi-build cd leia/ sudo make -C tools/depends/target/crossguid PREFIX=/usr sudo make -C tools/depends/target/flatbuffers PREFIX=/usr sudo make -C tools/depends/target/libfmt PREFIX=/usr cd ../kodi-build cmake ../leia -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=gbm -DGBM_RENDER_SYSTEM=gles cmake --build . -- VERBOSE=0 -j4
Check if KODI is working before building the KODI add-ons.
If you have some issues with your User credentials, try:
You need to add you user to some groups, in my case I have ‘ubuntu’ as user:
sudo addgroup --system input sudo addgroup --system audio sudo usermod -a -G audio ubuntu sudo usermod -a -G input ubuntu sudo usermod -a -G dialout ubuntu sudo usermod -a -G plugdev ubuntu sudo usermod -a -G tty ubuntu
and add udev rules with your preferred editor, I use jed (sudo apt-get install jed):
ubuntu@rockpix:~$ cat /etc/udev/rules.d/9-input.rules # input KERNEL=="mouse*|mice|event*", MODE="0660", GROUP="input" KERNEL=="ts[0-9]*|uinput", MODE="0660", GROUP="input" KERNEL=="js[0-9]*", MODE="0660", GROUP="input" # tty KERNEL==tty[0-9]*, MODE=0666 # i965 SUBSYSTEM==i965, GROUP=video, MODE=0660
ubuntu@rockpix:~$ cat /etc/udev/rules.d/99-input.rules SUBSYSTEM==input, GROUP=input, MODE=0660 KERNEL==tty[0-9]*, GROUP=tty, MODE=0660
sudo make install
Build the Kodi add-ons
cd ../leia/ sudo make -j4 -C tools/depends/target/binary-addons PREFIX=/usr/local
Enjoy your KODI
There are some improvements you could try:
- Build latest FFMpeg from source
- Build latest Mesa from source
- Build and trim Kernel
- Debloat Ubuntu Server