Building RetroArch on ArmSoM CM5¶
This guide builds RetroArch from upstream source on the ArmSoM CM5 development kit using its native Debian 12 XFCE ARM64 image. The tested system had approximately 2 GB of RAM and kernel 6.1.118-rk3576 #198. RetroArch 1.22.2 was built and tested on October 22, 2026.
You need the development kit and its power supply, an HDMI display, a USB keyboard, and an internet connection. The display must have speakers to test HDMI audio. Run the commands in Bash in a terminal on the board's XFCE desktop, as a regular user with sudo access. Only dependency installation requires sudo.
Install dependencies¶
The tested native image already provides the Mali driver and EGL/GLES development files. Keep the image's graphics driver in place.
sudo apt-get update
sudo apt-get -o Dpkg::Use-Pty=0 install -y --no-install-recommends \
build-essential git pkg-config curl ca-certificates \
libasound2-dev libudev-dev libx11-dev libxext-dev libxinerama-dev \
libxrandr-dev libxxf86vm-dev libfreetype6-dev zlib1g-dev libssl-dev \
retroarch-assets libretro-core-info
test -r /usr/share/libretro/assets/ozone/png/icons/pointer.png
test -r /usr/share/libretro/assets/ozone/regular.ttf
test -d /usr/share/libretro/info
Wait for package installation to finish successfully before continuing. The checks above must succeed: the Ozone menu needs its icons, pointer texture, and font. Missing assets can produce blank icons or a square mouse pointer.
Download the source¶
Use a new source directory. These commands select the exact upstream revision used for this test.
mkdir -p ~/src
git clone --depth 1 https://github.com/libretro/RetroArch.git ~/src/RetroArch
cd ~/src/RetroArch
git fetch --depth 1 origin a81e450c00745b27ba417d486799b12f09c38ea4
git checkout --detach FETCH_HEAD
Build and install¶
Run each command only after the preceding command succeeds.
./configure --prefix="$HOME/.local/retroarch-upstream" \
--disable-opengl1 --enable-opengles --enable-opengles3 \
--enable-egl --enable-x11 --enable-alsa --enable-udev --enable-ssl \
--disable-videocore --disable-vulkan --disable-wayland --disable-kms \
--disable-qt --disable-ffmpeg --disable-pulse --disable-jack \
--disable-sdl --disable-sdl2
make -j2
./retroarch --version
make install
The build took approximately 15 minutes with two parallel jobs. The executable reported version 1.22.2 and was installed at ~/.local/retroarch-upstream/bin/retroarch.
Create the runtime configuration¶
mkdir -p ~/retroarch-source-validation/{config,content,core-package}
mkdir -p ~/retroarch-source-validation/runtime/{saves,states,system,playlists}
cat > ~/retroarch-source-validation/config/retroarch.cfg <<EOF
video_driver = "gl"
video_context_driver = "egl_x"
video_fullscreen = "true"
video_windowed_fullscreen = "true"
video_vsync = "true"
audio_driver = "alsa"
audio_device = "plughw:CARD=rockchiphdmi,DEV=0"
audio_out_rate = "48000"
audio_latency = "64"
audio_volume = "-12.0"
input_driver = "x"
input_joypad_driver = "udev"
input_player1_up = "up"
input_player1_down = "down"
input_player1_left = "left"
input_player1_right = "right"
input_player1_a = "x"
input_player1_b = "z"
input_player1_l = "q"
input_player1_r = "w"
input_player1_start = "enter"
input_player1_select = "rshift"
input_menu_toggle = "f1"
input_save_state = "f2"
input_load_state = "f4"
input_pause_toggle = "p"
input_exit_emulator = "escape"
quit_press_twice = "true"
menu_driver = "ozone"
menu_mouse_enable = "true"
core_info_cache_enable = "false"
config_save_on_exit = "false"
assets_directory = "/usr/share/libretro/assets"
libretro_info_path = "/usr/share/libretro/info"
libretro_directory = "$HOME/retroarch-source-validation/core-package/extracted/usr/lib/aarch64-linux-gnu/libretro"
rgui_browser_directory = "$HOME/retroarch-source-validation/content"
savefile_directory = "$HOME/retroarch-source-validation/runtime/saves"
savestate_directory = "$HOME/retroarch-source-validation/runtime/states"
system_directory = "$HOME/retroarch-source-validation/runtime/system"
playlist_directory = "$HOME/retroarch-source-validation/runtime/playlists"
EOF
This configuration uses the native EGL/OpenGL ES graphics stack and the HDMI ALSA device. The tested image did not require LD_PRELOAD or an ELD bypass. The ALSA device name in this configuration is specific to this image; use aplay -L to check it if you use a different image.
Configuration changes made through the menu are not saved on exit because config_save_on_exit is disabled. Edit this file to make persistent changes.
Download a core and test game¶
RetroArch is a frontend and needs an emulator core to run content. Here, the Debian Nestopia package is downloaded and extracted without installing the distribution's RetroArch frontend. The core itself is a prebuilt package, not built from source in this guide. The tested package version was 1.52.0+20230102.gitcb1e24e-1.
Use an empty core-package directory so that the package wildcard matches only one file.
cd ~/retroarch-source-validation/core-package
apt-get download libretro-nestopia
dpkg-deb -x libretro-nestopia_*.deb extracted
cd ~/retroarch-source-validation/content
curl -fL https://raw.githubusercontent.com/xram64/falling-nes/52dcb8a951200562e696dfc2aba5d4d14edd0078/falling.nes -o Falling.nes
curl -fL https://raw.githubusercontent.com/xram64/falling-nes/52dcb8a951200562e696dfc2aba5d4d14edd0078/LICENSE -o LICENSE
echo 'e22b947542c2d7e595bf84725b333be7af8189c5965b9c53e356a249c7d79943 Falling.nes' | sha256sum -c -
The checksum command should print Falling.nes: OK. Falling is an open-source homebrew game under the MIT license. Keep its downloaded LICENSE when redistributing it.
Run the game¶
~/.local/retroarch-upstream/bin/retroarch \
--config "$HOME/retroarch-source-validation/config/retroarch.cfg" \
-L "$HOME/retroarch-source-validation/core-package/extracted/usr/lib/aarch64-linux-gnu/libretro/nestopia_libretro.so" \
"$HOME/retroarch-source-validation/content/Falling.nes"
| Key | Action |
|---|---|
| Enter | Start the game / confirm a menu selection |
| Left / Right | Move the character |
| F1 | Open or close the RetroArch menu |
| Backspace | Go back in the menu |
| P | Pause / resume |
| F2 / F4 | Save / load a state |
| Esc, pressed twice | Exit RetroArch |
After exiting the game, you can launch the menu separately:
~/.local/retroarch-upstream/bin/retroarch \
--config "$HOME/retroarch-source-validation/config/retroarch.cfg" --menu
Create a desktop shortcut¶
Run this section as the same regular user who is logged into the XFCE desktop. A launcher created in root's home directory will not appear on another user's desktop. The executable and configuration must also be accessible to that desktop user.
If you followed the guide as a regular user, skip the recovery subsection and proceed to Create the launcher.
Recover an installation made as root¶
If your shell prompt starts with root@, then ~ and $HOME refer to /root. For the native image's armsom desktop account, the following commands copy the existing installation and runtime data into that user's home, update the runtime paths, and set ownership. They leave the original files in /root in place.
Run this block as root. It stops if either destination already exists; in that case, inspect the existing installation instead of overwriting it. These paths assume the desktop account is armsom.
(
set -eu
test ! -e /home/armsom/.local/retroarch-upstream
test ! -e /home/armsom/retroarch-source-validation
cp -a /root/.local/retroarch-upstream /home/armsom/.local/
cp -a /root/retroarch-source-validation /home/armsom/
sed -i 's|/root/retroarch-source-validation/|/home/armsom/retroarch-source-validation/|g' /home/armsom/retroarch-source-validation/config/retroarch.cfg
chown -R armsom:armsom /home/armsom/.local/retroarch-upstream /home/armsom/retroarch-source-validation
runuser -u armsom -- /home/armsom/.local/retroarch-upstream/bin/retroarch --version
id armsom
)
Then switch to the desktop user:
Create the launcher¶
Run this block in the regular user's Bash shell. It creates both a desktop icon and an application-menu entry. It uses xdg-user-dir when available, otherwise reads the user's configured desktop directory, falling back to ~/Desktop. Installing xdg-user-dirs is not required.
(
set -eu
if [ "$(id -u)" -eq 0 ]; then
printf '%s\n' 'Run this block as the user logged into the XFCE desktop, not root.' >&2
exit 1
fi
retroarch_bin="$HOME/.local/retroarch-upstream/bin/retroarch"
retroarch_config="$HOME/retroarch-source-validation/config/retroarch.cfg"
retroarch_icon="$HOME/.local/retroarch-upstream/share/pixmaps/com.libretro.RetroArch.svg"
test -x "$retroarch_bin"
test -r "$retroarch_config"
test -r "$retroarch_icon"
desktop_dir="$HOME/Desktop"
if command -v xdg-user-dir >/dev/null 2>&1; then
desktop_dir="$(xdg-user-dir DESKTOP)"
elif [ -r "$HOME/.config/user-dirs.dirs" ]; then
. "$HOME/.config/user-dirs.dirs"
desktop_dir="${XDG_DESKTOP_DIR:-$desktop_dir}"
fi
mkdir -p "$desktop_dir" "$HOME/.local/share/applications"
cat > "$HOME/.local/share/applications/retroarch-source.desktop" <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=RetroArch (Source Build)
Comment=Open the RetroArch graphical menu
Exec="$retroarch_bin" --config "$retroarch_config" --menu
Icon=$retroarch_icon
Terminal=false
Categories=Game;Emulator;
StartupNotify=false
EOF
cp "$HOME/.local/share/applications/retroarch-source.desktop" "$desktop_dir/retroarch-source.desktop"
chmod +x "$desktop_dir/retroarch-source.desktop"
printf 'Created: %s\n' "$desktop_dir/retroarch-source.desktop"
)
On the HDMI desktop, double-click RetroArch (Source Build). If XFCE asks whether to trust the launcher, choose Mark Executable or the equivalent launch option. RetroArch opens its graphical menu without a terminal window. Press Esc twice to exit, then double-click the icon to open it again.
The serial console is used here to create the files, not to display the graphical interface. Launch the icon from the active XFCE desktop; do not run RetroArch as root to work around display or permission errors.
Create a Falling game shortcut¶
RetroArch (Source Build) opens the main menu because its command includes --menu. To start the test game directly, create a separate Falling - NES Demo launcher that specifies both the Nestopia core and Falling.nes.
After completing the core and game download steps, run this block as the desktop user:
(
set -eu
test "$(id -u)" -ne 0
retroarch_bin="$HOME/.local/retroarch-upstream/bin/retroarch"
retroarch_config="$HOME/retroarch-source-validation/config/retroarch.cfg"
retroarch_icon="$HOME/.local/retroarch-upstream/share/pixmaps/com.libretro.RetroArch.svg"
core="$HOME/retroarch-source-validation/core-package/extracted/usr/lib/aarch64-linux-gnu/libretro/nestopia_libretro.so"
game="$HOME/retroarch-source-validation/content/Falling.nes"
test -x "$retroarch_bin"
test -r "$retroarch_config"
test -r "$retroarch_icon"
test -r "$core"
test -r "$game"
desktop_dir="$HOME/Desktop"
if command -v xdg-user-dir >/dev/null 2>&1; then
desktop_dir="$(xdg-user-dir DESKTOP)"
elif [ -r "$HOME/.config/user-dirs.dirs" ]; then
. "$HOME/.config/user-dirs.dirs"
desktop_dir="${XDG_DESKTOP_DIR:-$desktop_dir}"
fi
mkdir -p "$desktop_dir" "$HOME/.local/share/applications"
launcher="$HOME/.local/share/applications/falling-source.desktop"
cat > "$launcher" <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Falling - NES Demo
Comment=Play Falling with the source-built RetroArch
Exec="$retroarch_bin" --config "$retroarch_config" -L "$core" "$game"
Icon=$retroarch_icon
Terminal=false
Categories=Game;Emulator;
StartupNotify=false
EOF
cp "$launcher" "$desktop_dir/falling-source.desktop"
chmod +x "$desktop_dir/falling-source.desktop"
)
Double-click Falling - NES Demo on the HDMI desktop. Allow the launcher to run if XFCE asks, then press Enter to start the game and use Left / Right to move. Press F1 for the RetroArch menu or Esc twice to exit. The RetroArch (Source Build) icon remains the separate main-menu entry.
The launcher and recovery steps were tested on October 27, 2026, on the native Debian 12 XFCE image with xdg-user-dir absent. The desktop user was armsom; opening the menu and relaunching by double-clicking the icon were verified. After installing the menu assets and enabling mouse input, the official launcher icon, mouse pointer, mouse menu selection, and keyboard back navigation were also verified. The separate Falling launcher was verified by double-clicking its desktop icon, starting the game, and checking display, keyboard controls, and HDMI audio.
Add two more homebrew games¶
GBAtris 1.0 is a falling-block game for the Game Boy Advance, distributed by its author with source and a prebuilt ROM. Snake 2.0 is a Game Boy game with a prebuilt release ROM. These examples use a prebuilt Debian mGBA core; the RetroArch frontend remains the source-built executable from this guide.
GBAtris is published under GPL-3.0-or-later; keep its source archive, COPYING, and the music attribution in its README.md. Snake uses the MIT license and a separate sound-driver notice; keep its source archive, LICENSE, and sound/LICENSE.TXT. The downloads below retain these files.
Install the core dependency and download the games¶
Install the additional packages with sudo, then run the remaining blocks as the desktop user. Downloading and extracting the core avoids installing a second RetroArch frontend.
Check that the board's date and time are correct if HTTPS reports that a certificate is not yet valid. Correct time synchronization before retrying the download.
Use a new core-package/mgba directory so the package wildcard matches one file. The tested Debian ARM64 mGBA package version was 0.10.1+dfsg-1+deb12u1.
(
set -eu
mkdir -p "$HOME/retroarch-source-validation/core-package/mgba"
cd "$HOME/retroarch-source-validation/core-package/mgba"
apt-get download libretro-mgba
dpkg-deb -x libretro-mgba_*.deb extracted
ldd extracted/usr/lib/aarch64-linux-gnu/libretro/mgba_libretro.so
mkdir -p "$HOME/retroarch-source-validation/content/extra-games"
cd "$HOME/retroarch-source-validation/content/extra-games"
curl -fL --connect-timeout 15 --max-time 90 https://nuclear.mutantstargoat.com/sw/gbatris/gbatris-1.0.zip -o gbatris-1.0.zip
unzip -q -o gbatris-1.0.zip
curl -fL --connect-timeout 15 --max-time 90 https://github.com/reini1305/gb_snake/releases/download/2.0/snake.gb -o snake.gb
curl -fL --connect-timeout 15 --max-time 90 https://github.com/reini1305/gb_snake/archive/refs/tags/2.0.zip -o gb-snake-2.0-source.zip
unzip -q -o gb-snake-2.0-source.zip
echo '607ba9f6ad2a3b7af9863bc8ee979fe77c77619119c22e8ab04cfa4729255c67 gbatris-1.0/gbatris.gba' | sha256sum -c -
echo '94f66ec5063b33bea89ed80ed05334e1655bcc71114d2c9a33a953aa368bb049 snake.gb' | sha256sum -c -
)
Both ROM checks must report OK. The core's ldd output must not contain not found.
Create both game icons¶
This block creates separate GBAtris - Falling Blocks and Snake - Game Boy icons on the desktop and in the application menu. Both commands specify the mGBA core and their game file, so double-clicking starts the game directly.
(
set -eu
test "$(id -u)" -ne 0
desktop_dir="$HOME/Desktop"
if command -v xdg-user-dir >/dev/null 2>&1; then
desktop_dir="$(xdg-user-dir DESKTOP)"
elif [ -r "$HOME/.config/user-dirs.dirs" ]; then
. "$HOME/.config/user-dirs.dirs"
desktop_dir="${XDG_DESKTOP_DIR:-$desktop_dir}"
fi
mkdir -p "$desktop_dir" "$HOME/.local/share/applications"
retroarch_bin="$HOME/.local/retroarch-upstream/bin/retroarch"
retroarch_config="$HOME/retroarch-source-validation/config/retroarch.cfg"
retroarch_icon="$HOME/.local/retroarch-upstream/share/pixmaps/com.libretro.RetroArch.svg"
mgba_core="$HOME/retroarch-source-validation/core-package/mgba/extracted/usr/lib/aarch64-linux-gnu/libretro/mgba_libretro.so"
test -x "$retroarch_bin"
test -r "$retroarch_config"
test -r "$retroarch_icon"
test -r "$mgba_core"
create_game_launcher() {
title="$1"
slug="$2"
game="$3"
test -r "$game"
launcher="$HOME/.local/share/applications/$slug-source.desktop"
cat > "$launcher" <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=$title
Comment=Play with the source-built RetroArch
Exec="$retroarch_bin" --config "$retroarch_config" -L "$mgba_core" "$game"
Icon=$retroarch_icon
Terminal=false
Categories=Game;Emulator;
StartupNotify=false
EOF
cp "$launcher" "$desktop_dir/$slug-source.desktop"
chmod +x "$desktop_dir/$slug-source.desktop"
}
create_game_launcher "GBAtris - Falling Blocks" gbatris "$HOME/retroarch-source-validation/content/extra-games/gbatris-1.0/gbatris.gba"
create_game_launcher "Snake - Game Boy" snake "$HOME/retroarch-source-validation/content/extra-games/snake.gb"
)
Exit any running RetroArch instance before opening another game. If XFCE asks whether to trust a new launcher, allow it to run.
Quick keyboard reference¶
| Game | Start | Move | Main action | Pause / resume | Exit |
|---|---|---|---|---|---|
| Falling | Enter | Left / Right | Move the character | P | Esc twice |
| GBAtris | Enter | Left / Right; Down to fall faster | X to rotate; Z or Up to drop | P | Esc twice |
| Snake | Enter | Arrow keys | Steer toward apples; avoid collisions | P | Esc twice |
In GBAtris, Right Shift starts a new game and Q / W toggles music. In Snake, Right Shift changes the number of apples before starting. The RetroArch (Source Build) icon opens the main menu: use arrows to navigate, Enter to confirm, and Backspace to go back.
For all games, P pauses/resumes RetroArch, F1 opens the menu, F2 / F4 saves/loads a state, and Esc twice exits. Test each desktop icon, play the game, check HDMI audio, exit, and reopen it before treating the installation as complete.
Tested functionality¶
The source-built frontend was tested with Falling and the Nestopia core: display output, keyboard input, HDMI audio, menu navigation, pause/resume, save/load states, and exiting and relaunching worked. Rendering used the native Mali-G52 EGL/OpenGL ES driver. No RetroArch source changes were needed.
On October 27, 2026, GBAtris 1.0 and Snake 2.0 were also tested with the Debian mGBA core: direct desktop launch, keyboard gameplay, HDMI audio, exit, and reopening through their individual desktop icons worked. GBAtris pause/resume was checked as well.
These results apply to the image, revision, and core described above. Reboot recovery, long-term stability, and other cores have not been verified.