Bulding KODI on RockPi X - Media Player[ RockPi X ]

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.

Distro
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.

Kernel
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.

Dependencies
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

Sound
Install and configure PulseAudio to have HDMI sound output and headphone sound output.

run:
sudo alsamixer

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.

Building

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

Testing KODI
Check if KODI is working before building the KODI add-ons.

./kodi-gbm

If you have some issues with your User credentials, try:

sudo ./kodi-gbm

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

and

ubuntu@rockpix:~$ cat /etc/udev/rules.d/99-input.rules
SUBSYSTEM==input, GROUP=input, MODE=0660
KERNEL==tty[0-9]*, GROUP=tty, MODE=0660

Install Kodi:

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

Improvements

There are some improvements you could try:

  • Build latest FFMpeg from source
  • Build latest Mesa from source
  • Build and trim Kernel
  • Debloat Ubuntu Server
1 Like

And for HDMI CEC?

Just quoting from a forum: “The Z8350 HDMI version is 1.4, so CEC is not supported.”

This is the answer to my question about how it works by email
Hi, Massimo

HDMI CEC is working on ROCK Pi 4B.

I’ll ask for a rebate. For me it’s a brick at this point

You could think in this way, This is the first Intel sbc from Radxa and the soc is a bit old. But at this price, it outperforms any Intel competitor. Give Radxa team an opportunity to release a new intel sbc with a newer processor. The next release could have all the features a dev may wish for and at the best price. Just think of this as an investment.

1 Like

Anyway, you did a great job. The video is fluid?

For the most common codecs and FHD yes. It tries to use HW decoding when available, if not, it tries SW decoding but you have to add the missing libs. 10-bit seems to be a problem.

According to KODI developers, the X11 version is in better shape than the OpenGles2 / GBM, but for this you better have a 4GB version.

I’m installing Ubuntu server … But it’s been working for more than an hour. It’s always stuck on curtin hook

Do you mean “curtin-hooks” ? No idea about curthooks, never used it.

If you install Ubuntu Server, choose the default installation and don’t check any advanced options.
The idea of installing Ubuntu Server is to have minimum packages installed and remove all the packages related to Server Edition.

I’d would suggest you open a new thread, specific to “Installing Ubuntu”. Describe as much as you can there to get some help.

Installed, but after hours of work, after the cmake --build command. - VERBOSE = 0 -j4 gives an error and doesn’t go. I quit. Thanks anyway