diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 1d3976f..ce579af 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -1,62 +1,117 @@ # 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. +Geminux combines a custom-patched Linux `7.3.5` kernel, pure-Linux MTK flasher, XLibre graphics server, patched suckless desktop, unified `.Xresources` + wallpaper engine, and zero-poll C11 daemons packaged as signed Alpine APKs so standard Alpine Edge updates continue working cleanly. ## 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`, `0007-mt6797-wlan-peer-deauth-and-rekey.patch`, `0008-gemini-resume-wake-and-spm-standby.patch`, `0009-mt6797-wlan-drop-free-stability.patch`, `0010-mt6797-ccci-md1-boot-hs-v2-and-rpc.patch`, `0011-gemini-lid-sync-filter-and-debounce.patch` adding synchronous Hall GPIO66 lid-close keyboard/touch filtering, `1 ms` Hall EINT debounce, `10 ms` matrix keypad debounce, and touchscreen inhibit, and `0012-gemini-lid-wake-and-fg-taper-fix.patch` adding `gemini-lid` `PM_POST_SUSPEND`/raw-GPIO recheck reconciliation to prevent stuck `BL_CORE_SUSPENDED` / input inhibition alongside `mt6351-fuel-gauge` + `bq25890` boot zero-current OCV calibration (`POWER_SUPPLY_PROP_CALIBRATE` / `MT6351_RGS_CHRDET`), consecutive `win_ua`+`reg_ua` CV-taper validation, `+1%` conservative step caps, and `180 mV` boot-sag `ADC21` tolerance), with `CONFIG_XFRM_USER=y` and `esp4`, `esp6`, `af_key`, and `xfrm_interface` modules enabled for 3GPP IMS IPsec. -- **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/`), hardened by `0007` and `0009` for peer deauth, GTK rekey, and drop-free RX/TX buffer handling. -- **Modem / Telephony / eSIM / IMS**: 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)). `geminux-ccci-daemon` ([geminux-ccci-fs.c](file:///home/lux/proj/geminux/src/geminux-daemons/geminux-ccci-fs.c)) serves MD1 boot handshake v2, NVRAM/CCCI_FS file I/O, and RPC queries (`MD_STATE=READY`); `geminux-cellctl` ([geminux-cellctl.c](file:///home/lux/proj/geminux/src/geminux-daemons/geminux-cellctl.c)) handles physical SIM vs. ST33 eUICC `AT+ESIMS` slot switching, `lpac` AT-`CSIM`/`CGLA` APDU bridging for eSIM provisioning, and `ccmni*` LTE PDN bring-up; `geminux-imsd` ([geminux-imsd.c](file:///home/lux/proj/geminux/src/geminux-daemons/geminux-imsd.c)) provides 3GPP VoLTE over `ccmni*` and VoWiFi `SWu` IKEv2/IPsec via `strongswan`, ISIM/USIM MILENAGE AKA, kernel XFRM `ipsec-3gpp` with RFC 4303 userspace ESP fallback, SIP `REGISTER`/`INVITE`/`BYE`/`MESSAGE`, 3GPP `RP-DATA` SMS, and 20 ms `timerfd` AMR-NB/AMR-WB/G.711/DTMF RTP bridged to PipeWire/ALSA `VoiceCall` UCM2. -- **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, `Fn+F` (`XF86XK_UWB`/`XF86XK_RFKill`) hardware Airplane Mode binding, `SIGHUP` self-reexec, and `SIGUSR1` `.Xresources` reload. - - `dmenu` with Pango/HarfBuzz, dynamic full-screen-height item rows (`68px` touch rows), and mouse/touch click selection, paired with `geminux-launcher` pinning the 11 GUI apps alongside `Webarchy Browser`, `Bantam AI agent`, and `Lynx Web Browser` in `st` (and wrapping `Terminal=true` `.desktop` entries in `st -e`). -- **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`. -- **Unified desktop, GTK2/3/4, Qt5/6 & Tk (`gtkTtk`) theming**: Switching `.xth` palettes via `geminux-themes` or `geminux-apply-theme` updates `~/.Xresources`, `dunstrc` (`geminux-sync-dunst-theme`), and via `geminux-sync-gtk-theme` generates a light- or dark-based `Geminux-` theme across GTK2 (`gtk-2.0/gtkrc`, `~/.gtkrc-2.0`), GTK3 (`gtk-3.0/gtk.css`, `~/.config/gtk-3.0/{settings.ini,gtk.css}`), GTK4/`libadwaita` (`gtk-4.0/gtk.css`, `~/.config/gtk-4.0/{settings.ini,gtk.css}` with `@define-color` and `:root` custom variables plus `dconf`-backed `gsettings` `color-scheme`), `xsettingsd` (`~/.config/xsettingsd/xsettingsd.conf`), Qt6 (`~/.config/qt6ct/{qt6ct.conf,colors/Geminux-.conf}` 21-role `QPalette`), and Kvantum (`~/.config/Kvantum/Geminux/Geminux.kvconfig`) before merging `~/.Xresources` via `xrdb`. [10-geminux-env.sh](file:///home/lux/proj/geminux/overlay/rootfs/etc/profile.d/10-geminux-env.sh) sets `ADW_DISABLE_PORTAL=1` (so `libadwaita` binds directly to `dconf`/`gsettings` `color-scheme` on portal-free X11 with live updates) and `QT_QPA_PLATFORMTHEME=qt6ct:gtk3` (routing Qt6 to `qt6ct-style` and Qt5 dialogs to `libqgtk3.so`, with Kvantum configs ready for `QT_STYLE_OVERRIDE=kvantum`), GTK2 writes DPI-scaled `xthickness`/`ythickness` and style metrics (`192 DPI` / `2x`) alongside `*TkTheme: gtkTtk` to auto-load preinstalled `gtkTtk 0.9` in Tk/Ttk/Tkinter apps against `~/.gtkrc-2.0` (with DPI-scaled widget geometry, negative-pixel font heights matched to `theme.baseFontSize`, zero-poll X11 `RESOURCE_MANAGER` `PropertyNotify` live reloading across [src/gtkTtk/](file:///home/lux/proj/geminux/src/gtkTtk/), and pure-X11 XImage blitting avoiding `gdk-pixbuf-xlib`), alongside `SIGUSR1` for live `dwm`, `st`, `webarchy`, and `libgemui` clients. Preinstalled `tcl` (`tcl-lib` + `tcl-tls`) and `tk` run cleanly on the same stack. -- **Webarchy & pure-C `gdk-pixbuf`**: [src/webarchy/webarchy.cpp](file:///home/lux/proj/geminux/src/webarchy/webarchy.cpp) provides a standalone C++20 `GTK3` + `WebKit2GTK-4.1` multi-tab browser adapted for the `2160x1080` ultrawide display (`1080x506` logical @ `GDK_SCALE=2`) with a collapsible flush-right vertical tab bar, DPI-scaled `pt` CSS reloaded live from `~/.Xresources` via `SIGUSR1` (selecting the generated `Geminux-` GTK3 theme and dark/light preference dynamically), persistent SQLite cookies/bookmarks under `~/.local/share/geminux/webarchy` and `~/.config/geminux/webarchy`, single-instance FIFO URL forwarding, and automatic CPU renderer fallback on WebProcess crash. [scripts/build-webarchy.sh](file:///home/lux/proj/geminux/scripts/build-webarchy.sh) also cross-compiles pure-C GNOME `gdk-pixbuf 2.42.12` (`-Dbuiltin_loaders=all`, zero `libglycin`/`librsvg`) so `gtk+3.0` and `gst-plugins-good` install cleanly without Rust, and [scripts/compile-gsettings-schemas.sh](file:///home/lux/proj/geminux/scripts/compile-gsettings-schemas.sh) compiles `/usr/share/glib-2.0/schemas/gschemas.compiled` for `WebKitNetworkProcess`. -- **Native media & `yt-dlp` stack**: Native Alpine Edge `mpv` (configured via [overlay/rootfs/etc/mpv/mpv.conf](file:///home/lux/proj/geminux/overlay/rootfs/etc/mpv/mpv.conf) for Panfrost X11 EGL, PipeWire/Pulse/ALSA, and `/tmp/geminux-mpv.sock` media-key IPC), `ffmpeg`/`ffprobe`, and `gst-libav` (for WebKit HTML5 media), paired with `mpg123`, `openmpt123`, `python3`/`py3-pip`, and `yt-dlp-core` + `yt-dlp-ejs-rt-quickjs` (`quickjs`, avoiding `deno`/`py3-cryptography`). +### Hardware subsystems + +- **Graphics & display**: MediaTek DRM (`mediatek-drm`), `SSD2092` DSI FHD+ panel/touch, early-boot `simpledrm` (`DRM_SIMPLEDRM=y` + rotated `TER16x32` console), Mali-T880 `panfrost` GPU, 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/`), hardened by `0007` and `0009`. +- **Modem / Telephony / eSIM / IMS**: `mt6797-ccci-cldma` exposes `/dev/ccci_md_ctl`, `/dev/ccci_fs`, `/dev/ccci_rpc`, `/dev/ttyC0..3`, and `ccmni*` via the 16-byte `struct mt6797_ccci_header` UAPI ([prebuilt/kernel/include/linux/mt6797_ccci.h](prebuilt/kernel/include/linux/mt6797_ccci.h)): + - [geminux-ccci-fs.c](src/geminux-daemons/geminux-ccci-fs.c) (`geminux-ccci-daemon`): MD1 boot HS v2, NVRAM/CCCI_FS I/O, and RPC (`MD_STATE=READY`). + - [geminux-cellctl.c](src/geminux-daemons/geminux-cellctl.c) (`geminux-cellctl`): physical SIM vs. ST33 eUICC `AT+ESIMS` switching, `lpac` AT-`CSIM`/`CGLA` APDU bridging, and `ccmni*` LTE PDN bring-up. + - [geminux-imsd.c](src/geminux-daemons/geminux-imsd.c) (`geminux-imsd`): 3GPP VoLTE (`ccmni*`) & VoWiFi (`SWu` IKEv2/IPsec via `strongswan`), MILENAGE AKA, kernel XFRM `ipsec-3gpp` (with RFC 4303 userspace ESP fallback), SIP signaling, `RP-DATA` SMS, and 20 ms `timerfd` AMR-NB/AMR-WB/G.711/DTMF RTP bridged to PipeWire/ALSA `VoiceCall`. +- **Boot, LUKS2 FDE & recovery**: LK-compatible images (`images/boot-geminux.img`, `images/recovery-geminux.img`) built with `mkbootimg-osm0sis` (`16 MiB` boot ceiling, `512 KiB` DTB ceiling). Built-in `BLK_DEV_DM=y`, `DM_CRYPT=y`, and ARMv8 AES-CE (`CRYPTO_AES_ARM64_CE_BLK=y`) power initramfs unlock (`cryptsetup` + `/etc/gemini-us.kmap`, `DM_DISABLE_UDEV=1`). [src/initramfs/init](src/initramfs/init) runs the off-mode charger guard, optionally unlocks `PARTLABEL=linux` -> `/dev/mapper/geminux_root`, checks ext4 (`e2fsck -p = 78 px` touch top bar, `Mod4 = Fn+Alt` + one-shot `Super_L` tap-latch, `Fn+F` Airplane Mode binding, `Mod4 + Shift + r` & `SIGUSR1` `.Xresources` reload, and `SIGHUP` self-reexec. +- **`dmenu`**: Pango/HarfBuzz rendering with `82 px` touch rows, `dmenu_xerror` recursion & non-fatal `RENDER` guards, `FC_COLOR=FcFalse` + UTF-8 sanitization, and direct mouse/touch selection. Pairs with `geminux-launcher` pinning the 11 GUI apps alongside `Wallpaper`, `Webarchy Browser`, `Bantam AI agent`, and `Lynx Web Browser` in `st` (wrapping `Terminal=true` `.desktop` entries in `st -e`). +- **`st`**: HarfBuzz Fira Code ligatures (`hb.c`), Nerd Font fallback, mouse/two-finger wheel scrollback, immediate cursor redraw on `FocusIn`/`FocusOut` + unfocused blink gating, and live theme reloading via both direct `XA_RESOURCE_MANAGER` `PropertyNotify` and `SIGUSR1`. +- **Notifications**: Pure-X11 zero-`gdk-pixbuf` `dunst v1.12.2` (`WAYLAND=0 DUNSTIFY=0`) with custom pure-C PNG/JPEG icon loader ([src/dunst-notify/](src/dunst-notify/)) and lightweight GDBus `notify-send` / `dunstify`. + +## Unified theming and native X11 wallpaper engine + +Geminux defaults to the **Anodized** theme (`192 DPI`, `baseFontSize: 32`, `Xcursor.size: 64`) across `/etc/skel/.Xresources` and all compiled-in and script fallbacks. On login, `geminux-session` non-destructively copies newly added `/etc/skel/.xthemes/*.xth` themes into `~/.xthemes/` and loads `~/.Xresources` cleanly via `xrdb -nocpp -load`. + +### Theme editor, importer & toolkit synchronization + +- **Editor & Importer**: [geminux-xth.h](src/geminux-apps/geminux-xth.h) provides shared `.xth` parsing/serialization for `geminux-themes` (`Edit`, `Duplicate`, `New`, `Reset`/`Delete`, live WCAG contrast ratio against `bgMain`, and `Import .xth` stored under `~/.config/geminux/themes/`). +- **Synced targets**: `geminux-apply-theme` (`.xth` -> `~/.Xresources` + `xrdb -nocpp -load`) synchronizes: + - **Dunst**: `~/.config/dunst/dunstrc` via `geminux-sync-dunst-theme` + - **GTK2 / GTK3 / `xsettingsd`**: `Geminux-` light/dark styling in `~/.gtkrc-2.0`, `~/.config/gtk-3.0/{settings.ini,gtk.css}`, and `~/.config/xsettingsd/xsettingsd.conf` (`SIGHUP` reload) + - **GTK4 & `libadwaita`**: `~/.config/gtk-4.0/{settings.ini,gtk.css}` + `dconf` `color-scheme` (`ADW_DISABLE_PORTAL=1` in [10-geminux-env.sh](overlay/rootfs/etc/profile.d/10-geminux-env.sh)) + - **Qt5 / Qt6**: `qt6ct` 21-role `QPalette` (`QT_QPA_PLATFORMTHEME=qt6ct:gtk3`) and Kvantum (`QT_STYLE_OVERRIDE=kvantum`) + - **Tcl/Tk (`gtkTtk 0.9`)**: `*TkTheme: gtkTtk` + DPI-scaled widget geometry against `~/.gtkrc-2.0` with pure-X11 XImage blitting and zero-poll `XA_RESOURCE_MANAGER` live reload ([src/gtkTtk/](src/gtkTtk/)) + - **X11 clients**: Instant redraw via `XA_RESOURCE_MANAGER` `PropertyNotify` and `SIGUSR1` (`dwm`, `st`, `webarchy`, `libgemui`) + +### Native X11 + Cairo wallpaper engine + +- **Core engine**: [geminux-wallpaper.h](src/geminux-apps/geminux-wallpaper.h) (pure-C11 config & placement geometry) + [geminux-wallpaper-x11.h](src/geminux-apps/geminux-wallpaper-x11.h) (X11/Cairo renderer) integrated into `geminux-themes` and exposed to CLI via `geminux-apply-wallpaper`. +- **Image decoders**: Decodes via runtime `dlopen("libgdk_pixbuf-2.0.so.0")` (EXIF auto-orientation + PNG/JPEG/GIF/BMP/ICO/XPM/XBM/TGA/PNM powered by `geminux-gdk-pixbuf`), Cairo PNG, `libjpeg-turbo`, `libwebp`, and optional `magick`/`convert` fallback. +- **Root Pixmap protocol**: Renders onto an X11 root `Pixmap` using a dedicated `Display` connection with `XSetCloseDownMode(..., RetainPermanent)`, publishing `_XROOTPMAP_ID` and `ESETROOT_PMAP_ID` and cleaning up previous clients via `XKillClient`. Supports multi-monitor geometry via XRandR and Xinerama. +- **Persistence & hooks**: Saves state to `~/.config/geminux/wallpaper.conf` and restores automatically on login (`geminux-session`), on theme changes when `USE_THEME_BG=1` (`geminux-apply-theme`), and after external HDMI `xrandr` layout switches (`geminux-net`). + +### Webarchy, pure-C `gdk-pixbuf` & media stack + +- **Webarchy**: [src/webarchy/webarchy.cpp](src/webarchy/webarchy.cpp) is a C++20 `GTK3` + `WebKit2GTK-4.1` browser tuned for `2160x1080` (`1080x506` logical @ `GDK_SCALE=2`) with a collapsible right-side vertical tab bar, `SIGUSR1` `.Xresources` reloading, SQLite cookies/bookmarks, single-instance FIFO forwarding, and WebProcess crash software fallback. +- **Pure-C `gdk-pixbuf` & schemas**: [scripts/build-webarchy.sh](scripts/build-webarchy.sh) cross-compiles pure-C GNOME `gdk-pixbuf 2.42.12` (`-Dbuiltin_loaders=all`, zero `libglycin`/`librsvg`), and [scripts/compile-gsettings-schemas.sh](scripts/compile-gsettings-schemas.sh) builds `/usr/share/glib-2.0/schemas/gschemas.compiled`. +- **Media & `yt-dlp`**: Native Alpine Edge `mpv` ([overlay/rootfs/etc/mpv/mpv.conf](overlay/rootfs/etc/mpv/mpv.conf) — Panfrost X11 EGL, PipeWire/Pulse/ALSA, `/tmp/geminux-mpv.sock` IPC), `ffmpeg`/`ffprobe`, `gst-libav`, `mpg123`, `openmpt123`, `python3`/`py3-pip`, and `yt-dlp` (`quickjs`, avoiding `deno`/`py3-cryptography`). ## 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` (including hardware Airplane Mode toggle), `geminux-audio`, `geminux-datetime`, `geminux-net` (5 tabs including Wi-Fi, Cellular/ST33 eSIM management, Airplane Mode banner, and `DNS` configuration), `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`, `mtk-pmic-keys` `KEY_ESC` wakeup, keyboard/touch/pointer activity), filtered `KOBJECT_UEVENT` (`input` rescan lid-state reconciliation, `power_supply`, `drm`), `/run/geminux/powerd.sock`, and `timerfd`; enforces `inhibit_ac_lid` (blanks/locks without unloading CONSYS or invoking `/sys/power/state` while on USB/AC), tears down/reloads `mt6797_consys` and offlines non-boot CPUs across battery `mem` sleep or zero-thrash `low_power_standby` when `MD1` is powered (no `freeze`/`s2idle` fallback), manages persisted hardware Airplane Mode (`/var/lib/geminux/airplane-mode`, `/run/geminux/airplane-mode`) by unloading CONSYS Wi-Fi/BT kernel modules and placing MD1 in `AT+CFUN=4` while leaving `usb0` up, drives two-stage screensaver idle dim/lock/suspend timed from the last active user input, and resolves the active desktop user dynamically from UID `10000`. - - `geminux-statusd` — `epoll` over `signalfd` (`SIGUSR1`), `RTMGRP_LINK`/`RTMGRP_IPV4_IFADDR`, filtered `KOBJECT_UEVENT` (`power_supply`, `net`), `inotify`, and minute-aligned `timerfd`; displays `AIRPLANE` when hardware Airplane Mode is active and deduplicates root `WM_NAME` updates 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`, serving MD1 boot HS v2, `CCCI_FS` NVRAM I/O, and RPC cleanly (idles if MD firmware is absent). - - `geminux-cellctl` & `geminux-imsd` — cellular/eSIM controller (`AT+ESIMS`, `lpac`, `ccmni*`) and event-driven IMS daemon (`/run/geminux/imsd.sock`). - - `geminux-modem-ctl`, `geminux-bt-obex` (GLib `GMainLoop`/GDBus), `geminux-dnsctl`, `geminux-power-ctl`, `geminux-power-audit`, `geminux-tzctl`, `geminux-wifi-nvram`, and `geminux-checkpw`. +- **`libgemui.so`** ([src/libgemui/](src/libgemui/)): Double-buffered Cairo + Pango/HarfBuzz Xlib toolkit with direct `XA_RESOURCE_MANAGER` `PropertyNotify` and `SIGUSR1` `.Xresources` live reloads, fullscreen lockscreen visibility restacking, button contrast guards, X11 clipboard paste, dynamic timers, `MSG_NOSIGNAL` socket IPC (`gemui_unix_cmd`), and non-blocking extra FDs. +- **11 landscape HiDPI apps** ([src/geminux-apps/](src/geminux-apps/)): `geminux-control`, `geminux-audio`, `geminux-datetime`, `geminux-net` (Wi-Fi, Cellular/ST33 eSIM, Bluetooth, HDMI, `DNS` tab, Airplane Mode), `geminux-dialer`, `geminux-callscreen`, `geminux-sms`, `geminux-contacts`, `geminux-camera`, `geminux-themes` (Themes, Theme Editor, `.xth` Importer & Wallpaper), and `geminux-lock`. +- **Zero-poll C11 daemons** ([src/geminux-daemons/](src/geminux-daemons/)): + - **`geminux-powerd`**: `epoll` over `/dev/input/event*` (`SW_LID`, `KEY_POWER`, `mtk-pmic-keys` `KEY_ESC`), filtered `KOBJECT_UEVENT` (`input`, `power_supply`, `drm`), `/run/geminux/powerd.sock`, and `timerfd`: + - Enforces `inhibit_ac_lid` (locks/blanks without unloading CONSYS or calling `/sys/power/state` while on USB/AC). + - Tears down `mt6797_consys` and parks `cpu1..9` offline before battery `mem` suspend or zero-thrash `low_power_standby` when `MD1` is active (never `freeze`/`s2idle`). + - Polls post-resume input/lid events (`90 ms`) even when the lid is open so only a `closed -> open` lid transition, real `EV_KEY`/`EV_REL`/`EV_ABS` activity, or USB/AC attach counts as a wake; internal timer wakes during open-lid idle lock re-suspend cleanly (`quiet_timer_resleep`) without reloading CONSYS or waking the backlight. + - Persists hardware Airplane Mode (`/var/lib/geminux/airplane-mode`) and resolves UID `10000` dynamically. + - **`geminux-statusd`**: `epoll` over `signalfd` (`SIGUSR1`), `RTMGRP_LINK`/`RTMGRP_IPV4_IFADDR`, filtered `KOBJECT_UEVENT` (`power_supply`, `net`), `inotify`, and minute-aligned `timerfd`; shows `AIRPLANE` status and deduplicates `WM_NAME` updates with zero shell forks. + - **`geminux-touchd`**: XInput 2.2 multi-touch gesture recognizer. + - **`geminux-leds`**: AW9120 back cover RGB controller (`/run/geminux/leds.sock`, off when idle/100%, amber `rgb:indicator-6` while charging, persistent manual override). + - **`geminux-ccci-daemon`, `geminux-cellctl`, `geminux-imsd`, `geminux-modem-ctl`, `geminux-bt-obex`, `geminux-dnsctl`, `geminux-power-ctl`, `geminux-power-audit`, `geminux-tzctl`, `geminux-wifi-nvram`, `geminux-checkpw`**: Event-driven platform daemons and control helpers. ## APK package pinning and package policy -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 eleven `.apk` packages via `apk mkpkg` and indexes them into `APKINDEX.tar.gz` via `apk mkndx`: +1. **Pure Edge rootfs**: Host Docker containers use `postmarketos/v26.06` only for `gcc-aarch64`, `binutils-aarch64`, and `mkbootimg-osm0sis`. Both `$SYSROOT` and target `$ROOTFS` come strictly from **Alpine Edge** (`main`, `community`, `testing`) plus the RSA-4096 signed local `@geminux` repo (`/var/lib/geminux/apk-repo`). +2. **Eleven signed local packages**: [scripts/package-local-apks.sh](scripts/package-local-apks.sh) builds and indexes: - `geminux-kernel-modules` - `geminux-xlibre` - `geminux-suckless` - `geminux-dunst` - `geminux-ui` - - `geminux-bantam` (`bantam` minimalist C++20 CLI AI agent with `kilo-auto/free` default model, built via [scripts/build-bantam.sh](file:///home/lux/proj/geminux/scripts/build-bantam.sh)) - - `geminux-gsocket` (`gs-netcat` / `gsocket` NAT traversal toolkit built via [scripts/build-gsocket.sh](file:///home/lux/proj/geminux/scripts/build-gsocket.sh)) - - `geminux-gdk-pixbuf` (pure-C zero-glycin `gdk-pixbuf 2.42.12` built via [scripts/build-webarchy.sh](file:///home/lux/proj/geminux/scripts/build-webarchy.sh)) - - `geminux-webarchy` (`webarchy` / `xwebarchy` browser built via [scripts/build-webarchy.sh](file:///home/lux/proj/geminux/scripts/build-webarchy.sh)) - - `geminux-gtkttk` (`gtkTtk 0.9` dynamic GTK2 theme engine for Tk/Ttk/Tkinter built via [scripts/build-gtkttk.sh](file:///home/lux/proj/geminux/scripts/build-gtkttk.sh)) - - `geminux-config` (includes `/etc/mpv/mpv.conf`, `/etc/htoprc`, `/etc/skel/.config/htop/htoprc`, `/etc/skel/.lynx.cfg`, `/etc/skel/.apexrc`, `/etc/skel/.bashrc` with `GPG_TTY`, `/etc/profile.d/10-geminux-env.sh` adding `sbin` paths for `dosfstools`, and `/etc/init.d/geminux-sdcard` + `/etc/udev/rules.d/95-geminux-sdcard.rules` + `/usr/sbin/geminux-sdcard-mount` for boot/`eudev` hotplug automounting of `/dev/mmcblk1p1` or superfloppy `/dev/mmcblk1` into `/media/sdcard` with `UID 10000` + `plugdev` `0660`/`0775` permissions across `vfat`, `exfat`, and POSIX `ext4`/`ext3`/`ext2`) -3. `/etc/apk/world` pins all eleven with `name@geminux=version` and locks out Rust/Wayland/upstream overrides (with `librsvg`, `rav1e`/`rav1e-libs`, and `libdovi` whitelisted) via `!` constraints from [scripts/rootfs-prune-packages.txt](file:///home/lux/proj/geminux/scripts/rootfs-prune-packages.txt). Verified automatically by an ELF binary Rust scan, `apk upgrade --simulate`, and 9 host Python unit suites in [scripts/check-rebuild.sh](file:///home/lux/proj/geminux/scripts/check-rebuild.sh). -4. `/etc/apk/protected_paths.d/geminux.list` shields Geminux configuration directories across upgrades. + - `geminux-bantam` ([scripts/build-bantam.sh](scripts/build-bantam.sh)) + - `geminux-gsocket` ([scripts/build-gsocket.sh](scripts/build-gsocket.sh)) + - `geminux-gdk-pixbuf` ([scripts/build-webarchy.sh](scripts/build-webarchy.sh)) + - `geminux-webarchy` ([scripts/build-webarchy.sh](scripts/build-webarchy.sh)) + - `geminux-gtkttk` ([scripts/build-gtkttk.sh](scripts/build-gtkttk.sh)) + - `geminux-config` (`/etc/mpv/mpv.conf`, `/etc/htoprc`, `~/.lynx.cfg`, `~/.apexrc`, `~/.bashrc` with `GPG_TTY`, `/etc/profile.d/10-geminux-env.sh`, `/etc/init.d/geminux-sdcard` + `95-geminux-sdcard.rules` + `/usr/sbin/geminux-sdcard-mount`) +3. **World pins & exclusions**: `/etc/apk/world` exact-pins all 11 with `name@geminux=version` and blocks Rust/Wayland/override packages via `!` constraints from [scripts/rootfs-prune-packages.txt](scripts/rootfs-prune-packages.txt) (`librsvg`, `rav1e`/`rav1e-libs`, `libdovi` whitelisted). Enforced by ELF Rust scans, `apk upgrade --simulate`, and 9 host Python test suites in [scripts/check-rebuild.sh](scripts/check-rebuild.sh). +4. **Config protection**: `/etc/apk/protected_paths.d/geminux.list` shields Geminux config directories across `apk upgrade`. ## 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)). +[flash-mtk.py](flash-mtk.py) embeds vendored GPLv3 `mtkclient` + `MTK_DA_V5_MT6797.bin` to communicate directly over USB BROM/DA. Protected partitions in `LBA 0..0x6FFFF` (`preloader`, `nvram`, `proinfo`, `lk`, `tee1`, `md1img`, etc.) are backed up and write-blocked by default (`0x0E000000` boundary verified in [scripts/test-flash-mtk-gpt.py](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`. +On staged copies of `geminux-rootfs.img` (without modifying `images/geminux-rootfs.img`), [scripts/geminux_accounts.py](scripts/geminux_accounts.py) handles offline `$6$` SHA-512 `/etc/{passwd,group,shadow}` and `/home/` provisioning via `debugfs`/`e2fsck`, and [scripts/geminux_luks.py](scripts/geminux_luks.py) optionally wraps the staged ext4 image in LUKS2 via unprivileged host `cryptsetup reencrypt --encrypt --disable-locks`. diff --git a/INSTALL.md b/INSTALL.md index 781cbe6..0edf843 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,15 +1,15 @@ # Installation guide -This guide covers building Geminux images and flashing a Planet Computers Gemini PDA (Wi-Fi + 4G, MT6797X) directly from Linux without MediaTek's proprietary FlashTool GUI. +This guide walks through building Geminux images and flashing a **Planet Computers Gemini PDA** (Wi-Fi + 4G, MT6797X) directly from Linux without MediaTek's proprietary FlashTool GUI. ## Prerequisites on the Linux host -1. Docker (`docker`) installed and running for `aarch64` cross-compilation and Alpine rootfs assembly. -2. Python 3 (`python3`), `libusb-1.0`, and `udev` / `sudo` permissions for USB MediaTek BROM/DA access. -3. Optional: `img2simg` and `simg2img` (`android-tools` or `ext4` sparse utilities) if you want Android sparse rootfs conversion. -4. A Planet Computers Gemini PDA (x27 Wi-Fi+4G) and a USB-C data cable connected directly to a host USB port (avoid unpowered hubs). +1. **Docker** (`docker`) installed and running for `aarch64` cross-compilation and Alpine rootfs assembly. +2. **Host tools**: `python3`, `libusb-1.0`, and `udev` or `sudo` privileges for MediaTek USB BROM/DA access. +3. **Optional sparse tools**: `img2simg` and `simg2img` (`android-tools` or `ext4` sparse utilities) if you want Android sparse image output. +4. **Hardware**: A Planet Computers Gemini PDA (x27 Wi-Fi + 4G) and a USB-C data cable connected directly to a host USB port (avoid unpowered hubs). -On Linux hosts running `ModemManager`, [flash-mtk.sh](file:///home/lux/proj/geminux/flash-mtk.sh) automatically pauses `ModemManager` during flashing and restarts it on exit so `/dev/ttyACM*` is not claimed away from the MediaTek Preloader/BROM handshake. +On hosts running `ModemManager`, [flash-mtk.sh](flash-mtk.sh) automatically pauses `ModemManager` during flashing and restarts it on exit so `/dev/ttyACM*` is not claimed away from the BROM/Preloader handshake. ## Step 1: Build the Geminux images @@ -20,27 +20,28 @@ From the repository root: ./scripts/check-rebuild.sh ``` -This generates: +This writes: -- `images/boot-geminux.img` (`<= 16 MiB` LK boot slot image containing `Image.gz`, `mt6797-gemini-pda-geminux.dtb`, and initramfs) -- `images/recovery-geminux.img` (initramfs recovery image with USB NCM network shell) -- `images/geminux-rootfs.img` (ext4 root filesystem labeled `geminux-root`) -- `images/geminux-rootfs.simg` (Android sparse copy of `geminux-rootfs.img` when `img2simg` is installed) +- `images/boot-geminux.img` — `<= 16 MiB` LK boot image containing `Image.gz`, `mt6797-gemini-pda-geminux.dtb`, and initramfs +- `images/recovery-geminux.img` — initramfs recovery image with USB NCM rescue shell +- `images/geminux-rootfs.img` — ext4 root filesystem labeled `geminux-root` +- `images/geminux-rootfs.simg` — Android sparse copy (generated when `img2simg` is installed) - `images/SHA256SUMS` ## Step 2: Backup factory partitions and extract MediaTek firmware -Never wipe or overwrite MediaTek factory calibration, baseband, or bootloader partitions (`proinfo`, `nvram`, `nvdata`, `protect1`, `protect2`, `seccfg`, `lk`, `tee1`, `md1img`, `scp1`, `preloader`). +> [!WARNING] +> Never wipe or overwrite MediaTek factory calibration, baseband, or bootloader partitions (`proinfo`, `nvram`, `nvdata`, `protect1`, `protect2`, `seccfg`, `lk`, `tee1`, `md1img`, `scp1`, `preloader`). -Power off the Gemini PDA completely and keep it unplugged. Run the backup command, then plug the USB-C cable into the **left** USB-C port (closest to the Esc side) while the device is powered off to enter MediaTek BROM/Preloader mode: +Power off the Gemini PDA completely and leave it unplugged. Run the backup command, then plug the USB-C cable into the **left** USB-C port (closest to the Esc side) while powered off to enter MediaTek BROM/Preloader mode: ```sh ./flash-mtk.sh --only-backup ``` -Backups are saved under `backup//` together with `pgpt.bin` and `sgpt.bin`. +Backups are stored under `backup//` alongside `pgpt.bin` and `sgpt.bin`. -Next, extract the device-owned proprietary MediaTek firmware blobs (`MT6797` Wi-Fi, Bluetooth, SPM, and MD1 radio images, which are never redistributed in git) either directly from the Gemini's existing Android `system` partition or from a local `system.img`: +Next, extract the device-owned proprietary MediaTek firmware blobs (`MT6797` Wi-Fi, Bluetooth, SPM, and MD1 radio images, never redistributed in git) either from the Gemini's existing Android `system` partition or from a local `system.img`: ```sh # From a connected Gemini in BROM mode: @@ -50,7 +51,7 @@ Next, extract the device-owned proprietary MediaTek firmware blobs (`MT6797` Wi- ./flash-mtk.sh --extract-firmware --system-img /path/to/system.img ``` -Extracted blobs are placed in `firmware-cache/mt6797/` and automatically injected into `/lib/firmware/mediatek/mt6797/` the next time `./rebuild-image.sh` runs. Re-run `./rebuild-image.sh` after extracting firmware so `geminux-rootfs.img` includes the blobs: +Extracted blobs go into `firmware-cache/mt6797/` and are injected into `/lib/firmware/mediatek/mt6797/` on build. Re-run `./rebuild-image.sh` so `geminux-rootfs.img` bundles them: ```sh ./rebuild-image.sh @@ -58,29 +59,31 @@ Extracted blobs are placed in `firmware-cache/mt6797/` and automatically injecte ## Step 3: Flash full eMMC with Geminux -Geminux claims the entire user-writable eMMC past the protected MediaTek region (`LBA 0x70000`, byte offset `0x0E000000`, `SYS0..SYS27`), removing Android `system`, `cache`, and `userdata` in favor of `boot`, `recovery`, `boot2`, and a single full-disk `linux` ext4 partition: +Geminux claims all user-writable eMMC past the protected MediaTek boundary (`LBA 0x70000`, byte offset `0x0E000000`, `SYS0..SYS27`), replacing Android `system`, `cache`, and `userdata` with `boot`, `recovery`, `boot2`, and a single full-disk `linux` ext4 partition: ```sh # Interactive: prompts for desktop username, desktop password, root password, -# and optional LUKS2 full-disk encryption before waiting for USB BROM/Preloader: +# and optional LUKS2 encryption before waiting for USB BROM/Preloader: ./flash-mtk.sh --flash-full -# Non-interactive with explicit credentials and interactive LUKS2 passphrase: +# Non-interactive with explicit username, prompted passwords, and LUKS2 encryption: ./flash-mtk.sh --flash-full --username alice --ask-user-password --ask-root-password --encrypt # Non-interactive using image defaults (unencrypted): ./flash-mtk.sh --flash-full --use-default-credentials ``` -What `--flash-full` does automatically (implemented in [flash-mtk.py](file:///home/lux/proj/geminux/flash-mtk.py), [scripts/geminux_accounts.py](file:///home/lux/proj/geminux/scripts/geminux_accounts.py), [scripts/geminux_luks.py](file:///home/lux/proj/geminux/scripts/geminux_luks.py), and [scripts/geminux_gpt.py](file:///home/lux/proj/geminux/scripts/geminux_gpt.py)): +### What `--flash-full` performs -1. Resolves desktop `username`, desktop `password`, `root` `password`, and optional `--encrypt` LUKS2 passphrase before waiting for USB BROM/Preloader. Flags available: `--username`, `--user-password`, `--ask-user-password`, `--root-password`, `--ask-root-password`, `--use-default-credentials`, `--encrypt`, `--luks-password`, and `--ask-luks-password`. The LUKS2 disk passphrase is independent of the desktop and `root` login passwords (though you may enter the same passphrase if desired). -2. Takes an initial backup into `backup//` (or pass `--skip-backup --backup-dir backup/` on subsequent reflashes to reuse an existing backup). -3. Verifies the protected factory partition layout before `0x0E000000` (`pass --force-gpt` only if intentionally converting a non-standard partition table). -4. Writes updated Primary GPT (`LBA 0..33`) and Backup GPT with a mandatory readback verification check. -5. Stages a temporary copy of `geminux-rootfs.img` (leaving `images/geminux-rootfs.img` unmodified), provisions `/etc/passwd`, `/etc/group`, `/etc/shadow`, and `/home/` via `debugfs`/`e2fsck`, optionally wraps it inside a LUKS2 container (`aes-xts-plain64`, Argon2id), writes `boot-geminux.img` to `boot` and `boot2`, `recovery-geminux.img` to `recovery` (with readback verification), and the staged rootfs to `linux`, then sends the DA reboot handshake (`--reboot` default, `--poweroff` to stay powered off, or `--no-reboot` to remain in DA mode). +Implemented across [flash-mtk.py](flash-mtk.py), [scripts/geminux_accounts.py](scripts/geminux_accounts.py), [scripts/geminux_luks.py](scripts/geminux_luks.py), and [scripts/geminux_gpt.py](scripts/geminux_gpt.py): -Additional flashing and offline image utilities: +1. **Pre-flash credential resolution**: Prompts/validates desktop `username`, desktop `password`, `root` `password`, and optional `--encrypt` LUKS2 passphrase before waiting for USB (`--username`, `--user-password`, `--ask-user-password`, `--root-password`, `--ask-root-password`, `--use-default-credentials`, `--encrypt`, `--luks-password`, `--ask-luks-password`). The LUKS2 passphrase is independent of login passwords. +2. **Safety backup**: Saves an initial backup in `backup//` (pass `--skip-backup --backup-dir backup/` on subsequent flashes to reuse one). +3. **Protected layout verification**: Verifies protected partitions before `0x0E000000` (pass `--force-gpt` only when intentionally converting a non-standard table). +4. **GPT write + readback**: Writes updated Primary (`LBA 0..33`) and Backup GPT with mandatory readback check. +5. **Staged provisioning & write**: Copies `geminux-rootfs.img` to a temporary file (leaving `images/` untouched), provisions `/etc/passwd`, `/etc/group`, `/etc/shadow`, and `/home/` via `debugfs`/`e2fsck`, optionally encrypts with LUKS2 (`aes-xts-plain64`, Argon2id), flashes `boot-geminux.img` (`boot` & `boot2`), `recovery-geminux.img` (`recovery`), and `linux` with readback verification, then sends the DA reboot handshake (`--reboot` default, `--poweroff`, or `--no-reboot`). + +### Partial flash and offline utilities ```sh # Update only boot, boot2, and recovery without touching GPT or linux: @@ -98,27 +101,28 @@ Additional flashing and offline image utilities: ## First boot and recovery notes -- Disconnecting/reflashing notes: eSIM profiles provisioned onto the hardware ST33 eUICC survive full eMMC rootfs reflashes (whereas flashing `linux` replaces `/` and `/home`). -- Disconnect the USB-C cable and hold the **Esc** (power) button until the unit boots. -- If the unit boots while still attached to USB power (for example immediately after `--flash-full`), `bq25890` briefly holds charging disabled (`F_CHG_CFG=0`, ~15 s while `VSYS` stays powered from USB) so `mt6351-fuel-gauge` can anchor to the true zero-current battery OCV instead of the ~4.336 V flashing voltage. -- If flashed with `--encrypt`, the initramfs loads the standalone binary Gemini US keyboard map (`/etc/gemini-us.kmap`) on `tty1` and prompts for the LUKS2 passphrase before mounting `PARTLABEL=linux` via `cryptsetup open --allow-discards` as `/dev/mapper/geminux_root` (off-mode battery charging still runs before the unlock prompt). Because LUKS2 data segment 0 uses dynamic whole-device length, unlocking immediately maps the full `linux` partition. -- On first boot, the initramfs runs non-interactive `e2fsck -p` and `resize2fs -f` (` `/dev/mapper/geminux_root`, mapping the full dynamic partition after any off-mode charging check). +- **First-boot resize**: Initramfs runs `e2fsck -p `mpv` IPC `/tmp/geminux-mpv.sock`), `XF86WLAN` (`geminux-net`), `XF86Tools` (`geminux-control`), `XF86Option` (`geminux-audio`), and `XF86Sleep` (suspend), with immediate `geminux-statusd` `SIGUSR1` bar refresh | +| `Print` / `Shift+Print` / `Ctrl+Print` | Capture full screen (`screenshot`) or active window (`screenshot-window`) | ## DWM window manager shortcuts -In [src/dwm/config.h](file:///home/lux/proj/geminux/src/dwm/config.h), `MODKEY` is `Mod4Mask` (`Fn+Alt`): +Defined in [src/dwm/config.def.h](src/dwm/config.def.h), where `MODKEY` is `Mod4` (`Fn + Alt`): | Shortcut | Action | | --- | --- | -| `Mod4 + Return` | Launch `st` terminal (with Fira Code HarfBuzz ligatures) | +| `Mod4 + Return` | Open `st` terminal (with Fira Code HarfBuzz ligatures) | | `Mod4 + Shift + Return` | Promote focused window to master (`zoom`) | -| `Mod4 + Space` / `Mod4 + p` | Launch `geminux-launcher` (`dmenu` with Nerd Font icons, pinned GUI apps, `Webarchy Browser`, `Bantam AI agent`, and `Lynx Web Browser` in `st`) | +| `Mod4 + Space` / `Mod4 + p` | Open `geminux-launcher` (`dmenu` with Nerd Font icons, pinned apps, `Wallpaper`, `Webarchy Browser`, `Bantam AI agent`, and `Lynx Web Browser` in `st`) | | `Mod4 + c` | Open `geminux-control` (backlight, volume, power profiles, LEDs, suspend) | +| `Mod4 + a` | Open `geminux-audio` | | `Mod4 + d` | Open `geminux-dialer` | | `Mod4 + s` | Open `geminux-sms` | | `Mod4 + n` | Open `geminux-net` | | `Mod4 + v` | Open `geminux-camera` | -| `Mod4 + t` | Open `geminux-themes` | +| `Mod4 + t` | Open `geminux-themes` (`Themes & Editor` / `Wallpaper`) | | `Mod4 + Shift + l` | Lock screen (`geminux-lock`) | -| `Mod4 + j` / `k` | Focus next / previous window | -| `Mod4 + h` / `l` | Adjust master split ratio (`Mod4 + F1..F4` for Tile, Monocle, Floating, Grid) | -| `Mod4 + 1..5` | Switch workspace tags (`Mod4 + Shift + 1..5` moves window to tag) | -| `Mod4 + Shift + c` | Close focused window | +| `Mod4 + Shift + r` | Reload `~/.Xresources` and active desktop theme live | +| `Mod4 + b` | Toggle top DWM bar | +| `Mod4 + Shift + Space` | Toggle floating mode on focused window | +| `Mod4 + j` / `k` (or `Down` / `Up`) | Focus next / previous window in stack | +| `Mod4 + h` / `l` | Adjust master split ratio (`Mod4 + i` / `o` adjusts master count) | +| `Mod4 + F1` .. `F4` | Switch layout: `Tile`, `Monocle`, `Floating`, `Grid` (`Mod4 + m` Monocle, `Mod4 + g` Grid) | +| `Mod4 + 1` .. `5` | Switch workspace tags (`Mod4 + Shift + 1..5` moves focused window to tag) | +| `Mod4 + Shift + c` / `Mod4 + Shift + q` | Close focused window (`Mod4 + Ctrl + Shift + q` quits DWM) | -Touchscreen input is supported directly across XLibre (`libinput`), DWM tag/layout/close buttons (`>= 68px` top bar), full-screen-height `dmenu` items (`68px` rows), `st`, and all 11 `libgemui` applications (scaled for `180 DPI` / `>= 1.85x`). +Touchscreen input works directly across XLibre (`libinput`), DWM tag/layout/close buttons (top bar height `>= 78 px`), full-height `dmenu` menus (`82 px` touch rows), `st`, and all 11 `libgemui` apps (configured at `192 DPI` / `2x` scaling, `Xcursor.size: 64`). ### Touchscreen multi-touch gestures -`geminux-touchd` intercepts raw XInput 2.2 touch sequences on the root window and provides universal X11 right-click, middle-click, and two-finger scroll without interfering with 1-finger tapping or dragging: +`geminux-touchd` intercepts raw XInput 2.2 touch events on the root window to provide right-click, middle-click, and two-finger scrolling without interfering with normal 1-finger taps or drags: | Gesture | X11 action | Notes | | --- | --- | --- | | 1-finger tap or drag | Left-click (`Button1`) / drag | Native passthrough for taps, text selection, sliders, and `Mod4 + drag` window move | -| 2-finger tap | Right-click (`Button3`) | Quick context menus without moving the cursor first | -| 1-finger stationary hold (`0.5 s`) | Right-click (`Button3`) | Alternative single-handed right-click | -| 3-finger tap | Middle-click (`Button2`) | Pastes X11 primary selection in `st` and opens tabs/links in apps | -| 2-finger drag | Scroll wheel (`Button4`–`Button7`) | Natural vertical and horizontal scroll across X11 apps and `st` scrollback (set `GEMINUX_NATURAL_SCROLL=0` for classic wheel direction) | +| 2-finger tap | Right-click (`Button3`) | Context menus without moving the cursor first | +| 1-finger stationary hold (`0.5 s`) | Right-click (`Button3`) | Single-handed right-click alternative | +| 3-finger tap | Middle-click (`Button2`) | Pastes X11 primary selection in `st` and opens links/tabs in browsers | +| 2-finger drag | Scroll wheel (`Button4`–`Button7`) | Natural vertical and horizontal scroll across X11 apps and `st` scrollback (`GEMINUX_NATURAL_SCROLL=0` restores classic scroll direction) | -## Unified theming via `.Xresources` +## Unified theming, Theme Editor, and `.xth` importer -Geminux includes 21 unified `.xth` color themes under `~/.xthemes/` (copied from `/etc/skel/.xthemes/`). Switch themes either interactively with `geminux-themes` or from the terminal: +Geminux ships **22** unified `.xth` color themes under `~/.xthemes/` (copied from `/etc/skel/.xthemes/`, with new system `.xth` files merged non-destructively at login by `geminux-session`). The default desktop theme is **Anodized** (obsidian `#08090b`, brushed silver `#cfd6e0`, brass-amber `#e2bc72` highlight). + +User-created, edited, and imported themes are stored in `~/.config/geminux/themes/` and take priority over built-in themes with the same name. + +### Interactive Theme Editor & Importer + +Open **Themes** via `Mod4 + t` or `geminux-launcher` (`Geminux Themes & Wallpaper` -> `Themes & Editor` tab): + +- **Browse & Apply**: Preview built-in and user themes live and apply across the desktop. +- **Create & Edit**: Use **Edit**, **Duplicate**, **New**, and **Reset** / **Delete** across four property tabs (**General & Fonts**, **UI Colors**, **WM & Menu**, **Terminal**) with RGB sliders, `#RRGGBB` hex inputs, clipboard paste, a live preview panel, and automatic WCAG contrast ratio checks against `bgMain`. +- **Import `.xth`**: Use **Import .xth** to browse `.xth` files, preview their palette, and install them into `~/.config/geminux/themes/` (auto-sync toggle applies changes immediately). + +### Theme CLI commands ```sh -geminux-apply-theme # list available themes -geminux-apply-theme TokyoNight +geminux-apply-theme # list available themes +geminux-apply-theme TokyoNight # switch active theme +geminux-apply-theme --install ~/MyTheme.xth [Name] # import & apply custom .xth +geminux-themes --install ~/MyTheme.xth [Name] # equivalent CLI via geminux-themes ``` -`geminux-apply-theme` updates `~/.Xresources`, translates the unified `theme.*` keys into `~/.config/dunst/dunstrc` via `geminux-sync-dunst-theme`, generates a matching `Geminux-` theme (selecting dark or light base styling from `theme.bgMain` luminance) under `~/.themes/` / `~/.local/share/themes/` via `geminux-sync-gtk-theme`, updates GTK2 (`~/.gtkrc-2.0`), GTK3 (`~/.config/gtk-3.0/{settings.ini,gtk.css}`), GTK4 & `libadwaita` (`~/.config/gtk-4.0/{settings.ini,gtk.css}` plus `dconf`-backed `gsettings` `color-scheme`), `xsettingsd` (`~/.config/xsettingsd/xsettingsd.conf`), Qt6 (`~/.config/qt6ct/{qt6ct.conf,colors/Geminux-.conf}`), and Kvantum (`~/.config/Kvantum/Geminux/Geminux.kvconfig`) with `ADW_DISABLE_PORTAL=1` binding `libadwaita` directly to `dconf`/`gsettings` and `QT_QPA_PLATFORMTHEME=qt6ct:gtk3` routing Qt6 to `qt6ct-style` (plus Kvantum configs for `QT_STYLE_OVERRIDE=kvantum` on Qt5/Qt6), scales GTK2 widget style properties and `gtkTtk` (`0.9`) fonts/geometry to `Xft.dpi` / `GDK_SCALE` (`*TkTheme: gtkTtk`), merges `~/.Xresources` into the X11 resource database via `xrdb -nocpp` (triggering `gtkTtk` live reloads in Tk/Ttk/Tkinter apps), restarts `dunst`, `SIGHUP`s `xsettingsd` for live GTK reloading, and sends `SIGUSR1` to live `dwm`, `st`, `webarchy`, and `libgemui` applications for instant in-place redraw. +### Synchronized toolkits + +Switching or applying a theme updates every layer consistently: + +| Layer / Toolkit | Update mechanism | +| --- | --- | +| **X11 resources & clients** | Copies `.xth` to `~/.Xresources` and replaces X11 resources cleanly via `xrdb -nocpp -load`; live `dwm`, `st`, `webarchy`, and `libgemui` clients redraw immediately via `XA_RESOURCE_MANAGER` / `SIGUSR1` | +| **Dunst OSD** | Translates `theme.*` keys into `~/.config/dunst/dunstrc` via `geminux-sync-dunst-theme` and restarts `dunst` | +| **GTK2 / GTK3 / `xsettingsd`** | `geminux-sync-gtk-theme` builds light- or dark-adapted `Geminux-` assets under `~/.themes/` / `~/.local/share/themes/`, updates `~/.gtkrc-2.0`, `~/.config/gtk-3.0/{settings.ini,gtk.css}`, and `~/.config/xsettingsd/xsettingsd.conf`, and sends `SIGHUP` to `xsettingsd` | +| **GTK4 & `libadwaita`** | Updates `~/.config/gtk-4.0/{settings.ini,gtk.css}` (`@define-color` and `:root` tokens) plus `dconf`-backed `gsettings` `color-scheme`, bound via `ADW_DISABLE_PORTAL=1` | +| **Qt5 & Qt6** | Writes `~/.config/qt6ct/{qt6ct.conf,colors/Geminux-.conf}` (21-role `QPalette`, `QT_QPA_PLATFORMTHEME=qt6ct:gtk3`) and Kvantum config (`~/.config/Kvantum/Geminux/Geminux.kvconfig` for `QT_STYLE_OVERRIDE=kvantum`) | +| **Tcl/Tk (`gtkTtk 0.9`)** | Sets `*TkTheme: gtkTtk` and DPI-scaled GTK2 metrics (`192 DPI` / `2x`); `gtkTtk` reloads automatically on `XA_RESOURCE_MANAGER` updates | +| **Wallpaper matte** | When `USE_THEME_BG=1` is enabled in `~/.config/geminux/wallpaper.conf`, `geminux-apply-theme` re-renders the active wallpaper against the new theme background | + +## Desktop wallpaper management + +Open the **Wallpaper** tab directly via `geminux-themes --wallpaper`, the **Wallpaper** entry in `geminux-launcher`, or press `Tab` inside `geminux-themes` to switch between **Themes & Editor** and **Wallpaper**. + +### GUI modes and controls + +- **Image Wallpaper**: Browse quickly via **Home**, **Pictures**, **SD Card** (`/media/sdcard`), or **Root /** (`All` toggle reveals non-image files), type or paste paths, preview layout with a simulated DWM top bar, choose among six scaling modes (**Fill**, **Fit**, **Center**, **Tile**, **Stretch**, **Span**), and set a matte color matching the active theme or a custom `#RRGGBB`. +- **Solid Color**: Pick **Match Active Theme Background**, dial custom RGB sliders, paste hex codes, or choose quick theme and dark swatches. + +### CLI & automatic restore + +Settings persist in `~/.config/geminux/wallpaper.conf` and automatically re-apply at session startup (`geminux-session`), on theme changes when `USE_THEME_BG=1` (`geminux-apply-theme`), and after external HDMI `xrandr` layout changes (`geminux-net`). + +```sh +geminux-apply-wallpaper --restore +geminux-apply-wallpaper ~/Pictures/photo.jpg --mode fill --bg theme +geminux-apply-wallpaper --solid '#101318' +geminux-apply-wallpaper --theme-bg +``` + +Pass `--no-save` to preview or set a wallpaper temporarily without modifying `~/.config/geminux/wallpaper.conf`. ## Applications and daemons -- **Webarchy Browser (`webarchy` / `xwebarchy`)**: Ultrawide `2160x1080` `GTK3` + `WebKit2GTK` browser featuring a collapsible right-side vertical tab bar (`Tabs ◫` or `Ctrl+B` / `Alt+T`), omnibar URL/DuckDuckGo search, persistent SQLite cookies and bookmarks (`~/.config/geminux/webarchy/` and `~/.local/share/geminux/webarchy/`), User-Agent presets, Dark Mode inverter (`Ctrl+Shift+D`), Reader Width Fit, Find in Page (`Ctrl+F`), single-instance URL forwarding via CLI, live `.Xresources` reloading (`SIGUSR1`), and automatic CPU renderer fallback on WebProcess crash (`--software` or `~/.config/geminux/webarchy/software_renderer`). Shortcuts: `Ctrl+T` new tab, `Ctrl+W` close tab, `Ctrl+Shift+T` reopen closed tab, `Ctrl+Tab` / `Alt+Up`/`Down` / `Alt+1..9` switch vertical tabs, `Ctrl+L` / `F6` focus URL bar, `Alt+Left` / `Alt+Right` back/forward, `Ctrl+D` bookmark, `Ctrl++` / `-` / `0` zoom, and `F11` fullscreen. -- **Telephony, eSIM & IMS**: `geminux-dialer`, `geminux-callscreen`, `geminux-sms`, and `geminux-contacts` backed by `geminux-modem-ctl`, `geminux-ccci-daemon`, `geminux-cellctl`, and `geminux-imsd` (using `alsaucm` UCM2 `VoiceCall` / `HiFi` switching and call suspend inhibitors). `geminux-imsd` supports 3GPP VoLTE (over `ccmni*`), VoWiFi (`SWu` via `strongswan`), and SMS-over-IMS with automatic CS fallback. Manage physical SIM vs. ST33 eUICC profiles and cellular data either from `geminux-net` or via `doas geminux-cellctl`: - - `doas geminux-cellctl status` / `sim-slot ` / `apn-set ` / `ims-set ` / `data-up [apn]` / `data-down` - - `doas geminux-cellctl esim-info` / `esim-list` / `esim-download 'LPA:1$smdp$matchingId' [confirm-code]` / `esim-enable <#idx|iccid>` / `esim-disable <#idx|iccid>` / `esim-delete <#idx|iccid>` / `esim-notif-process` -- **Audio & date/time**: `geminux-audio` manages PipeWire sink/source routing, mute state, and per-stream volume via `wpctl`/`pactl`. `geminux-datetime` manages the system timezone (`geminux-tzctl`) and shows live Chrony NTP sync status. -- **Connectivity & Airplane Mode**: `geminux-net` manages Wi-Fi (`nmcli`, keeping the currently associated WLAN connection pinned at the top with a `Disconnect` control), 4G/eSIM/CCCI state (`geminux-cellctl` + `mmcli` + `/run/geminux/ccci.sock`), Bluetooth (`bluetoothctl` / `rfkill`), SiI9024 external HDMI output (`xrandr`), and the **`DNS` tab** (`geminux-dnsctl`, supporting router-provided Default DNS, Cloudflare, Google, RadicalDNS, Quad9, custom IPv4/IPv6 nameservers, and live DNS lookup testing). Hardware Airplane Mode (`Fn + F`, `geminux-control`, `geminux-net`, or `doas geminux-power-ctl airplane on|off|toggle|status`) unloads the CONSYS Wi-Fi/BT kernel modules and puts MT6797 MD1 into `AT+CFUN=4` flight mode across reboots while keeping USB NCM (`usb0`) active. -- **Camera**: `geminux-camera` configures the MT6797 Media Controller pipeline (`ov5670`/`s5k4e6` -> `seninf` -> `camsv`), captures 10-bit Bayer (`SBGGR10`/`SGRBG10`) frames over V4L2 `mmap` with a pure-C demosaic + AWB software ISP, and writes native `libjpeg-turbo` stills to `~/Pictures/` and MJPEG-AVI clips to `~/Videos/`. -- **System control, LEDs & lock**: `geminux-control` adjusts display backlight, PipeWire audio volume, MT6797X power profile (`eco`, `balanced`, `performance`), and AW9120 LEDs (`/run/geminux/leds.sock`). `geminux-leds` drives the 5-LED RGB back strip (`rgb:indicator-1..5`, defaulting to off when idle or 100% charged) plus `rgb:indicator-6` (amber while charging), supports calibrated presets including `rgb 160 16 0` ("Amber Warn"), and preserves manual `off` / `rgb` overrides across battery uevents. `geminux-lock` secures the X session using `doas -n /usr/sbin/geminux-checkpw`, resolving the desktop account dynamically from UID `10000` (`--username` or default `user`). `geminux-powerd` implements an input-driven screensaver and lid policy: on USB/AC (`inhibit_ac_lid`), closing the lid or timing out locks X11 and blanks the backlight without unloading CONSYS or invoking `/sys/power/state`; on battery, it enters `mem` sleep when MD1 is gated or falls into a zero-thrash `low_power_standby` (never `freeze`/`s2idle`) when 4G `MD1` is active, waking cleanly on lid open, keyboard/touch/pointer activity, or the physical Esc/power side button (`mtk-pmic-keys`), timed strictly from the last active user input. -- **microSD card automount (`/media/sdcard`)**: Automatically checks (`fsck.fat -a`, `fsck.exfat -p`, `e2fsck -p`) and mounts `/dev/mmcblk1p1` (or unpartitioned superfloppy `/dev/mmcblk1`) at `/media/sdcard` on boot (`geminux-sdcard` OpenRC service) and `eudev` hotplug (`95-geminux-sdcard.rules` -> `/usr/sbin/geminux-sdcard-mount`), cleanly unmounting on card removal or shutdown. Normal desktop users (`UID 10000` in `plugdev` `GID 106`) receive full read/write access: `0660` `plugdev` nodes on `/dev/mmcblk1*`, `uid=10000,gid=106,fmask=0002,dmask=0002,allow_utime=0020` on `vfat`/`exfat` (plus `quiet` on `vfat`), and `10000:106` ownership + `02775` setgid `plugdev` (`u+rwX,g+rwX`, preserving `lost+found`) on writable `ext4`/`ext3`/`ext2` cards. Inspect or manage manually via `geminux-sdcard-mount status`, `geminux-sdcard-mount remove` (before physical eject), or `geminux-sdcard-mount add` (auto-escalating via `doas`), and format/label/repair FAT cards with `dosfstools` (`mkfs.vfat`, `fsck.vfat`, `fatlabel`, included in default shell `PATH`). -- **CLI developer, media & security tools**: Native Alpine Edge `mpv` (`/etc/mpv/mpv.conf` with Panfrost X11 EGL + PipeWire + `/tmp/geminux-mpv.sock` IPC), `ffmpeg`/`ffprobe`, `gst-libav`, `mpg123`, `openmpt123`, `yt-dlp` (`yt-dlp-ejs-rt-quickjs`), `python3` & `pip3` (`py3-pip`), `tcl` (`tclsh` + `tcl-lib` Tcllib + `tcl-tls` TclTLS) & `tk` (`wish` with `gtkTtk 0.9` dynamically following the active GTK2 theme), `gpg` (`gnupg` + `pinentry-curses` + `GPG_TTY`), `pass`, `dosfstools` (`mkfs.vfat`, `fsck.vfat`, `fatlabel`), `bantam` (`geminux-bantam`, minimalist C++20 OpenAI-compatible terminal AI agent defaulting to `kilo-auto/free`; see [src/bantam/README.md](file:///home/lux/proj/geminux/src/bantam/README.md)), `lynx` (configured via `~/.lynx.cfg` with `http://frogfind.com` start page, UTF-8, vi keys, mouse support, and persistent sessions/cookies), `gsocket` (`gs-netcat` plus `gs-key`/`gs-enter`/`gs-deploy-cmd`), `dtach` (`dmux`), `ovault`, default `htop` layout (`/etc/htoprc` / `~/.config/htop/htoprc`), `/etc/skel/.apexrc` defaults (`EDITOR='nano -FEDSMAGic/max%_T2'`, `PAGER='less -RXF'`, `nn`, `pg`, `l`, `defalias`/`toalias`/`savealias`, `rw`/`ee`, `sshed`, `dl`, `gcm`/`gp`/`gpm`, `sloc`, and `doas`-aware `pkgadd`/`pkgdel`/`pkgsearch`/`sysup`/`sysclean`), and `/etc/skel/.gitconfig` are preinstalled. +### Webarchy Browser (`webarchy` / `xwebarchy`) + +Ultrawide `2160x1080` `GTK3` + `WebKit2GTK` browser built for landscape PDA use: + +- **Interface**: Collapsible right-side vertical tab bar (`Tabs` button or `Ctrl+B` / `Alt+T`), unified omnibar (URL + DuckDuckGo search), persistent SQLite cookies and bookmarks (`~/.config/geminux/webarchy/`, `~/.local/share/geminux/webarchy/`), User-Agent presets, Dark Mode inverter (`Ctrl+Shift+D`), Reader Width Fit, Find in Page (`Ctrl+F`), and single-instance CLI URL forwarding. +- **Resilience & theming**: Live `.Xresources` reloading via `SIGUSR1` and automatic software rendering fallback on WebProcess crash (`--software` or `~/.config/geminux/webarchy/software_renderer`). +- **Shortcuts**: `Ctrl+T` new tab, `Ctrl+W` close tab, `Ctrl+Shift+T` reopen closed tab, `Ctrl+Tab` / `Alt+Up`/`Down` / `Alt+1..9` switch tabs, `Ctrl+L` / `F6` focus URL bar, `Alt+Left` / `Alt+Right` history back/forward, `Ctrl+D` bookmark, `Ctrl++` / `-` / `0` zoom, `F11` fullscreen. + +### Telephony, eSIM & IMS + +`geminux-dialer`, `geminux-callscreen`, `geminux-sms`, and `geminux-contacts` sit on top of `geminux-modem-ctl`, `geminux-ccci-daemon`, `geminux-cellctl`, and `geminux-imsd` (using ALSA UCM2 `VoiceCall`/`HiFi` switching and call suspend inhibitors). `geminux-imsd` supports 3GPP VoLTE over `ccmni*`, VoWiFi (`SWu` via `strongswan`), and SMS-over-IMS with automatic CS fallback. + +Manage SIM slots, cellular data, and ST33 eUICC profiles from `geminux-net` or CLI: + +```sh +doas geminux-cellctl status +doas geminux-cellctl sim-slot +doas geminux-cellctl apn-set +doas geminux-cellctl ims-set +doas geminux-cellctl data-up [apn] +doas geminux-cellctl data-down + +# ST33 eUICC (lpac) management +doas geminux-cellctl esim-info +doas geminux-cellctl esim-list +doas geminux-cellctl esim-download 'LPA:1$smdp$matchingId' [confirm-code] +doas geminux-cellctl esim-enable <#idx|iccid> +doas geminux-cellctl esim-disable <#idx|iccid> +doas geminux-cellctl esim-delete <#idx|iccid> +doas geminux-cellctl esim-notif-process +``` + +### Connectivity, DNS & Airplane Mode + +`geminux-net` unifies: + +- **Wi-Fi**: Managed via `nmcli` with the active WLAN pinned first alongside a **Disconnect** control. +- **Cellular & eSIM**: Live MD1/CCCI, ModemManager, and ST33 eSIM controls (`geminux-cellctl` + `/run/geminux/ccci.sock`). +- **Bluetooth & HDMI**: `bluetoothctl`/`rfkill` toggles and `SiI9024` external HDMI layout extend/mirror (`xrandr`, automatically restoring wallpaper geometry on change). +- **DNS tab**: Powered by `geminux-dnsctl` with Router Default, Cloudflare, Google, RadicalDNS, Quad9, custom IPv4/IPv6 nameservers, and live resolution checks. +- **Hardware Airplane Mode**: Toggled via `Fn + F`, `geminux-control`, `geminux-net`, or `doas geminux-power-ctl airplane on|off|toggle|status`. Persists across reboots by unloading CONSYS Wi-Fi/BT kernel modules and placing MD1 into `AT+CFUN=4` flight mode while keeping USB NCM (`usb0`) active. + +### Audio, Date/Time & Camera + +- **`geminux-audio`**: Manages PipeWire sink/source routing, mute state, and per-stream volumes via `wpctl`/`pactl`. +- **`geminux-datetime`**: Configures the system timezone (`geminux-tzctl`) and monitors Chrony NTP synchronization. +- **`geminux-camera`**: Drives the MT6797 Media Controller pipeline (`ov5670`/`s5k4e6` -> `seninf` -> `camsv`), captures 10-bit Bayer (`SBGGR10`/`SGRBG10`) frames over V4L2 `mmap` with a pure-C demosaic + AWB software ISP, and saves `libjpeg-turbo` stills to `~/Pictures/` and MJPEG-AVI videos to `~/Videos/`. + +### System Control, LEDs, Lock & Power + +- **`geminux-control`**: Adjusts display brightness, PipeWire volume, MT6797X power profile (`eco`, `balanced`, `performance`), hardware Airplane Mode, and back LED presets. +- **`geminux-leds`**: Controls the AW9120 RGB bar (`rgb:indicator-1..5` off by default when idle/full; `rgb:indicator-6` amber while charging) over `/run/geminux/leds.sock`, with presets (`rgb 160 16 0` "Amber Warn") and persistent manual overrides across battery uevents. +- **`geminux-lock`**: Locks X11 cleanly via `doas -n /usr/sbin/geminux-checkpw`, dynamically resolving the desktop user from UID `10000` (`--username` supported). +- **`geminux-powerd`**: Runs input-driven screensaver and lid policy (`epoll` zero-poll): + - On **USB/AC** (`inhibit_ac_lid`), closing the lid or idling locks X11 and blanks the backlight without unloading CONSYS or invoking `/sys/power/state`. + - On **battery**, closing the lid or reaching idle suspend enters `mem` sleep when MD1 is gated, or zero-thrash `low_power_standby` when MD1 is powered (never `freeze`/`s2idle`). + - Wakes only on `closed -> open` lid transitions, real input (`keyboard`/`touch`/`pointer`/`mtk-pmic-keys` Esc), or USB/AC attach; internal timer wakes during open-lid idle lock re-suspend quietly without reloading CONSYS or turning on the backlight. + +### microSD Card Automount (`/media/sdcard`) + +`geminux-sdcard` (OpenRC) and `eudev` (`95-geminux-sdcard.rules` -> `/usr/sbin/geminux-sdcard-mount`) automatically check (`fsck.fat -a`, `fsck.exfat -p`, `e2fsck -p`) and mount `/dev/mmcblk1p1` or unpartitioned `/dev/mmcblk1` at `/media/sdcard`, unmounting cleanly on removal or shutdown. Desktop users (`UID 10000`, `plugdev` `GID 106`) get full read/write permissions across `vfat`, `exfat`, and `ext4`/`ext3`/`ext2`. + +```sh +geminux-sdcard-mount status # inspect mount and card filesystem state +geminux-sdcard-mount remove # flush and unmount before physical eject +geminux-sdcard-mount add # manually mount (auto-escalates via doas) +``` + +`dosfstools` (`mkfs.vfat`, `fsck.vfat`, `fatlabel`) is included in default `PATH` for FAT card maintenance. + +### CLI Developer, Media & Security Tools + +- **Media**: Native Alpine Edge `mpv` (`/etc/mpv/mpv.conf`: Panfrost X11 EGL, PipeWire, `/tmp/geminux-mpv.sock` media-key IPC), `ffmpeg`/`ffprobe`, `gst-libav`, `mpg123`, `openmpt123`, and `yt-dlp` (`yt-dlp-ejs-rt-quickjs`). +- **Languages & Toolkits**: `python3` & `pip3` (`py3-pip`), `tcl` (`tclsh`, `tcl-lib`, `tcl-tls`), and `tk` (`wish` themed live via `gtkTtk 0.9`). +- **AI, Web & Remote**: `bantam` (`geminux-bantam` C++20 CLI AI agent defaulting to `kilo-auto/free`; see [src/bantam/README.md](src/bantam/README.md)), `lynx` (`~/.lynx.cfg` with `http://frogfind.com` start page, UTF-8, vi keys, mouse, persistent cookies), `gsocket` (`gs-netcat`, `gs-key`, `gs-enter`, `gs-deploy-cmd`), `dtach` (`dmux`), and `ovault`. +- **Security & Shell UX**: `gpg` (`gnupg` + `pinentry-curses` + `GPG_TTY`), `pass`, default `htop` layout (`/etc/htoprc`), `/etc/skel/.gitconfig`, and `/etc/skel/.apexrc` helpers (`EDITOR='nano -FEDSMAGic/max%_T2'`, `PAGER='less -RXF'`, `nn`, `pg`, `l`, `defalias`/`toalias`/`savealias`, `rw`/`ee`, `sshed`, `dl`, `gcm`/`gp`/`gpm`, `sloc`, and `doas`-aware `pkgadd`/`pkgdel`/`pkgsearch`/`sysup`/`sysclean`). ## Maintaining Alpine Edge packages safely -Target `/etc/apk/repositories` tracks pure Alpine Edge (`main`, `community`, `testing`) alongside the local signed `@geminux` repository (`/var/lib/geminux/apk-repo`): +`/etc/apk/repositories` points directly to Alpine Edge (`main`, `community`, `testing`) alongside the local signed `@geminux` repository (`/var/lib/geminux/apk-repo`): ```sh doas apk update doas apk upgrade ``` -Because custom Geminux components (`geminux-kernel-modules`, `geminux-xlibre`, `geminux-suckless`, `geminux-dunst`, `geminux-ui`, `geminux-bantam`, `geminux-gsocket`, `geminux-gdk-pixbuf`, `geminux-webarchy`, `geminux-gtkttk`, `geminux-config`) are exact-version pinned (`name@geminux=version`) in `/etc/apk/world` and Rust/Wayland/upstream overrides (`!rust`, `!cargo`, `!libglycin`, `!gdk-pixbuf`, `!deno`, `!py3-cryptography`, `!xorg-server`, `!linux-edge`, etc., with `librsvg`, `rav1e`/`rav1e-libs`, and `libdovi` whitelisted) are negated in `/etc/apk/world`, normal Alpine Edge upgrades update upstream libraries, CLI tools, NetworkManager, ModemManager, PipeWire, and Mesa without overwriting custom patched binaries or pulling disallowed Rust packages. On the build host, running `./rebuild-image.sh --force-bootstrap` upgrades all preinstalled Alpine Edge packages in `rootfs/` to the current Alpine Edge state when generating fresh images. +All custom components (`geminux-kernel-modules`, `geminux-xlibre`, `geminux-suckless`, `geminux-dunst`, `geminux-ui`, `geminux-bantam`, `geminux-gsocket`, `geminux-gdk-pixbuf`, `geminux-webarchy`, `geminux-gtkttk`, `geminux-config`) are exact-version pinned (`name@geminux=version`) in `/etc/apk/world`. Disallowed Rust, Wayland, and upstream override packages (`!rust`, `!cargo`, `!libglycin`, `!gdk-pixbuf`, `!deno`, `!py3-cryptography`, `!xorg-server`, `!linux-edge`, etc., with `librsvg`, `rav1e`/`rav1e-libs`, and `libdovi` whitelisted) are negated in `/etc/apk/world`. + +Standard `apk upgrade` safely updates upstream libraries, utilities, NetworkManager, ModemManager, PipeWire, and Mesa without overwriting patched binaries. On a Linux build host, run `./rebuild-image.sh --force-bootstrap` to refresh `rootfs/` packages when generating new images. diff --git a/POWER-OPTIMIZATION.md b/POWER-OPTIMIZATION.md index e4d364e..daf9ba4 100644 --- a/POWER-OPTIMIZATION.md +++ b/POWER-OPTIMIZATION.md @@ -1,34 +1,54 @@ # Power optimization -Battery endurance and deep idle efficiency are first-class design requirements across the kernel, daemons, radios, display, audio, and storage stack in Geminux. +Battery endurance and reliable deep-sleep recovery are designed across the kernel, system daemons, radios, display, audio, and storage stack in Geminux. ## Kernel-level optimizations -Configured in [kernel/configs/geminux-mt6797x.config](file:///home/lux/proj/geminux/kernel/configs/geminux-mt6797x.config) and built into `7.3.5-geminux`: +Configured in [kernel/configs/geminux-mt6797x.config](kernel/configs/geminux-mt6797x.config) and built into `7.3.5-geminux`: -- **`CONFIG_HZ_100=y`**: 100 Hz tick rate cuts periodic timer interrupt overhead compared to 250 Hz / 1000 Hz kernels while remaining responsive for interactive X11 workloads. -- **`CONFIG_RCU_LAZY=y`**: Batches RCU callbacks during idle periods to extend CPU C-state residency. -- **`CONFIG_SUSPEND=y`**: Enables deep Suspend-to-RAM (`mem` / `deep`) via `mt6797-spm-sleep` (`sodi_idle=0 pmic_modes=0 timer_sec=600` in [etc/modprobe.d/geminux.conf](file:///home/lux/proj/geminux/overlay/rootfs/etc/modprobe.d/geminux.conf)) triggered on Gemini PDA lid close (`SW_LID`), battery idle timeout, or power button press. Keeping `pmic_modes=0` avoids asserting `MT6351` `VCORE` sleep voltage (`0.600 V`) while CPU0 remains powered in `WFI`, `spm_enter()` bounds silent PCM timer rollovers cleanly without `.suspend_again`, `mtk-eint` clears hardware debounce when switching wakeup pins such as `SW_LID` (`EINT5`) to edge-sensitive mode, `mtk-pmic-keys` reports `pm_wakeup_event()` on wakeup keypresses, `0011-gemini-lid-sync-filter-and-debounce.patch` tunes Hall EINT debounce to `1 ms` (keypad `10 ms`) while synchronously filtering spurious keystrokes/touches and inhibiting both matrix keypad and touchscreen whenever the lid magnet closes, and `0012-gemini-lid-wake-and-fg-taper-fix.patch` reconciles `gemini-lid` state on `PM_POST_SUSPEND` and raw-GPIO rechecks to prevent stuck `BL_CORE_SUSPENDED` / input lockouts alongside `mt6351-fuel-gauge` + `bq25890` boot zero-current OCV calibration (`POWER_SUPPLY_PROP_CALIBRATE` / `MT6351_RGS_CHRDET`), CV-taper (`win_ua`+`reg_ua`, `+1%` cap), and start-up `ADC21` sag tolerance hardening. -- **`CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y`**: Uses scheduler utilization feedback (`schedutil`) across the MT6797X tri-cluster topology instead of static `performance` governors. [etc/init.d/geminux-hwinit](file:///home/lux/proj/geminux/overlay/rootfs/etc/init.d/geminux-hwinit) loads `clk-mt6797-mcusys` and `cpufreq-dt` by default (`GEMINUX_ENABLE_CPUFREQ="yes"` in [etc/conf.d/geminux-hwinit](file:///home/lux/proj/geminux/overlay/rootfs/etc/conf.d/geminux-hwinit)) independently of experimental Cortex-A72 bring-up (`GEMINUX_ENABLE_A72="no"`), enabling `policy0` (`221..897 MHz`) and `policy4` (`325..1209 MHz`) frequency scaling and `soc-thermal` cooling throttling. -- **`mt6797-gate-unused`**: Loaded at the end of `geminux-hwinit` (`GEMINUX_GATE_UNUSED_CLOCKS="yes"`) to gate ~25 unused bootloader peripheral leaf clocks (unused `SPI`, `UART`, `PWM`, `IRTX`, `ICUSB`, `ANC_MD32`, etc.) left enabled due to `clk_ignore_unused` while leaving active display/I2C clocks untouched. -- **Sensor IR LED gating**: `stk3310` is blacklisted in [etc/modprobe.d/geminux.conf](file:///home/lux/proj/geminux/overlay/rootfs/etc/modprobe.d/geminux.conf) (`GEMINUX_ENABLE_SENSORS="no"`) because its probe unconditionally enables continuous ALS and proximity IR LED polling with no userspace consumer. -- **`CONFIG_ZRAM_DEF_COMP_LZ4=y`** with `2 GiB` LZ4 `zram` swap (`etc/conf.d/zram-init`) and `vm.swappiness=100` (`etc/sysctl.d/99-geminux-power.conf`): avoids slow, power-hungry flash swap I/O on eMMC and pairs with `commit=60,noatime` mount options (`etc/fstab`). -- **`CONFIG_CRYPTO_AES_ARM64_CE_BLK=y`** paired with `--allow-discards` in initramfs: runs optional LUKS2 `dm-crypt` (`aes-xts-plain64`) encryption using ARMv8 hardware AES Cryptography Extensions with negligible battery overhead. +- **`CONFIG_HZ_100=y`**: 100 Hz tick rate cuts periodic timer interrupt overhead compared to 250/1000 Hz kernels while keeping interactive X11 responsiveness high. +- **`CONFIG_RCU_LAZY=y`**: Batches idle RCU callbacks to extend CPU C-state residency. +- **`CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y`**: Drives scheduler-guided frequency scaling (`schedutil`) across the MT6797X tri-cluster CPU. [geminux-hwinit](overlay/rootfs/etc/init.d/geminux-hwinit) loads `clk-mt6797-mcusys` and `cpufreq-dt` (`GEMINUX_ENABLE_CPUFREQ="yes"` in [conf.d/geminux-hwinit](overlay/rootfs/etc/conf.d/geminux-hwinit)) independently of experimental Cortex-A72 enablement (`GEMINUX_ENABLE_A72="no"`), providing `policy0` (`221..897 MHz`) and `policy4` (`325..1209 MHz`) scaling and `soc-thermal` throttling. +- **`mt6797-gate-unused`**: Loaded at the end of `geminux-hwinit` (`GEMINUX_GATE_UNUSED_CLOCKS="yes"`) to gate ~25 unused bootloader peripheral leaf clocks (`SPI`, `UART`, `PWM`, `IRTX`, `ICUSB`, `ANC_MD32`, etc.) left enabled due to `clk_ignore_unused` while leaving active display/I2C clocks untouched. +- **Sensor IR LED gating**: `stk3310` is blacklisted in [modprobe.d/geminux.conf](overlay/rootfs/etc/modprobe.d/geminux.conf) (`GEMINUX_ENABLE_SENSORS="no"`) so its ALS/proximity IR LED does not continuously poll without a consumer. +- **`CONFIG_ZRAM_DEF_COMP_LZ4=y`**: Pairs `2 GiB` LZ4 `zram` swap (`etc/conf.d/zram-init`) with `vm.swappiness=100` (`etc/sysctl.d/99-geminux-power.conf`) and `commit=60,noatime` mounts (`etc/fstab`) to minimize power-hungry eMMC flash swap writes. +- **`CONFIG_CRYPTO_AES_ARM64_CE_BLK=y`**: Accelerates optional LUKS2 `dm-crypt` (`aes-xts-plain64`) with ARMv8 Cryptography Extensions (`--allow-discards` enabled in initramfs) for negligible encryption overhead. + +## Deep sleep (`mem`) and wakeup reliability + +`CONFIG_SUSPEND=y` enables Suspend-to-RAM (`mem` / `deep`) via `mt6797-spm-sleep` (`sodi_idle=0 pmic_modes=0 timer_sec=600` in [modprobe.d/geminux.conf](overlay/rootfs/etc/modprobe.d/geminux.conf)): + +- **`pmic_modes=0` & clean SPM timers**: Keeps `MT6351` from dropping `VCORE` to `0.600 V` sleep voltage while CPU0 remains in `WFI`. +- **Wake IRQ & resume hardening (`0008`)**: Bounds `spm_enter()` PCM timer rollovers cleanly without `.suspend_again`, clears `mtk-eint` hardware debounce when arming edge wakeup pins (`SW_LID` / `EINT5`), and calls `pm_wakeup_event()` from `mtk-pmic-keys`. +- **Hall lid filtering & debounce (`0011`)**: Tunes Hall EINT debounce to `1 ms` and matrix keypad debounce to `10 ms`, synchronously filtering spurious keystrokes/touches and inhibiting both keypad and touchscreen whenever the lid magnet closes. +- **Post-suspend lid reconciliation & fuel-gauge accuracy (`0012`)**: Reconciles `gemini-lid` state on `PM_POST_SUSPEND` and raw-GPIO rechecks to avoid stuck `BL_CORE_SUSPENDED`/input lockouts, and pairs `mt6351-fuel-gauge` + `bq25890` zero-current boot OCV calibration (`POWER_SUPPLY_PROP_CALIBRATE` / `MT6351_RGS_CHRDET`) with `win_ua`+`reg_ua` CV-taper validation, `+1%` step caps, and `180 mV` start-up `ADC21` sag tolerance. +- **PMIC wake IRQ timing & SPM safety backstops (`0013`)**: Moves MT6397/MT6351 PMIC wake IRQ masking (`mt6397_irq_suspend`/`mt6397_irq_resume`) from `PM_SUSPEND_PREPARE` into `LATE_SYSTEM_SLEEP_PM_OPS` so all child drivers' `enable_irq_wake()` settings are already armed before deep sleep, and hardens `mt6797-spm-sleep` `s.sleep` with `WAKE_PCM_WDT`, `pcm_wdt`, `im_wait` (`1000 us`), and a `5000 ms` `cntp` physical timer backstop (`100 ms` on `s.sodi`) so CPU0 cannot wedge indefinitely on an overnight suspend. ## Zero-poll userspace daemons -All background system services avoid wake-up timers and polling loops: +All background daemons sleep in event loops with no periodic polling timers: -- **`geminux-powerd`**: Sleeps indefinitely in `epoll_wait()` over `/dev/input/event*` (`SW_LID`, `KEY_POWER`, `mtk-pmic-keys` `KEY_ESC` blank-screen wakeup, keyboard/touch/pointer activity), `KOBJECT_UEVENT` netlink (filtered strictly to `input` with lid-state reconciliation, `power_supply`, and `drm`), `/run/geminux/powerd.sock`, and a lazy-rearming `timerfd`; caches applied CPUfreq/profile state to avoid redundant sysfs and `/run/geminux/power-profile` rewrites; implements two-stage screensaver dimming and auto-lock/blank or suspend strictly timed from the last active user input (`dim_timeout_s` / `suspend_timeout_s`). On USB/AC (`inhibit_ac_lid`), closing the lid or timing out locks X11 and blanks the backlight cleanly without unloading CONSYS or invoking `/sys/power/state`, letting `bq25890`'s `40 s` charger watchdog stay fed without `-EBUSY` suspend thrashing. On battery, before entering `mem` `/sys/power/state`, it unloads `mt6797_consys` (and reverse dependents `btmt6797`, `radio_mt6797`, `gnss_mt6797`, `mac`) so `CONN`/`VCN*` rails power down and parks `cpu1..9` offline; when 4G `MD1` is powered and blocks SPM `mem` sleep, it drops `freeze` (`s2idle`) entirely in favor of zero-thrash `low_power_standby` (`cpu1..9` offline, `cpu0` pinned to `221 MHz` `powersave`, CONSYS unloaded, zero periodic wake timers) until lid open, input wake, or AC/HDMI attach. In hardware Airplane Mode (`Fn+F` / `geminux-power-ctl airplane on`, persisted under `/var/lib/geminux/airplane-mode`), `geminux-powerd` keeps the CONSYS Wi-Fi/BT kernel modules unloaded and places MD1 in `AT+CFUN=4` flight mode while leaving `usb0` active. -- **`geminux-statusd`**: Uses `signalfd` (`SIGUSR1`), `RTMGRP_LINK` netlink, filtered `KOBJECT_UEVENT` (`power_supply` and `net` only), `inotify`, and a minute-aligned `timerfd`; deduplicates root `WM_NAME` updates (`XStoreName`) so `dwm` never repaints when the bar text is unchanged, with zero child shell forks. -- **Display & terminal idle efficiency**: [10-geminux-gpu.conf](file:///home/lux/proj/geminux/overlay/rootfs/etc/X11/xorg.conf.d/10-geminux-gpu.conf) uses `AccelMethod "none"` + `ShadowFB "true"` + `TearFree "true"` for rotated `SSD2092` scanout, avoiding Glamor fence spin-waits, and `st` disables its cursor-blink timeout when unfocused so idle XLibre CPU usage remains near `0%`. -- **`geminux-touchd`**: Event-driven XInput 2.2 multi-touch gesture recognizer with zero polling loops. -- **`geminux-ccci-daemon`, `geminux-modem-ctl` & `geminux-imsd`**: Event-driven `epoll_wait()` over `/dev/ccci_*`, filtered `ccci` uevents, AT port, `/run/geminux/imsd.sock`, SIP/ESP sockets, and netlink; enter completely idle sleep when no modem activity is pending, and `geminux-imsd` arms its 20 ms RTP `timerfd` strictly during active calls. -- **`geminux-bt-obex`, `geminux-leds` & `geminux-lock`**: Event-driven GLib/GDBus and `epoll_wait()` + `KOBJECT_UEVENT` control without periodic polling. `geminux-leds` keeps the back AW9120 cover strip (`rgb:indicator-1..5`) off (`0 mA`) when idle or at 100% charge, lighting only `rgb:indicator-6` during active battery charging unless manually overridden. `geminux-lock` uses a `15 s` refresh interval once input is grabbed and redraws only when clock minute/date or battery status changes. +### `geminux-powerd` + +Uses `epoll_wait()` over `/dev/input/event*` (`SW_LID`, `KEY_POWER`, `mtk-pmic-keys` `KEY_ESC`), filtered `KOBJECT_UEVENT` netlink (`input`, `power_supply`, `drm`), `/run/geminux/powerd.sock`, and a lazy-rearming `timerfd`: + +- **USB/AC policy (`inhibit_ac_lid`)**: Closing the lid or timing out locks X11 and blanks the backlight without unloading CONSYS or invoking `/sys/power/state`, keeping `bq25890`'s `40 s` charger watchdog fed without `-EBUSY` suspend thrash. +- **Battery `mem` vs. `low_power_standby`**: Before `mem` sleep, unloads `mt6797_consys` (and reverse dependents `btmt6797`, `radio_mt6797`, `gnss_mt6797`, `mac`) so `CONN`/`VCN*` rails power down and offlines `cpu1..9`. When 4G `MD1` is powered and blocks SPM `mem` sleep, uses zero-thrash `low_power_standby` (`cpu1..9` offline, `cpu0` pinned to `221 MHz` `powersave`, CONSYS unloaded, never `freeze`/`s2idle`). +- **Wakeup filtering & quiet open-lid re-suspend**: Polls post-resume input/lid events (`90 ms`) even when the lid is open; only a `closed -> open` lid transition, real `EV_KEY`/`EV_REL`/`EV_ABS` activity, or USB/AC attach triggers a desktop wake. Internal timer wakes in open-lid `IDLE_STAGE_LOCKED_BLANK` on battery re-suspend quietly (`quiet_timer_resleep`) without reloading CONSYS or enabling the backlight. +- **Persisted hardware Airplane Mode**: `Fn+F` / `geminux-power-ctl airplane on` persists `/var/lib/geminux/airplane-mode`, keeps CONSYS Wi-Fi/BT modules unloaded, and puts MD1 into `AT+CFUN=4` while leaving `usb0` active. +- **Zero-thrash sysfs caching**: Caches applied CPUfreq/profile state to skip redundant sysfs writes, and measures idle timers strictly from the last user input (`CLOCK_MONOTONIC`). + +### Supporting daemons & X11 efficiency + +- **`geminux-statusd`**: `epoll` over `signalfd` (`SIGUSR1`), `RTMGRP_LINK`/`RTMGRP_IPV4_IFADDR`, `KOBJECT_UEVENT` (`power_supply`, `net`), `inotify`, and minute-aligned `timerfd`; deduplicates root `WM_NAME` updates (`XStoreName`) with zero child shell forks. +- **Display & terminal**: [10-geminux-gpu.conf](overlay/rootfs/etc/X11/xorg.conf.d/10-geminux-gpu.conf) uses `AccelMethod "none"` + `ShadowFB "true"` + `TearFree "true"` to eliminate Glamor fence spin-waits, and `st` disables its cursor-blink timer while unfocused. +- **`geminux-touchd`**: Event-driven XInput 2.2 gesture engine with zero polling. +- **Modem & IMS**: `geminux-ccci-daemon`, `geminux-modem-ctl`, and `geminux-imsd` sleep in `epoll_wait()`, arming `geminux-imsd`'s 20 ms RTP `timerfd` only during active voice calls. +- **`geminux-bt-obex`, `geminux-leds` & `geminux-lock`**: Pure event-driven GLib/GDBus and `epoll` + uevent operation; `geminux-leds` keeps `rgb:indicator-1..5` off (`0 mA`) when idle or at 100%, lighting only `rgb:indicator-6` while actively charging; `geminux-lock` uses a `15 s` refresh once grabbed and redraws only on clock or battery change. ## Cluster gating and profiles -`geminux-power-ctl` (and `geminux-control`) switches between three profiles managed in [src/geminux-daemons/geminux-power-policy.c](file:///home/lux/proj/geminux/src/geminux-daemons/geminux-power-policy.c): +`geminux-power-ctl` and `geminux-control` switch between three profiles defined in [src/geminux-daemons/geminux-power-policy.c](src/geminux-daemons/geminux-power-policy.c): | Profile | Governor | A72 big cores (`cpu8..9`) | A53 LL (`policy0`) / L (`policy4`) max freq | Battery idle (dim -> lock+suspend) | AC idle (lock+blank screensaver) | | --- | --- | --- | --- | --- | --- | @@ -36,25 +56,23 @@ All background system services avoid wake-up timers and polling loops: | `balanced` | `schedutil` | Online (`1`, `2002 MHz`) | `897 MHz` / `1209 MHz` (bat), `1547 MHz` / `1846 MHz` (AC) | `120 s` -> `300 s` | `300 s` | | `performance` | `performance` | Online (`1`, `2600 MHz`) | `1547 MHz` / `1846 MHz` (clamped to DT `cpuinfo_max_freq`) | `180 s` (lock+blank, no suspend) | `600 s` | -All idle thresholds above are measured from the last active keyboard, touchscreen, pointer, or lid-open event (`CLOCK_MONOTONIC`) and are not reset by periodic battery `power_supply` uevents. - -Closing the Gemini PDA clamshell (`SW_LID = 1`) on battery enters RAM suspend (`mem` when `MD1` is gated, or zero-thrash `low_power_standby` when `MD1` is active), unless inhibited by USB/AC power (`inhibit_ac_lid`, which locks + blanks without suspend), an active voice call (`inhibit add call`), an explicit inhibitor, or a connected external HDMI monitor (`SiI9024`). +All idle thresholds run on `CLOCK_MONOTONIC` from the last active keyboard, touchscreen, pointer, or lid-open event and are never reset by periodic `power_supply` uevents. Closing the clamshell (`SW_LID = 1`) on battery enters RAM sleep (`mem` or zero-thrash `low_power_standby`) unless inhibited by USB/AC (`inhibit_ac_lid`), an active call (`inhibit add call`), an explicit inhibitor, or connected HDMI (`SiI9024`). ## Audio, radios, and storage defaults -- **Audio**: PipeWire uses `default.clock.min-quantum = 1024` and `quantum = 2048` (`10-geminux-power.conf`); WirePlumber suspends idle ALSA and BlueZ nodes after `3` seconds (`50-geminux-suspend.conf`) so audio DSP clocks gate quickly. -- **Bluetooth**: BlueZ disables automatic adapter enable and fast page scan (`AutoEnable = false`, `FastConnectable = false` in [etc/bluetooth/main.conf](file:///home/lux/proj/geminux/overlay/rootfs/etc/bluetooth/main.conf)), and `geminux-hwinit` runs `rfkill block bluetooth` after loading `btmt6797`; users toggle Bluetooth on demand via `geminux-net`. -- **Wi-Fi & NTP**: NetworkManager configures `wifi.powersave = 2` (`10-geminux-power.conf`) to keep CONSYS Wi-Fi awake while associated so GTK rekeys, ARP, and DNS never stall; `geminux-powerd` powers down CONSYS cleanly across system suspend. [etc/chrony/sources.d/10-geminux.sources](file:///home/lux/proj/geminux/overlay/rootfs/etc/chrony/sources.d/10-geminux.sources) caps NTP pool peers (`maxsources 2`) and lengthens polling (`minpoll 10 maxpoll 14`), paired with an offline hook on `down|vpn-down` in [30-geminux-chrony](file:///home/lux/proj/geminux/overlay/rootfs/etc/NetworkManager/dispatcher.d/30-geminux-chrony). -- **GTK / Qt / Tk / XSETTINGS / D-Bus**: [etc/profile.d/10-geminux-env.sh](file:///home/lux/proj/geminux/overlay/rootfs/etc/profile.d/10-geminux-env.sh) exports `NO_AT_BRIDGE=1` so GTK/Qt/`webarchy` never auto-activate AT-SPI accessibility bridge daemons and sets `QT_QPA_PLATFORMTHEME=qt6ct:gtk3` for zero-daemon-overhead Qt5/Qt6 theme routing; `geminux-session` runs `xsettingsd` as an event-driven X11 `XSETTINGS` daemon (`SIGHUP` on theme switch) with zero polling timers, `gtkTtk` reacts purely to X11 `RESOURCE_MANAGER` `PropertyNotify` events without polling, and `dconf-service` activates over session D-Bus only when `gsettings` writes `color-scheme`. -- **Storage**: `noatime,commit=60` in `etc/fstab` alongside `vm.dirty_writeback_centisecs=1500` reduces eMMC write amplification and wakes; microSD mounts at `/media/sdcard` likewise mount with `noatime` and rely purely on `eudev` hotplug events (`95-geminux-sdcard.rules`) with zero background polling when idle or empty. +- **Audio**: PipeWire uses `default.clock.min-quantum = 1024` and `quantum = 2048` (`10-geminux-power.conf`); WirePlumber suspends idle ALSA/BlueZ nodes after `3 s` (`50-geminux-suspend.conf`) so audio DSP clocks gate quickly. +- **Bluetooth**: BlueZ sets `AutoEnable = false` and `FastConnectable = false` in [etc/bluetooth/main.conf](overlay/rootfs/etc/bluetooth/main.conf), and `geminux-hwinit` soft-blocks Bluetooth at boot until enabled in `geminux-net`. +- **Wi-Fi & NTP**: NetworkManager keeps `wifi.powersave = 2` (`10-geminux-power.conf`) so associated WLAN never drops GTK rekeys or DNS; `geminux-powerd` powers down CONSYS across suspend. [10-geminux.sources](overlay/rootfs/etc/chrony/sources.d/10-geminux.sources) limits Chrony pools (`maxsources 2`, `minpoll 10 maxpoll 14`) with an offline hook in [30-geminux-chrony](overlay/rootfs/etc/NetworkManager/dispatcher.d/30-geminux-chrony). +- **GTK / Qt / Tk / XSETTINGS**: [10-geminux-env.sh](overlay/rootfs/etc/profile.d/10-geminux-env.sh) exports `NO_AT_BRIDGE=1` (disabling unused AT-SPI bridges) and `QT_QPA_PLATFORMTHEME=qt6ct:gtk3`; `xsettingsd` (`SIGHUP` reload), `gtkTtk` (`XA_RESOURCE_MANAGER` `PropertyNotify`), and portal-free `dconf` (`ADW_DISABLE_PORTAL=1`) operate without polling loops. +- **Storage**: `noatime,commit=60` in `etc/fstab` and `vm.dirty_writeback_centisecs=1500` cut eMMC wakeups; microSD mounts at `/media/sdcard` use `noatime` and pure `eudev` hotplug events (`95-geminux-sdcard.rules`) with zero idle polling. ## Auditing on device -Run the bundled C11 audit utility at any time: +Inspect live power policy and hardware state on the Gemini PDA at any time: ```sh geminux-power-audit geminux-power-audit --json ``` -It prints the live power profile, battery capacity/voltage/current, online CPU count (including A72 cluster gating status), CPUfreq governor, `policy0`/`policy4` max frequency caps, Bluetooth `rfkill` soft-block status, ZRAM compression algorithm, and supported `/sys/power/mem_sleep` modes. Live idle current draw and multi-hour standby battery endurance benchmarks must be measured on physical Gemini PDA (x27) hardware after flashing. +Outputs active profile, battery capacity/voltage/current, online CPUs (including A72 cluster state), CPUfreq governor, `policy0`/`policy4` max frequencies, Bluetooth `rfkill` state, ZRAM algorithm, and `/sys/power/mem_sleep` modes. Measure actual multi-hour standby battery endurance and idle current draw directly on physical x27 hardware after flashing. diff --git a/README.md b/README.md index 56910ea..25453f3 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,62 @@ # Geminux -Geminux is an Alpine Linux (`aarch64`, musl, OpenRC) distribution built specifically for the Planet Computers Gemini PDA (Wi-Fi + 4G, MediaTek MT6797X / Helio X27). It runs a patched Linux `7.3.5-geminux` kernel, XLibre Xorg with tear-free rotated `ShadowFB` scanout and Panfrost EGL/OpenGL 3D acceleration, a custom Pango/HarfBuzz-enabled DWM/st/dmenu desktop with Fira Code ligatures and Noto fonts, zero-poll C11 system daemons, 11 landscape HiDPI applications (`libgemui.so`), MT6797 MD1 cellular bring-up with ST33 eUICC eSIM provisioning (`lpac` + `geminux-cellctl`), 3GPP VoLTE / VoWiFi / SMS-over-IMS (`geminux-imsd`), hardware Airplane Mode (`Fn+F`), the ported Webarchy ultrawide `GTK3`/`WebKit2GTK` browser (`geminux-webarchy`, right-side vertical tab bar), native Alpine Edge `mpv` + `ffmpeg` + `gst-libav`, `mpg123`, `openmpt123`, `yt-dlp`, `python3`/`pip`, `tcl` (`tcl-lib` + `tcl-tls`) & `tk` (`gtkTtk` dynamic GTK2 theme engine), `gpg` (`gnupg`), `pass`, `dosfstools`, boot/hotplug `/media/sdcard` microSD automount (`geminux-sdcard` / `eudev`), the preinstalled `bantam` CLI AI agent (`geminux-bantam`, `kilo-auto/free` default), `lynx`, `gsocket`, and a pure-Linux MediaTek flasher with account provisioning and optional LUKS2 full-disk encryption. +Geminux is an Alpine Linux (`aarch64`, musl, OpenRC) distribution tailored for the **Planet Computers Gemini PDA** (Wi-Fi + 4G, MediaTek MT6797X / Helio X27). It pairs a custom-patched Linux `7.3.5-geminux` kernel with XLibre X11, a touch-friendly suckless desktop, 11 HiDPI C11 applications (`libgemui`), MT6797 cellular/eSIM/IMS daemons, and a pure-Linux MediaTek flasher with optional LUKS2 full-disk encryption. + +## Highlights + +- **Desktop & Theming**: Rotated `ShadowFB` + `TearFree` XLibre display with Panfrost EGL/OpenGL 3D acceleration, Pango/HarfBuzz `dwm` / `st` / `dmenu` (Fira Code ligatures and Nerd Fonts), `192 DPI` scaling (`2x`), **22** unified `.xth` themes defaulting to **Anodized**, an interactive **Theme Editor & Importer**, and a native X11 + Cairo **Wallpaper** manager. +- **Cellular, Connectivity & Audio**: MT6797 MD1 cellular bring-up (`geminux-cellctl` + `lpac` ST33 eUICC eSIM), 3GPP VoLTE / VoWiFi / SMS-over-IMS (`geminux-imsd`), PipeWire audio + WirePlumber idle suspend, `Fn+F` hardware Airplane Mode, microSD `/media/sdcard` boot/hotplug automount (`geminux-sdcard` / `eudev`), and configurable DNS presets (`geminux-dnsctl`). +- **Browser, Media & CLI Tools**: Ultrawide `GTK3`/`WebKit2GTK` **Webarchy** browser (`webarchy` with collapsible vertical tabs), native Alpine Edge `mpv` + `ffmpeg` + `gst-libav`, `yt-dlp` (`quickjs`), `python3`/`pip`, `tcl`/`tk` with dynamic `gtkTtk 0.9`, `gnupg`/`pass`, `dosfstools`, `bantam` CLI AI agent (`kilo-auto/free` default), `lynx`, and `gsocket`. +- **Flashing & Security**: Pure-Linux `mtkclient` BROM/DA flasher preserving MediaTek protected partitions (`LBA 0..0x6FFFF`), offline desktop/`root` credential provisioning, and optional Argon2id + ARMv8 AES-CE **LUKS2** full-disk encryption (`--encrypt`) with Gemini matrix keyboard unlock in initramfs. ## Key design goals -- Pure Alpine Edge userspace updatable via `apk update && apk upgrade` -- Pinned kernel, modules, XLibre, suckless desktop, custom UI, Webarchy browser, pure-C `gdk-pixbuf`, `gtkTtk`, `bantam`, `gsocket`, and device configs (including `/etc/mpv/mpv.conf`) across 11 local signed `@geminux` APK packages (`name@geminux=version`) -- Non-whitelisted Rust/Wayland/override packages blocked via `!` pins in `/etc/apk/world` and verified via ELF scan (`librsvg`, `rav1e`/`rav1e-libs`, and `libdovi` are explicitly whitelisted for ecosystem compatibility and native `ffmpeg`/`mpv`/`gst-libav`) -- Full eMMC occupancy for Linux (`geminux-root`) without Android dual-boot sharing, while strictly preserving the MediaTek protected region (`LBA 0..0x6FFFF`) -- Optional LUKS2 + `dm-crypt` full-disk encryption (`--encrypt`, `aes-xts-plain64` with ARMv8 AES-CE, Argon2id) with early-boot `simpledrm` + Gemini matrix keyboard unlock and automatic first-boot ext4 expansion, alongside offline desktop/`root` credential provisioning during flashing -- Aggressive battery optimization from kernel (`HZ_100`, `RCU_LAZY`, `SUSPEND`, LZ4 `zram`, `SCHEDUTIL`) up to userspace (`epoll`-based zero-poll daemons, rotated `ShadowFB` + `st` cursor-blink gating, A72 big-cluster gating, WirePlumber idle suspend, Wi-Fi `powersave = 2` keeping CONSYS awake while associated and gated on toggle-off/suspend, Bluetooth disabled at boot, `Fn+F` hardware Airplane Mode cutting all radios while leaving `usb0` up, default-off cover LEDs, lid-close S3 suspend) +- **Upgradable Alpine Edge userspace**: Standard packages update normally via `apk update && apk upgrade`. +- **Pinned hardware stack**: Kernel modules, XLibre, suckless desktop, `dunst`, custom UI, Webarchy, pure-C `gdk-pixbuf`, `gtkTtk`, `bantam`, `gsocket`, and system configs live in **11** local RSA-signed `@geminux` APK packages (`name@geminux=version`). +- **Rust-free & Wayland-free policy**: Disallowed Rust/Wayland/upstream override packages are blocked via `!` pins in `/etc/apk/world` and verified by ELF scanning (`librsvg`, `rav1e`/`rav1e-libs`, and `libdovi` remain whitelisted for ecosystem compatibility and `ffmpeg`/`mpv`/`gst-libav`). +- **Full eMMC layout**: Claims user-writable eMMC for Linux (`geminux-root`) without Android dual-boot partitioning, while write-protecting the MediaTek factory region (`LBA 0..0x6FFFF`). +- **Optional full-disk encryption**: `--encrypt` wraps `geminux-rootfs` in LUKS2 `aes-xts-plain64` (hardware AES-CE, Argon2id) with early-boot `simpledrm` + Gemini US keyboard unlock and automatic first-boot ext4 expansion. +- **End-to-end battery optimization**: Combines kernel tuning (`HZ_100`, `RCU_LAZY`, `SUSPEND`, LZ4 `zram`, `SCHEDUTIL`, `0013` PMIC wake IRQ & SPM safety) with zero-poll `epoll` daemons, A72 cluster gating, `st` unfocused blink gating, default-off cover LEDs, and lid-close deep sleep. ## Component stack | Subsystem | Implementation | Source / Script | | --- | --- | --- | -| Kernel & boot | Linux `7.3.5-geminux` + Gemini x27 patches (`SSD2092` DSI/touch, synchronous `gemini-lid` Hall filter, inhibit & `PM_POST_SUSPEND` lockout prevention `0011`/`0012`, `mt6351-fuel-gauge` + `bq25890` zero-current charger-boot OCV calibration, CV-taper & start-up `ADC21` accuracy `0008`/`0012`, CONSYS Wi-Fi/BT + peer deauth/GTK rekey/drop-free stability `0007`/`0009`, S3 resume/SPM `0008`, CCCI/CLDMA + MD1 boot HS v2/RPC `0002`/`0010`, XFRM/ESP IPsec, `sii902x`, `dm-crypt` LUKS2 initramfs) | [scripts/build-kernel.sh](file:///home/lux/proj/geminux/scripts/build-kernel.sh) | -| Flasher & GPT | Vendored GPLv3 `mtkclient` + MT6797 DA + GPT builder + offline credential & LUKS2 provisioning | [flash-mtk.sh](file:///home/lux/proj/geminux/flash-mtk.sh), [flash-mtk.py](file:///home/lux/proj/geminux/flash-mtk.py), [scripts/geminux_accounts.py](file:///home/lux/proj/geminux/scripts/geminux_accounts.py), [scripts/geminux_luks.py](file:///home/lux/proj/geminux/scripts/geminux_luks.py) | -| Display server | XLibre Xorg 25.x (`modesetting` `ShadowFB` + `TearFree` rotated 2D scanout alongside Panfrost Glamor/EGL 3D, `fbdev`, `libinput`) | [scripts/build-xlibre.sh](file:///home/lux/proj/geminux/scripts/build-xlibre.sh) | -| Window manager & terminal | Patched `dwm` (Pango, systray, `.Xresources`, `Mod4`, `Fn+F` Airplane Mode keybind, `SIGHUP` self-reexec), `st` (HarfBuzz ligatures, focus cursor sync & unfocused cursor-blink gating, wheel scrollback), full-height `dmenu` | [scripts/build-suckless.sh](file:///home/lux/proj/geminux/scripts/build-suckless.sh) | -| Notifications | Pure-X11 zero-`gdk-pixbuf` `dunst v1.12.2` + custom GDBus `notify-send` / `dunstify` (`geminux-sync-dunst-theme`) | [scripts/build-dunst.sh](file:///home/lux/proj/geminux/scripts/build-dunst.sh) | -| Web & toolkits | Webarchy C++20 `GTK3` + `WebKit2GTK-4.1` ultrawide browser (right-side vertical tab bar, DPI-scaled `.Xresources` `SIGUSR1` theming, live `xsettingsd`/`dconf` & `Geminux-*` GTK2/3/4/`libadwaita`/Qt5/Qt6 sync), pure-C `gdk-pixbuf 2.42.12`, `tcl` (`tcl-lib`, `tcl-tls`), and `tk` + `gtkTtk 0.9` dynamic GTK2 theme engine | [scripts/build-webarchy.sh](file:///home/lux/proj/geminux/scripts/build-webarchy.sh), [scripts/build-gtkttk.sh](file:///home/lux/proj/geminux/scripts/build-gtkttk.sh), [scripts/compile-gsettings-schemas.sh](file:///home/lux/proj/geminux/scripts/compile-gsettings-schemas.sh) | -| UI & system daemons | `libgemui.so`, 11 landscape HiDPI apps (`geminux-net` Cellular/eSIM/DNS + Airplane Mode banner), zero-poll C11 daemons (`geminux-cellctl` dual-SIM / ST33 `lpac` eSIM + `ccmni*` PDN, `geminux-imsd` VoLTE/VoWiFi `SWu`/SMS-over-IMS/RTP, `geminux-powerd` hardware Airplane Mode, `geminux-dnsctl`, etc.) | [scripts/build-geminux-ui.sh](file:///home/lux/proj/geminux/scripts/build-geminux-ui.sh) | -| Media & CLI tools | Native Alpine Edge `mpv` (`/etc/mpv/mpv.conf` with Panfrost X11 EGL + PipeWire + IPC), `ffmpeg`/`ffprobe`, `gst-libav`, `mpg123`, `openmpt123`, `yt-dlp` (`quickjs`), `python3`/`pip3`, `tclsh`/`wish`, `gpg` (`gnupg`), `pass`, `dosfstools` (`mkfs.vfat`/`fsck.vfat`/`fatlabel`), `bantam`, `lynx`, `gsocket`, `.apexrc`, default `htoprc` | [scripts/build-bantam.sh](file:///home/lux/proj/geminux/scripts/build-bantam.sh), [scripts/build-gsocket.sh](file:///home/lux/proj/geminux/scripts/build-gsocket.sh), [overlay/rootfs/etc/mpv/mpv.conf](file:///home/lux/proj/geminux/overlay/rootfs/etc/mpv/mpv.conf) | -| Local APK repository | 11 signed `@geminux` `.apk` packages + `APKINDEX.tar.gz` | [scripts/package-local-apks.sh](file:///home/lux/proj/geminux/scripts/package-local-apks.sh) | -| Full build & checks | Full image assembly + offline verification suite | [rebuild-image.sh](file:///home/lux/proj/geminux/rebuild-image.sh), [scripts/check-rebuild.sh](file:///home/lux/proj/geminux/scripts/check-rebuild.sh) | +| **Kernel & boot** | Linux `7.3.5-geminux` + 13 Gemini x27 patches (`0001`–`0013`): `SSD2092` DSI/touch, synchronous `gemini-lid`, `mt6351`+`bq25890` zero-current OCV & taper fuel gauge, CONSYS Wi-Fi/BT, CCCI/CLDMA + MD1, S3 resume + `0013` MT6397 `LATE_SYSTEM_SLEEP_PM_OPS` & SPM watchdog/timer safety, XFRM/ESP IPsec, `sii902x`, LUKS2 initramfs | [scripts/build-kernel.sh](scripts/build-kernel.sh) | +| **Flasher & GPT** | Vendored GPLv3 `mtkclient` + MT6797 DA + GPT builder + offline credential & LUKS2 provisioning | [flash-mtk.sh](flash-mtk.sh), [flash-mtk.py](flash-mtk.py), [scripts/geminux_accounts.py](scripts/geminux_accounts.py), [scripts/geminux_luks.py](scripts/geminux_luks.py) | +| **Display server** | XLibre Xorg 25.x (`modesetting` `ShadowFB` + `TearFree` rotated 2D scanout, Panfrost Glamor/EGL 3D, `fbdev`, `libinput`) | [scripts/build-xlibre.sh](scripts/build-xlibre.sh) | +| **WM & terminal** | Patched `dwm` (Pango `PANGO_ELLIPSIZE_END` & `FC_COLOR=FcFalse`, 32-bit ARGB XEmbed systray, full EWMH/ICCCM/NETWM + Wine/DXVK focus recovery, `xerror`/`RENDER` fault guards, live `.Xresources` reload, `Mod4`, `Fn+F` Airplane Mode, `SIGHUP` self-reexec), `st` (HarfBuzz ligatures, live `XA_RESOURCE_MANAGER`/`SIGUSR1` reloads, focus cursor sync & blink gating), full-height touch `dmenu` (82 px rows, `RENDER` guards, UTF-8 sanitization) | [scripts/build-suckless.sh](scripts/build-suckless.sh) | +| **Notifications** | Pure-X11 zero-`gdk-pixbuf` `dunst v1.12.2` + custom GDBus `notify-send` / `dunstify` (`geminux-sync-dunst-theme`) | [scripts/build-dunst.sh](scripts/build-dunst.sh) | +| **Web & toolkits** | Webarchy C++20 `GTK3` + `WebKit2GTK-4.1` browser (right-side vertical tabs, live `.Xresources` theming), pure-C `gdk-pixbuf 2.42.12`, `tcl`/`tk` + `gtkTtk 0.9` theme engine, synchronized GTK2/3/4/`libadwaita`/Qt5/Qt6/Tk theming | [scripts/build-webarchy.sh](scripts/build-webarchy.sh), [scripts/build-gtkttk.sh](scripts/build-gtkttk.sh), [scripts/compile-gsettings-schemas.sh](scripts/compile-gsettings-schemas.sh) | +| **UI, themes & daemons** | `libgemui.so`, 11 HiDPI apps including `geminux-themes` (22 `.xth` themes defaulting to **Anodized**, interactive Theme Editor & Importer, native X11 Wallpaper manager) + `geminux-apply-wallpaper`, zero-poll C11 daemons (`geminux-cellctl`, `geminux-imsd`, `geminux-powerd`, `geminux-statusd`, `geminux-touchd`, `geminux-dnsctl`, etc.) | [scripts/build-geminux-ui.sh](scripts/build-geminux-ui.sh) | +| **Media & CLI tools** | Native Alpine Edge `mpv` (`/etc/mpv/mpv.conf` Panfrost EGL + PipeWire + IPC), `ffmpeg`/`ffprobe`, `gst-libav`, `mpg123`, `openmpt123`, `yt-dlp` (`quickjs`), `python3`/`pip3`, `tclsh`/`wish`, `gpg`, `pass`, `dosfstools`, `bantam`, `lynx`, `gsocket`, `.apexrc`, default `htoprc` | [scripts/build-bantam.sh](scripts/build-bantam.sh), [scripts/build-gsocket.sh](scripts/build-gsocket.sh), [overlay/rootfs/etc/mpv/mpv.conf](overlay/rootfs/etc/mpv/mpv.conf) | +| **Local APK repository** | 11 signed `@geminux` `.apk` packages + `APKINDEX.tar.gz` | [scripts/package-local-apks.sh](scripts/package-local-apks.sh) | +| **Full build & checks** | Full image assembly + automated offline verification suite | [rebuild-image.sh](rebuild-image.sh), [scripts/check-rebuild.sh](scripts/check-rebuild.sh) | ## Repository layout -- [kernel/](file:///home/lux/proj/geminux/kernel) and [patches/kernel/](file:///home/lux/proj/geminux/patches/kernel) — kernel manifest, MT6797X configuration, and Linux `7.3.5` patch queue -- [src/](file:///home/lux/proj/geminux/src) — initramfs scripts, `st`, `dwm`, `dmenu`, `dunst-notify`, `bantam`, `webarchy`, `libgemui`, `geminux-apps`, and `geminux-daemons` -- [overlay/rootfs/](file:///home/lux/proj/geminux/overlay/rootfs) — OpenRC services (including `geminux-sdcard`), ALSA UCM2, XKB layout, console keymap, Xorg drop-ins, 21 `.xth` themes, PipeWire/WirePlumber, udev (`95-geminux-sdcard.rules` microSD automount to `/media/sdcard`), `/etc/mpv/mpv.conf`, and NetworkManager configs -- [scripts/](file:///home/lux/proj/geminux/scripts) — cross-compilation builders, APK packager, rootfs bootstrapper, verification suite, and unit tests -- [prebuilt/](file:///home/lux/proj/geminux/prebuilt) — cross-compiled `aarch64` staging tree (`images/` holds built boot, recovery, and ext4 rootfs images) +- [kernel/](kernel/) and [patches/kernel/](patches/kernel/) — kernel manifest, MT6797X configuration, and 13 Linux `7.3.5` patches +- [src/](src/) — initramfs scripts, `st`, `dwm`, `dmenu`, `dunst-notify`, `bantam`, `webarchy`, `gtkTtk`, `libgemui`, `geminux-apps` (including `geminux-xth.h`, `geminux-wallpaper.h`, `geminux-wallpaper-x11.h`), and `geminux-daemons` +- [overlay/rootfs/](overlay/rootfs/) — OpenRC services (`geminux-sdcard`, `geminux-hwinit`, etc.), ALSA UCM2, XKB layout, console keymap, Xorg drop-ins, **22** `.xth` themes (default: `Anodized`), `geminux-apply-theme`, `geminux-apply-wallpaper`, PipeWire/WirePlumber, udev rules (`95-geminux-sdcard.rules`), `/etc/mpv/mpv.conf`, and NetworkManager configs +- [scripts/](scripts/) — cross-compilation builders, APK packager, rootfs bootstrapper, verification suite, and 9 host Python unit test suites +- [prebuilt/](prebuilt/) — cross-compiled `aarch64` staging tree (`images/` holds built boot, recovery, and ext4 rootfs images) ## Verification status vs. on-device testing -All cross-compiled binaries, kernel/DTB artifacts, GPT repartitioning logic, offline credential/LUKS2 builders, XKB keymap compilation, `.Xresources`-to-`dunstrc`/GTK2/3/4/Qt5/6/Tk(`gtkTtk`) theme syncing, MT6797 CCCI framing/handshake unit tests, 3GPP IMS/AKA/ESP/SIP/RTP protocol tests ([scripts/test-ims-protocol.py](file:///home/lux/proj/geminux/scripts/test-ims-protocol.py)), zero-poll power policy tests, Webarchy renderer profile & WebKit GSettings schema tests, `dosfstools` & `/media/sdcard` automount tests, ELF binary Rust scan, and `apk upgrade --simulate` checks are verified automatically via [scripts/check-rebuild.sh](file:///home/lux/proj/geminux/scripts/check-rebuild.sh). +**Automated host verification** via [scripts/check-rebuild.sh](scripts/check-rebuild.sh) validates: +- Cross-compiled binaries, kernel/DTB artifacts, and GPT repartitioning logic ([scripts/test-flash-mtk-gpt.py](scripts/test-flash-mtk-gpt.py)) +- Offline credential/LUKS2 builders, XKB keymap compilation, and `.Xresources`-to-`dunstrc`/GTK/Qt/Tk theme syncing +- MT6797 CCCI framing/handshake, 3GPP IMS/AKA/ESP/SIP/RTP protocol handling ([scripts/test-ims-protocol.py](scripts/test-ims-protocol.py)), and zero-poll power policy +- Webarchy renderer profiles, WebKit GSettings schemas, `dosfstools` + `/media/sdcard` automount logic, ELF Rust scans, and `apk upgrade --simulate` -Live hardware bring-up on a physical Planet Computers Gemini PDA (x27 Wi-Fi + 4G) has been verified for USB BROM/DA flashing, offline account provisioning, LUKS2 full-disk encryption unlock & first-boot ext4 resize, `SSD2092` FHD+ display & multi-touch gestures (`geminux-touchd`), tear-free rotated `ShadowFB` scanout, lid-close S3 deep sleep & resume, CONSYS Wi-Fi/BT (`geminux-net` DNS tab & associated WLAN persistence), MT6797 MD1 baseband boot (`MD_STATE=READY`), ST33 eUICC / physical SIM slot switching & `geminux-imsd` standby, `Fn+F` hardware Airplane Mode radio teardown/restore, Webarchy ultrawide Panfrost GPU rendering, PipeWire audio, Media Controller + 10-bit Bayer camera ISP, AW9120 RGB back LEDs, Chrony online time sync, and USB NCM networking. Accessory/carrier-dependent checks (such as live VoLTE/VoWiFi calls/SMS with an active carrier SIM/eUICC profile and external Slimport/HDMI monitors) are documented in the hardware checklist in [INSTALL.md](file:///home/lux/proj/geminux/INSTALL.md). +**Verified on physical Gemini PDA (x27 Wi-Fi + 4G) hardware**: +- USB BROM/DA flashing, offline credential provisioning, LUKS2 unlock, and first-boot ext4 resize +- `SSD2092` FHD+ display, `geminux-touchd` multi-touch gestures, and tear-free rotated `ShadowFB` scanout +- Lid-close and overnight S3 deep sleep/resume, CONSYS Wi-Fi/BT, MT6797 MD1 boot (`MD_STATE=READY`), ST33 eUICC/physical SIM slot switching, and `Fn+F` hardware Airplane Mode +- Webarchy Panfrost rendering, PipeWire audio, Media Controller + 10-bit Bayer camera ISP, AW9120 back LEDs, Chrony NTP sync, and USB NCM networking + +> [!NOTE] +> Carrier- and accessory-dependent tests (such as live VoLTE/VoWiFi calls/SMS on an active carrier SIM or external Slimport/HDMI monitors) are covered in the hardware checklist in [INSTALL.md](INSTALL.md). ## Quick start (host build and checks) @@ -47,18 +65,18 @@ Live hardware bring-up on a physical Planet Computers Gemini PDA (x27 Wi-Fi + 4G ./scripts/check-rebuild.sh ``` -To rebuild all cross-compiled components from scratch (kernel, XLibre, suckless desktop, dunst, UI apps/daemons, Bantam, gsocket, pure-C `gdk-pixbuf`/Webarchy, signed `@geminux` APKs, and rootfs ext4) and upgrade preinstalled Alpine Edge packages in `rootfs/` to the latest Alpine Edge state: +To rebuild all cross-compiled components from scratch and upgrade preinstalled Alpine Edge packages in `rootfs/` to the latest Edge release: ```sh ./rebuild-image.sh --rebuild-all --force-bootstrap ./scripts/check-rebuild.sh ``` -Running `./rebuild-image.sh --force-bootstrap` alone also upgrades existing `rootfs/` Alpine Edge packages without recompiling all cross-compiled toolchains. +Running `./rebuild-image.sh --force-bootstrap` alone refreshes preinstalled Alpine Edge packages inside `rootfs/` without recompiling toolchains. -Further documentation: +## Documentation index -- [INSTALL.md](file:///home/lux/proj/geminux/INSTALL.md) — Linux flashing procedure, backup, firmware extraction, and hardware bring-up checklist -- [MANUAL.md](file:///home/lux/proj/geminux/MANUAL.md) — Keyboard map, DWM shortcuts, themes, applications, and Alpine Edge maintenance -- [ARCHITECTURE.md](file:///home/lux/proj/geminux/ARCHITECTURE.md) — Kernel, CCCI, XLibre, `@geminux` APK pinning, and flasher internals -- [POWER-OPTIMIZATION.md](file:///home/lux/proj/geminux/POWER-OPTIMIZATION.md) — Power-saving architecture and benchmarking methodology +- [INSTALL.md](INSTALL.md) — Host prerequisites, flashing workflow, backup, firmware extraction, LUKS2 encryption, and hardware validation checklist +- [MANUAL.md](MANUAL.md) — Keyboard layout, DWM shortcuts, themes & Theme Editor, desktop wallpapers, applications, and Alpine Edge maintenance +- [ARCHITECTURE.md](ARCHITECTURE.md) — Kernel patch queue, XLibre, suckless hardening, theming/wallpaper engine, `@geminux` APK pinning, and flasher internals +- [POWER-OPTIMIZATION.md](POWER-OPTIMIZATION.md) — Deep sleep fixes, zero-poll daemons, CPU cluster gating, and on-device power auditing