pigo-config – System Provisioning and Hardware Configuration for PiGo OS

New Article
PiGoRaspberryPiLinuxProjects
pigo-config – System Provisioning and Hardware Configuration for PiGo OS

Why PiGo Needs a Dedicated Configuration Repository

A fresh Raspberry Pi OS Lite installation knows nothing about PiGo's custom carrier PCB. Out of the box, the 320×240 SPI display stays dark, the onboard I2S sound chip has no software volume mixer, the backlight PWM pin is uninitialized, the uinput kernel module is not exposed to non-root users, and the system boots into a blinking TTY login prompt instead of a game launcher.

Configuring all of those pieces by hand is tedious and impossible to reproduce reliably. pigo-config solves this by bundling every hardware overlay, boot parameter, systemd unit, Wayland rule, and system cleanup step into a single, versioned, idempotent provisioning repository.

Purpose: One Script for Both Image Builds and Live Updates

The key design goal of pigo-config is that it works identically in two very different environments:

  • During Offline Image Generation (pi-gen chroot): Where no running systemd or user D-Bus session exists, so services and user lingering must be enabled via direct filesystem symlinks and /var/lib/systemd/linger/pigo.
  • On a Live PiGo Handheld: Where update.sh pulls the latest changes from GitHub and re-runs install.sh to apply new configurations, update pigogui and uinput-pigo-mapper, and keep the console up to date.

How the Code Is Structured

The repository is intentionally flat and transparent — every file maps directly to a concrete subsystem on the Raspberry Pi:

1. Custom Hardware Overlays & Boot Config

  • ili9341-modern.dts: A Device Tree Source overlay targeting &spi0 for the 320×240 ILI9341 display. It configures a 32 MHz SPI clock, maps dc-gpios to GPIO 6 and reset-gpios to GPIO 5, and sets rotation = <270> for landscape handheld orientation. During installation, install.sh compiles it on the fly with dtc into /boot/firmware/overlays/ili9341-modern.dtbo.
  • config.txt: Enables I2C (dtparam=i2c_arm=on), SPI (dtparam=spi=on), DRM/KMS (dtoverlay=vc4-kms-v3d), the custom ili9341-modern display overlay, and I2S audio (dtoverlay=hifiberry-dac and dtoverlay=i2s-mmap). It also tunes boot speed and memory with gpu_mem=32, arm_boost=1, disable_splash=1, boot_delay=0, and initial_turbo=20.
  • asound.conf: Configures ALSA with a dmix software mixer and a softvol (PCM) layer on top of the I2S speakerbonnet hardware card, ensuring multiple audio streams can play together and software volume control works seamlessly in games and the launcher.
  • 99-uinput.rules: Grants GROUP="input" with MODE="0660" on /dev/uinput, paired with /etc/modules-load.d/uinput.conf so the virtual input subsystem is always ready for uinput-pigo-mapper.

2. Wayland Compositor & Systemd Boot Chain

Rather than booting into X11 or a login shell, pigo-config sets up a lean four-unit boot pipeline:

  • lightdisplay.service: Runs early at sysinit.target to enable hardware PWM on GPIO 13 (gpio -g pwm 13 1024 via WiringPi), lighting up the screen immediately.
  • sway.service: A user-level systemd service (backed by seatd.service for KMS/DRM access without a VT login) that starts the Sway Wayland compositor automatically for user pigo.
  • sway.config: Disables XWayland, hides the status bar, locks the EDID-less SPI display to 320x240, forces all game windows fullscreen, and pins app_id="pigogui" as a floating, sticky overlay so the Quick Menu and HUD bars always render cleanly on top of paused games:
output * {
  mode 320x240
  scale 1
  transform normal
}
for_window [app_id=".*"] fullscreen enable
for_window [app_id="pigogui"] fullscreen disable
for_window [app_id="pigogui"] floating enable
for_window [app_id="pigogui"] sticky enable
  • pigogui.service: Waits until $XDG_RUNTIME_DIR/wayland-1 appears, then launches /opt/pigo/pigogui/start.sh with Restart=on-failure.

3. Provisioning, Binaries & Image Slimming (install.sh)

install.sh orchestrates the entire setup: it installs core runtime libraries (sway, seatd, libsdl2-2.0-0, python3-libevdev, pipewire-pulse, network-manager, mpg123, libcurl4, libopenal1, and audio codecs), adds user pigo to video,input,audio,tty, clones or updates pigogui and uinput-pigo-mapper into /opt/pigo/, patches /boot/firmware/cmdline.txt for silent boot on tty3, and fetches the prebuilt ARM64 LVGL micropython binary and WiringPi.

Finally, it aggressively trims the OS footprint: purging unused Wi-Fi/Bluetooth firmware for non-Pi hardware, compilers (gcc, g++), debuggers, manpages, extra locales (keeping only English and German), Python __pycache__ directories, and capping the systemd journal to 20 MB while setting vm.swappiness=10.

Role in the PiGo Handheld Ecosystem

pigo-config is the system integration backbone of PiGo OS. pi-gen-pigo invokes pigo-config/update.sh to transform a generic Raspberry Pi OS Lite rootfs into PiGo OS, and every other component relies on the environment it prepares: uinput-pigo-mapper depends on its udev rules and kernel module, pigogui depends on its Sway/Wayland session and LVGL MicroPython binary, and every game benefits from its silent, fast-booting, low-overhead Linux foundation.

Explore the Repository

Related articles

David Krawiec
About the Author
David Krawiec

I am very interested in many topics related to technology. My current focus lies on how to realize projects with a small budget regarding most importantly the cost of invested time. Being mostly a soloist means getting out most without the abstinence of freedom, performance or quality.