Kodi Steam Deck development
Development:
|
Kodi is easily installable on the Steam Deck via Flatpak, but if you're looking to do development on the Steam Deck, this article is for you.
Environment Setup
The first step is to disable the read-only filesystem. If you're reading this, it's assumed that you know what you're doing. If not, seek safety.
The following steps will allow you to compile Kodi on the Steam Deck:
Disable the read-only filesystem
sudo steamos-readonly disable
Initialize the pacman keyring
sudo pacman-key --init
Populate the pacman keyring with the default Arch Linux and Holo keys
sudo pacman-key --populate archlinux holo
Update the system packages
sudo pacman -Syu
Get/build the source code
Clone Kodi
git clone https://github.com/xbmc/xbmc.git ~/Documents/kodi
Bootstrap depends
cd ~/Documents/kodi/tools/depends ./bootstrap
Configure depends
./configure --prefix="$HOME/kodi-deps" --with-rendersystem=gl
Build depends (this takes about 25 minutes)
make -j8
Create CMake files
Optionally, link with LLD because ld.gold complains about newer DWARF formats:
cd ~/Documents/kodi make -C tools/depends/target/cmakebuildsys CMAKE_EXTRA_ARGUMENTS="-DCORE_PLATFORM_NAME=wayland -DENABLE_LLD=ON"
Build Kodi (this takes about 18 minutes)
cd build make -j8
Build binary add-ons
make -j8 binary-addons
Installation
Create launcher script
First, create a script directory:
mkdir -p ~/bin
Then, write the script:
cat <<'EOL' > ~/bin/kodi-dev.sh
#!/usr/bin/env bash
set -euo pipefail
# Kodi needs this when running from the build tree
export SSL_CERT_FILE=/home/deck/Documents/kodi/system/certs/cacert.pem
# Disable SteamOS gamescope Vulkan implicit layer for this app
# (prevents CreateSwapchainKHR "bad Vulkan layer" popup in Gaming Mode)
export VK_LOADER_LAYERS_DISABLE="${VK_LOADER_LAYERS_DISABLE:-}:VK_LAYER_FROG_gamescope_wsi"
# Clear any explicit Vulkan layer env that may be set
unset VK_LAYER_PATH
unset VK_INSTANCE_LAYERS
unset ENABLE_GAMESCOPE_WSI
KODI_BIN="/home/deck/Documents/kodi/build/kodi-wayland"
# Gaming Mode: already inside gamescope (do NOT nest gamescope again)
if [[ -n "${STEAM_GAMEPADUI:-}" ]]; then
export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-gamescope-0}"
exec "${KODI_BIN}" -fs
fi
# Desktop Mode: provide a Wayland compositor via nested gamescope and force 4K
exec /usr/bin/gamescope --expose-wayland -f -b -W 3840 -H 2160 -- "${KODI_BIN}" -fs
EOL
Finally, make it executable:
chmod +x ~/bin/kodi-dev.sh
Create desktop entry
Write the desktop file:
cat <<'EOL' > ~/.local/share/applications/kodi-dev.desktop [Desktop Entry] Version=1.0 Name=Kodi (dev) GenericName=Media Center Comment=Manage and view your media (dev build) Type=Application Terminal=false Categories=AudioVideo;Video;Player;TV; Icon=/home/deck/Documents/kodi/tools/Linux/packaging/media/icon256x256.png Exec=/home/deck/bin/kodi-dev.sh EOL
Make it executable:
chmod +x ~/.local/share/applications/kodi-dev.desktop
Update the launcher database:
update-desktop-database ~/.local/share/applications 2>/dev/null || true
Copy the launcher to your desktop:
cp ~/.local/share/applications/kodi-dev.desktop ~/Desktop/
Add to Steam (Gaming Mode)
Switch to Desktop Mode.
Open Steam.
Select "Add a Game" -> "Add a Non-Steam Game..."
Click "Browse..." and select:
/home/deck/bin/kodi-dev.sh
After it is added, open Properties and set:
- Name:
Kodi (dev) - Compatibility: ensure "Force the use of a specific Steam Play compatibility tool" is unchecked.