Files
geminux/ARCHITECTURE.md
T

5.3 KiB

Architecture

Geminux combines a custom-patched Linux 7.3.5 kernel, pure-Linux MTK flasher, XLibre graphics server, patched suckless X11 stack, and custom C11 applications and daemons, packaged cleanly into signed Alpine APK packages so standard userspace updates continue working indefinitely.

Kernel and MediaTek MT6797X support

  • Kernel tree: Vanilla Linux 7.3.5 patched via patches/kernel/ (0001-ixoo-gemini-pda-mainline-7.3.5.patch, 0002-mt6797-ccci-cldma-and-md1-domain.patch, 0003-arm64-dts-mediatek-geminux-gemini-pda.patch).
  • Graphics & display: MediaTek DRM (mediatek-drm), Novatek DSI panel (panel-novatek-nt36672e), Mali-T880 panfrost GPU driver, and sii902x Slimport/HDMI bridge.
  • Modem / Telephony: Staged mt6797-ccci-cldma driver exposing /dev/ccci_md_ctl, /dev/ccci_fs, /dev/ccci_rpc, /dev/ttyC0..3, and ccmni* network interfaces with the 16-byte struct mt6797_ccci_header UAPI (mt6797_ccci.h).
  • Boot & recovery: Packed LK-compatible Android boot images (images/boot-geminux.img, images/recovery-geminux.img) built with mkbootimg-osm0sis (16 MiB boot slot ceiling, 512 KiB DTB ceiling). On first boot, src/initramfs/init checks ext4 via e2fsck -p and grows the root filesystem via resize2fs.

Graphics, window management, and theming

  • XLibre (25.x): Cross-compiled against pure Alpine Edge aarch64 sysroots with Panfrost Glamor EGL (libglamoregl.so), modesetting_drv.so, fbdev_drv.so, and libinput_drv.so (scripts/build-xlibre.sh). Zero Wayland compositors (sway, weston, phosh, xwayland, etc.) are installed.
  • Patched suckless desktop:
    • st with HarfBuzz font shaping (hb.c) supporting Fira Code programming ligatures, Nerd Font fallback, and SIGUSR1 live .Xresources reload.
    • dwm with Pango/HarfBuzz multi-font bar (drw.c), EWMH/XEmbed system tray, touch-friendly >= 44px status bar, Mod4 = Fn+Alt + one-shot Super_L tap-latch, and SIGUSR1 .Xresources reload.
    • dmenu with Pango/HarfBuzz, 48px touch rows, and mouse/touch click selection.
  • Zero-Rust notifications: dunst v1.12.2 compiled with WAYLAND=0 DUNSTIFY=0 and custom pure-C PNG (libpng + Cairo) / JPEG (libjpeg-turbo) icon loader replacing gdk-pixbuf (src/dunst-notify/), paired with a lightweight GDBus notify-send / dunstify.

Custom UI toolkit and zero-poll C11 daemons

  • libgemui.so (src/libgemui/): Double-buffered Cairo + Pango/HarfBuzz Xlib toolkit polling X11 events, SIGUSR1 self-pipe for instant .Xresources reloads, dynamic timers, and non-blocking extra FDs (such as V4L2 or inotify).
  • Zero-poll C11 daemons (src/geminux-daemons/):
    • geminux-powerd — epoll over /dev/input/event* (SW_LID, KEY_POWER), KOBJECT_UEVENT, /run/geminux/powerd.sock, and on-demand timerfd.
    • geminux-statusd — epoll over signalfd (SIGUSR1), RTMGRP_LINK/RTMGRP_IPV4_IFADDR, KOBJECT_UEVENT, inotify, and minute-aligned timerfd; updates root WM_NAME with zero child shell forks.
    • geminux-ccci-daemon — epoll over /dev/ccci_*, uevents, and /run/geminux/ccci.sock; idles cleanly if MD firmware is absent.
    • geminux-modem-ctl, geminux-bt-obex (GLib GMainLoop/GDBus), geminux-leds, geminux-power-audit, and geminux-checkpw.

APK package pinning and zero-Rust enforcement

To keep Alpine Edge aarch64 userspace freely updatable while locking all hardware-tuned components:

  1. Build-time host Docker containers use postmarketos/v26.06 solely for gcc-aarch64, binutils-aarch64, and mkbootimg-osm0sis. All $SYSROOT trees and the target $ROOTFS use only pure Alpine Edge (main, community, testing) plus the RSA-4096 signed local @geminux repository (/var/lib/geminux/apk-repo).
  2. scripts/package-local-apks.sh builds six .apk packages via apk mkpkg and indexes them into APKINDEX.tar.gz via apk mkndx:
    • geminux-kernel-modules
    • geminux-xlibre
    • geminux-suckless
    • geminux-dunst
    • geminux-ui
    • geminux-config
  3. /etc/apk/world pins all six with name@geminux=version and locks out Rust/Wayland/upstream overrides via ! constraints from scripts/rootfs-prune-packages.txt.
  4. /etc/apk/protected_paths.d/geminux.list shields Geminux configuration directories across upgrades.

Pure-Linux flasher and eMMC layout

flash-mtk.py uses vendored GPLv3 mtkclient + single-chip MTK_DA_V5_MT6797.bin to communicate directly over USB BROM/DA without MediaTek's proprietary GUI. Protected partitions in LBA 0..0x6FFFF (preloader, nvram, proinfo, lk, tee1, md1img, etc.) are backed up and write-blocked by default (0x0E000000 protected boundary verified in scripts/test-flash-mtk-gpt.py).