This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Kodi
Kodi (formerly XBMC) is a media center application.
Installation
USE flags
USE flags for media-tv/kodi A free and open source media-player and entertainment hub
+css
|
Enable reading of encrypted DVDs |
+optical
|
Enable Audio CD playback, optical disks detection and reading (CD-ROM, Video CD, and others), and ISO optical disk images direct reading. DVD disks may require additional 'udf' flag. |
+system-ffmpeg
|
Use system ffmpeg instead of the bundled one |
+xslt
|
Enable metadata XSLT scrapers support with dev-libs/libxslt |
X
|
Add support for X11 |
airplay
|
enable AirPlay support |
alsa
|
Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture) |
bluetooth
|
Enable JSON-RPC over BT for remote control connected via bluetooth |
bluray
|
Enable playback of Blu-ray filesystems |
caps
|
Use sys-libs/libcap to bind to privileged ports as non-root |
cec
|
Enable support for HDMI-CEC devices via libcec |
dbus
|
Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc) |
doc
|
Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally |
eventclients
|
Install full set of Kodi python evenclients and evenclients examples |
gbm
|
Use the Graphics Buffer Manager for EGL on KMS. |
gles
|
Use simplified OpenGLES instead of full-scale OpenGL |
lcms
|
Add lcms support (color management engine) |
libusb
|
Use virtual/libusb for usb device hotplug support. This flag should only be enabled if you're running a non-Linux kernel or you don't want to use udev. |
lirc
|
Enable support for IR remote controls using app-misc/lirc |
mariadb
|
Enable support store of media library metadata on local or remote MariaDB |
mysql
|
Enable support store of media library metadata on local or remote MySQL |
nfs
|
Enable NFS client support |
pipewire
|
Enable pipewire support |
pulseaudio
|
Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire) |
samba
|
Add support for SAMBA (Windows File and Printer sharing) |
soc
|
Use additional media-video/ffmpeg patches for efficient playback on some SoCs (e.g. ARM, RISC-V) |
test
|
Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently) |
udev
|
Use udev rules to handle devices' permissions and hotplug support. Unless you know what you're doing do not disable this flag on Linux kernels. This is provided as an option for completeness. |
udf
|
Enable UDF support. Required for playing blurays. |
upnp
|
Enable UPnP port mapping support |
vaapi
|
Enable Video Acceleration API for hardware decoding |
vdpau
|
Enable the Video Decode and Presentation API for Unix acceleration interface |
wayland
|
Enable dev-libs/wayland backend |
webserver
|
Enable internal webserver |
zeroconf
|
Support for DNS Service Discovery (DNS-SD) |
Emerge
root #
emerge --ask media-tv/kodi
Configuration
Create user
First create the kodi user:
root #
useradd -m -G audio,cdrom,video,cdrw,usb,users kodi
Services
OpenRC
Then define the Kodi init.d file with the following contents:
/etc/init.d/kodi
#!/sbin/openrc-run # Released under the 2-clause BSD license. KODI_USER=${KODI_USER:-kodi} KODI_HOME=$(getent passwd "${KODI_USER%:*}" | cut -d ':' -f 6) description="Start and stop Kodi" depend() { need net } start() { ebegin "Starting Kodi" start-stop-daemon --start -u ${KODI_USER} -d ${KODI_HOME} --background --pidfile /var/run/kodi.pid --make-pidfile --exec /usr/bin/xinit -- /usr/bin/kodi-standalone ${KODI_OPTS} -- :0 eend $? } stop() { ebegin "Stopping Kodi" start-stop-daemon --stop --pidfile /var/run/kodi.pid eend $? }
Set the appropriate permissions:
root #
chmod +x /etc/init.d/kodi
And tell OpenRC to start it on boot:
root #
rc-update add kodi default
Using inittab
First create the kodi user (see above). This is based on the way the mythtv ebuilds enable the autostart of the mythtv frontend.
Define an .xinitrc file in kodi's home:
/home/kodi/.xinitrc
[ -x /usr/bin/nvidia-settings ] && /usr/bin/nvidia-settings -l /usr/bin/xset s noblank /usr/bin/xset s off /usr/bin/xset -dpms /usr/bin/evilwm & exec /usr/bin/kodi
Then create the login scripts:
/home/kodi/.bash_profile
case "`tty`" in *tty9) startx; logout ;; esac
Finally append an inittab entry which does the autologin:
/etc/inittab
# Start Kodi c9:2345:respawn:/sbin/mingetty --autologin kodi tty9
Running on Gentoo Hardened
Running Kodi on a Hardened Gentoo installation is possible. To avoid grsecurity interfering with network connectivity, the CONFIG_GRKERNSEC_PROC_USER kernel option must not be enabled.
Should you require a restricted /proc filesystem, use CONFIG_GRKERNSEC_PROC_USERGROUP and set GRKERNSEC_PROC_GID to the ID of a group that the user running Kodi is a member of.
Usage
Shutdown
Allow the kodi user to issue an shutdown via polkit, resulting in a shutdown option in the Kodi menu:
/etc/polkit-1/rules.d/60-kodi.rules
polkit.addRule(function(action, subject) { if (( (action.id.indexOf("org.freedesktop.udisks.") == 0) || (action.id.indexOf("org.freedesktop.upower.")== 0) || (action.id.indexOf("org.freedesktop.consolekit.")== 0) ) && subject.user=="kodi") { return polkit.Result.YES; } });
Note: Ensure the udev
USE flag set for shutdown to work.