Kodi Steam Deck development: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
Garbear (talk | contribs)
Create launcher script: Improve readability
Garbear (talk | contribs)
Install missing pkg-config files: Add groovy and jdk-openjdk packages
 
(8 intermediate revisions by the same user not shown)
Line 11: Line 11:
The following steps will allow you to compile Kodi on the Steam Deck:
The following steps will allow you to compile Kodi on the Steam Deck:


=== Disable the read-only filesystem===
=== Disable the read-only filesystem ===


<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
Line 33: Line 33:
<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
sudo pacman -Syu
sudo pacman -Syu
</syntaxhighlight>
=== Refresh the file database ===
<syntaxhighlight lang="bash" enclose="div">
sudo pacman -Fy
</syntaxhighlight>
=== Install missing pkg-config files ===
<syntaxhighlight lang="bash" enclose="div">
sudo pacman -S --overwrite '*' groovy jdk-openjdk libx11 libxau libxcb libxdmcp libxrandr mesa
</syntaxhighlight>
</syntaxhighlight>


Line 56: Line 68:
</syntaxhighlight>
</syntaxhighlight>


=== Build depends (this takes about 25 minutes) ===
=== Build depends (this takes about 45 minutes) ===


<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
Line 64: Line 76:
=== Create CMake files ===
=== Create CMake files ===


Optionally, link with LLD because ld.gold complains about newer DWARF formats:
First, set the parameters.
 
Link with LLD because ld.gold complains about newer DWARF formats.
 
<syntaxhighlight lang="bash" enclose="div">
export CMAKE_EXTRA_ARGUMENTS="-DENABLE_LLD=ON"
export PKG_CONFIG_LIBDIR_EXTRA="/usr/lib/pkgconfig:/usr/share/pkgconfig"
</syntaxhighlight>
 
Generate the CMake files:


<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
cd ~/Documents/kodi
cd ~/Documents/kodi
make -C tools/depends/target/cmakebuildsys CMAKE_EXTRA_ARGUMENTS="-DCORE_PLATFORM_NAME=wayland -DENABLE_LLD=ON"
make -C tools/depends/target/cmakebuildsys
</syntaxhighlight>
</syntaxhighlight>


Line 97: Line 118:


<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
cat <<'EOL' > ~/bin/kodi-dev.sh
cat <<'EOL' > ~/bin/kodi.sh
#!/usr/bin/env bash
#!/usr/bin/env bash
set -euo pipefail
set -euo pipefail


# Kodi needs this when running from the build tree
# Kodi needs this when running from the build tree
export SSL_CERT_FILE=/home/deck/Documents/kodi/system/certs/cacert.pem
export SSL_CERT_FILE="/home/deck/Documents/kodi/system/certs/cacert.pem"


# Disable SteamOS gamescope Vulkan implicit layer for this app
KODI_BIN="/home/deck/Documents/kodi/build/kodi.bin"
# (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
# Gaming Mode: already inside gamescope (Wayland)
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
if [[ -n "${STEAM_GAMEPADUI:-}" ]]; then
   export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-gamescope-0}"
   export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-gamescope-0}"
Line 121: Line 133:
fi
fi


# Desktop Mode: provide a Wayland compositor via nested gamescope and force 4K
# Desktop Mode (X11)
exec /usr/bin/gamescope --expose-wayland -f -b -W 3840 -H 2160 -- "${KODI_BIN}" -fs
exec "${KODI_BIN}" -fs
 
# Alternative 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
EOL
</syntaxhighlight>
</syntaxhighlight>
Line 129: Line 146:


<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
chmod +x ~/bin/kodi-dev.sh
chmod +x ~/bin/kodi.sh
</syntaxhighlight>
</syntaxhighlight>


=== Create desktop entry ===
=== Create desktop entry ===
Write the desktop file:


<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
mkdir -p ~/.local/share/applications
cat <<'EOL' > ~/.local/share/applications/kodi.desktop
 
cat <<'EOL' > ~/.local/share/applications/kodi-dev.desktop
[Desktop Entry]
[Desktop Entry]
Version=1.0
Version=1.0
Name=Kodi (dev)
Name=Kodi
GenericName=Media Center
GenericName=Media Center
Comment=Manage and view your media (dev build)
Comment=Manage and view your media
Type=Application
Type=Application
Terminal=false
Terminal=false
Line 148: Line 165:
Icon=/home/deck/Documents/kodi/tools/Linux/packaging/media/icon256x256.png
Icon=/home/deck/Documents/kodi/tools/Linux/packaging/media/icon256x256.png


Exec=/home/deck/bin/kodi-dev.sh
Exec=/home/deck/bin/kodi.sh
EOL
EOL
</syntaxhighlight>


chmod +x ~/.local/share/applications/kodi-dev.desktop
Make it executable:
 
<syntaxhighlight lang="bash" enclose="div">
chmod +x ~/.local/share/applications/kodi.desktop
</syntaxhighlight>
 
Update the launcher database:
 
<syntaxhighlight lang="bash" enclose="div">
update-desktop-database ~/.local/share/applications 2>/dev/null || true
update-desktop-database ~/.local/share/applications 2>/dev/null || true
</syntaxhighlight>
</syntaxhighlight>
Copy the launcher to your desktop:


<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight lang="bash" enclose="div">
cp ~/.local/share/applications/kodi-dev.desktop ~/Desktop/
cp ~/.local/share/applications/kodi.desktop ~/Desktop/
chmod +x ~/Desktop/kodi-dev.desktop
</syntaxhighlight>
</syntaxhighlight>


Line 169: Line 196:


Click "Browse..." and select:
Click "Browse..." and select:
<code>/home/deck/bin/kodi-dev.sh</code>
<code>/home/deck/bin/kodi.sh</code>


After it is added, open Properties and set:
After it is added, open Properties and set:


* Name: <code>Kodi (dev)</code>
* Name: <code>Kodi</code>
* Compatibility: ensure "Force the use of a specific Steam Play compatibility tool" is unchecked.
* Compatibility: ensure "Force the use of a specific Steam Play compatibility tool" is unchecked.

Latest revision as of 14:27, 7 March 2026

Development:
  ▶ Development ▶ Kodi Steam Deck 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

Refresh the file database

sudo pacman -Fy

Install missing pkg-config files

sudo pacman -S --overwrite '*' groovy jdk-openjdk libx11 libxau libxcb libxdmcp libxrandr mesa

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 45 minutes)

make -j8

Create CMake files

First, set the parameters.

Link with LLD because ld.gold complains about newer DWARF formats.

export CMAKE_EXTRA_ARGUMENTS="-DENABLE_LLD=ON"
export PKG_CONFIG_LIBDIR_EXTRA="/usr/lib/pkgconfig:/usr/share/pkgconfig"

Generate the CMake files:

cd ~/Documents/kodi
make -C tools/depends/target/cmakebuildsys

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

KODI_BIN="/home/deck/Documents/kodi/build/kodi.bin"

# Gaming Mode: already inside gamescope (Wayland)
if [[ -n "${STEAM_GAMEPADUI:-}" ]]; then
  export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-gamescope-0}"
  exec "${KODI_BIN}" -fs
fi

# Desktop Mode (X11)
exec "${KODI_BIN}" -fs

# Alternative 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.sh

Create desktop entry

Write the desktop file:

cat <<'EOL' > ~/.local/share/applications/kodi.desktop
[Desktop Entry]
Version=1.0
Name=Kodi
GenericName=Media Center
Comment=Manage and view your media
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.sh
EOL

Make it executable:

chmod +x ~/.local/share/applications/kodi.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.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.sh

After it is added, open Properties and set:

  • Name: Kodi
  • Compatibility: ensure "Force the use of a specific Steam Play compatibility tool" is unchecked.