# 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/](file:///home/lux/proj/geminux/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`, `0004-gemini-ssd2092-display-and-touch.patch`, `0005-mt6797-consys-wifi-factory-firmware.patch`, `0006-mt6797-boot-cleanups.patch`). - **Graphics & display**: MediaTek DRM (`mediatek-drm`), Solomon Systech `SSD2092` DSI FHD+ panel & touchscreen, early-boot `simpledrm` (`DRM_SIMPLEDRM=y` + rotated `TER16x32` console), Mali-T880 `panfrost` GPU driver, and `sii902x` Slimport/HDMI bridge. - **Wi-Fi / Bluetooth CONSYS**: Staged `mt6797_wlan_core` and `btmt6797` drivers backed by NVRAM/factory firmware provisioning (`geminux-wifi-nvram` and `firmware-cache/mt6797/`). - **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](file:///home/lux/proj/geminux/prebuilt/kernel/include/linux/mt6797_ccci.h)). - **Boot, LUKS2 FDE & 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). The kernel includes built-in `BLK_DEV_DM=y`, `DM_CRYPT=y`, and ARMv8 AES-CE (`CRYPTO_AES_ARM64_CE_BLK=y`), and the initramfs bundles `cryptsetup` plus a standalone binary Gemini US keymap (`/etc/gemini-us.kmap`). With `DM_DISABLE_UDEV=1`, [src/initramfs/init](file:///home/lux/proj/geminux/src/initramfs/init) runs the off-mode charger guard, optionally unlocks LUKS2 `PARTLABEL=linux` into `/dev/mapper/geminux_root` (whole-device dynamic segment), checks ext4 non-interactively (`e2fsck -p = 68px` status bar, `Mod4 = Fn+Alt` + one-shot `Super_L` tap-latch, and `SIGUSR1` `.Xresources` reload. - `dmenu` with Pango/HarfBuzz, dynamic full-screen-height item rows (`68px` 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/](file:///home/lux/proj/geminux/src/dunst-notify/)), paired with a lightweight GDBus `notify-send` / `dunstify`. ## Custom UI toolkit and zero-poll C11 daemons - **`libgemui.so`** ([src/libgemui/](file:///home/lux/proj/geminux/src/libgemui)): Double-buffered Cairo + Pango/HarfBuzz Xlib toolkit polling X11 events, `SIGUSR1` self-pipe for instant `.Xresources` reloads, dynamic timers, `MSG_NOSIGNAL`/drained Unix socket IPC (`gemui_unix_cmd`), and non-blocking extra FDs (such as V4L2 or `inotify`). - **11 landscape HiDPI applications** ([src/geminux-apps/](file:///home/lux/proj/geminux/src/geminux-apps)): `geminux-control`, `geminux-audio`, `geminux-datetime`, `geminux-net`, `geminux-dialer`, `geminux-callscreen`, `geminux-sms`, `geminux-contacts`, `geminux-camera` (MT6797 Media Controller pipeline + 10-bit Bayer demosaic/AWB software ISP), `geminux-themes`, and `geminux-lock`. - **Zero-poll C11 daemons** ([src/geminux-daemons/](file:///home/lux/proj/geminux/src/geminux-daemons)): - `geminux-powerd` — `epoll` over `/dev/input/event*` (`SW_LID`, `KEY_POWER`), `KOBJECT_UEVENT`, `/run/geminux/powerd.sock`, and on-demand `timerfd`; resolves the active desktop user dynamically from UID `10000`. - `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-touchd` — XInput 2.2 multi-touch gesture daemon (2-finger tap/hold right-click, 3-finger middle-click, 2-finger scroll). - `geminux-leds` — AW9120 back cover RGB controller driving `rgb:indicator-1..5` (default off when idle/full; `rgb:indicator-6` amber while charging; persistent manual override; `SIGPIPE`-safe socket server at `/run/geminux/leds.sock`). - `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-power-ctl`, `geminux-power-audit`, `geminux-tzctl`, `geminux-wifi-nvram`, 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](file:///home/lux/proj/geminux/scripts/package-local-apks.sh) builds seven `.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-bantam` (`bantam` minimalist C++20 CLI AI agent built via [scripts/build-bantam.sh](file:///home/lux/proj/geminux/scripts/build-bantam.sh)) - `geminux-config` 3. `/etc/apk/world` pins all seven with `name@geminux=version` and locks out Rust/Wayland/upstream overrides via `!` constraints from [scripts/rootfs-prune-packages.txt](file:///home/lux/proj/geminux/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](file:///home/lux/proj/geminux/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](file:///home/lux/proj/geminux/scripts/test-flash-mtk-gpt.py)). On staged copies of `geminux-rootfs.img` (without mutating the build output), [scripts/geminux_accounts.py](file:///home/lux/proj/geminux/scripts/geminux_accounts.py) performs pure-Python `$6$` SHA-512 password hashing and offline `debugfs`/`e2fsck` `/etc/{passwd,group,shadow}` + `/home/` provisioning, and [scripts/geminux_luks.py](file:///home/lux/proj/geminux/scripts/geminux_luks.py) optionally wraps the staged ext4 image in an encrypted LUKS2 container via unprivileged host `cryptsetup reencrypt --encrypt --disable-locks`.