# B14 — Cage + SDL2 modem UI (2026-10-04/05) — **USERSPACE VALIDATED** Changes only in Alpine on p27 (no kernel/DTB/cache/GPT/firmware change). Running kernel 7.2.7-aurora-b12 (cache B12R). ## 1. SDL2 - Alpine 3.24: native **sdl2 2.32.10-r0** (not sdl2-compat). Compiled video drivers: `x11 wayland KMSDRM offscreen dummy evdev`; under Cage `SDL_GetCurrentVideoDriver() = wayland` (aurora-ui refuses to run on anything else). No Xwayland binary on the system. - Pitfalls found: (a) SDL2/Wayland has no shm framebuffer — every window path goes through EGL; (b) without `wayland-libs-egl` (libwayland-egl.so.1, dlopened) SDL2 **segfaults** in `Wayland_CreateWindow` (SDL_waylandwindow.c:2055, NULL wl_egl_window_create); (c) Mesa needs its libgallium/LLVM files (restored in B13W). With `LIBGL_ALWAYS_SOFTWARE=1` the renderer is SDL `opengl` on Mesa **llvmpipe via EGL/wl_shm** (libgallium); the lavapipe Vulkan ICD (`mesa-vulkan-swrast`, installed while debugging) is **not used** (UI works with `VK_ICD_FILENAMES=/nonexistent`, no lvp mapping) — removal can be tested separately. - No SDL_ttf: 8x16 cp437 bitmap font extracted from Linux `lib/fonts/font_8x16.c` (GPL-2.0). ## 2–5. Application `b14/src/aurora-ui.c` (~360 lines C, 75 KB binary, `-Wall -Wextra` clean), built on the board (`apk add build-base sdl2-dev`), installed `/usr/local/bin/aurora-ui`. Software-drawn 128x128 ARGB → streaming texture, redraw 1/s (+ on events), worker thread for slow sources. Layout (8 rows x 16 cols, 4 colours + grey): ``` BEELINE LTE operator / RAT (mmcli every 5 s, timeout 3 s, only while ModemManager runs) ▂▄▆█▒ 70% signal quality 10.82.242.155 wwan0 IPv4 (/run/aurora-modem/ipcfg, every 2 s) WiFi 1 cl AP up + stations (iw info + station dump every 5 s) ↓73B ↑73B throughput (1 s; wwan0 counters are always 0 on bam-dmux → wlan0 LAN counters) BAT 4.13V HOLD VADC VBAT + supervisor state (B10 /sys/kernel/debug/pm8916_lbc/state, 1 s) — no SOC (no fuel gauge) PMIC 36°C NAT pm8916-thermal + default route 02:02 ONLINE clock (TZ=MSK-3 from /etc/aurora/aurora-ui.conf) + overall ``` Before START OK the top rows show `MODEM STARTING` + the controller state; FAIL → `MODEM FAIL`. Missing sources render `--`. Finding: `pm8916-bms-vm` power_supply reports 4.41 V / "Over voltage" while the validated VADC says 4.19 V → the UI uses VADC only. ## 6–7. Launcher + wayvnc `b14/run/ui-up.sh [--stop-gui]` (refuses if Xorg/Cage/Sway hold the panel; one instance; Pixman/seatd env; waits for first frame), `ui-stop.sh`, `ui-status.sh` → /usr/local/lib/b14/run. Process lookup via /proc/PID/exe (the OpenRC script has the same comm name). wayvnc (b13/run/wayvnc-up.sh) on Cage+aurora-ui: same output SPI-1, 172.16.42.1:5900 only (IPv6 listeners 0), TLS+password, VNC pointer/keys do not disturb the app. ## 8. Test (manual start: X11 stop → Cage → aurora-ui → wayvnc) - Startup: 0.9–2.2 s to first frame (aurora-ui first frame 1.1–1.5 s after exec). - Soak 15 min (`soak.log`) + control 5 min (`soak2.log`): aurora-ui RSS 108–114 MB (PSS 95 MB; **private dirty ~34 MB**, ~43 MB clean mesa/LLVM file pages), Cage 47.6–48.2 MB, both flat; CPU aurora-ui 1.5–1.6 %, Cage 0.16–0.22 %; MemAvailable ~269–271 MB stable. modem BEARER_CONNECTED + LTE ping ok every minute; phone client: NAT forward counters grew, UI showed `WiFi 1 cl` and live ↓/↑; charger CHARGING → HOLD shown; PMIC 36–49 °C; NCM ping from 480s 919/920 over the soak; eMMC writes outside p27 = 0. - Kernel log: **65 `cma: __cma_alloc_frozen: reserved: alloc failed, req-size: 8 pages, ret: -16`** between uptime 3289–4892 s. Root cause analysis: the 32 MiB CMA area was filled by movable page cache (after the apk/gdb installs: CmaFree 112 kB) and page migration returned EBUSY; the bitmap had 8000 free pages. Not the UI: 0 failures without UI under LTE load, and after `drop_caches` (CmaFree 30.6 MB) **0 failures in the 5-min control soak with UI + wayvnc running**. Allocations fell back (no traffic impact: ping/NAT fine). Follow-up candidate (separate): watch CMA after large apk operations / consider `cma=` or vm tuning. - Other kernel messages: only the known boot-time ones (wcnss.mdt at 1.4 s before /firmware, regulatory.db). ## 9. X11 regression — PASS ui-stop → VT tty1 → `aurora-x start fbdev` → X-START OK 128x128, twm+xterm, x11vnc 172.16.42.1:5900 (IPv4 only), frame OK. UI restored afterwards. ## PASS matrix Cage starts ✔ · SDL2 uses Wayland ✔ · 128x128 physical UI correct ✔ (operator) · live LTE ✔ · Wi-Fi ✔ · traffic ✔ (after fix, operator) · battery/charger ✔ · clock ✔ · wayvnc same output ✔ · LTE/Wi-Fi/router/NCM/charger unaffected ✔ · no kernel errors caused by B14 ✔ (CMA warnings explained above) · no writes outside p27 ✔ · X11 regression ✔ **B14 Cage + SDL2 modem UI: USERSPACE VALIDATED** ## 10–11. OpenRC autostart (prepared, NOT enabled) `/etc/init.d/aurora-ui` installed on p27 (source `b14/run/aurora-ui.openrc`), in no runlevel. Activation patch (separate GO): ``` rc-update add aurora-ui default ``` Order: `need aurora-display; after aurora-ncm aurora-ro` — it does not wait for the modem (UI shows MODEM STARTING), starts ui-up in the background so boot never blocks on the GUI; fbcon/getty on tty1 stay as fallback behind Cage; `rc-service aurora-ui stop` returns the console. ## p27 footprint New packages: sdl2, wayland-libs-egl, mesa-vulkan-swrast (unused), build-base + sdl2-dev (+deps, build only), gdb/musl-dbg/sdl2-dbg (debug). p27 now 1.0 GB used of 2.4 GB. Build/debug packages can be removed with `apk del build-base sdl2-dev gdb musl-dbg sdl2-dbg`. ## Autostart (2026-10-05, GO) - `rc-update add aurora-ui default` on p27 (default runlevel: aurora-display, aurora-ui, aurora-modem, aurora-wifi, aurora-router, aurora-bootok). - cold1 (normal power-on, no RESET; logs/b14/cold1/): stage0 fsck clean + switch_root at 4.3 s, BOOT OK 6.6 s, **UI UP at 9.47 s uptime** (Cage + aurora-ui, first frame 1.04 s after exec, SDL wayland/opengl), modem START OK 81.6 s, AP 85.5 s, **aurora-router autostart: ROUTER UP OK 88.1 s** (first boot with the router in the runlevel), all default services started, CMA failures 0, eMMC writes only p27. Screenshot after boot: BEELINE LTE 60 %, 10.87.61.183, WiFi 0 cl, BAT 4.18 V CHG, PMIC 42 °C, NAT, ONLINE. - Undo: `rc-update del aurora-ui default` (console/getty on tty1 returns on the next boot) or `rc-service aurora-ui stop` for this boot.