From 5d10b801ff88f4a7677a41271778ebd0e26d9e8f Mon Sep 17 00:00:00 2001 From: Luxferre Date: Thu, 5 Nov 2026 14:18:59 +0200 Subject: [PATCH] Slim the armv7 rootfs: drop Rust and Wayland packages, dead code, and build residue - Replace Rust sudo-rs with C sudo (sudo-virt provider at priority 100) and add a two-phase pruner so apk atomically swaps the conflicting provider. - Remove Wayland-purpose libwpebackend-fdo from the runtime set and add imv-x11 for the X11-only image viewer path. - Drop unused mesa-demos, postmarketos-artwork-wallpapers, ttyescape/hkdm, clickclack/sdl3, and font-twemoji; keep sfeed, w3m, htop, non-Latin fonts, and the documented SDK toolchain to avoid functional regressions. - Strip apk index caches, apk logs, and unused gettext locales before mke2fs, with a hard guard that fails the build if any residue survives. - Harden check-rebuild.sh with critical/forbidden package and guard checks. - Delete the unreferenced Sway-era configurator and patch; sync the docs. --- AGENTS.md | 5 + CHANGELOG.md | 12 + MANUAL.md | 6 +- README.md | 4 +- ...01-bananarchy-sxmo-240x320-keypad-ui.patch | 226 ----- rebuild-image.sh | 27 + scripts/bootstrap-rootfs-container.sh | 5 + scripts/check-rebuild.sh | 38 +- scripts/configure-rootfs-from-scratch.sh | 784 ------------------ scripts/prune-rootfs-packages.sh | 56 ++ scripts/rootfs-packages.txt | 13 +- scripts/rootfs-prune-packages.txt | 35 + 12 files changed, 187 insertions(+), 1024 deletions(-) delete mode 100644 patches/sxmo/0001-bananarchy-sxmo-240x320-keypad-ui.patch delete mode 100755 scripts/configure-rootfs-from-scratch.sh create mode 100755 scripts/prune-rootfs-packages.sh create mode 100644 scripts/rootfs-prune-packages.txt diff --git a/AGENTS.md b/AGENTS.md index d086136..6be7fcf 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,6 +27,8 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adre - `devices/` & `patches/`: device trees (`.dts`/`.dtb`), MIPI-DBI panel init sequences, and upstream patch sets. - `vendor/edl/`: vendored, patched EDL client library (MIT) used by `flash-edl.py`; a local `edl/` checkout or `BANANARCHY_EDL_DIR` overrides it. - `scripts/rootfs-packages.txt`: single source of truth for the `armv7` rootfs package set, read by both `bootstrap-rootfs.sh` and `rebuild-image.sh`. +- `scripts/rootfs-prune-packages.txt`: denylist of Wayland-only, Rust-based, and retired packages purged from existing rootfs trees by `bootstrap-rootfs-container.sh` and `rebuild-image.sh`. +- `scripts/prune-rootfs-packages.sh`: two-phase rootfs pruner (`world` before `apk add`, `purge` after) that reads the denylist; the `world` phase is required so apk can atomically replace Rust `sudo-rs` with C `sudo`. ## 3. Build and image generation commands All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` sysroot) and write to `prebuilt/`; `rebuild-image.sh` mirrors those artifacts into `overlay/rootfs/`: @@ -43,6 +45,7 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` - `./chroot-shell.sh` — opens an `armv7` container shell to manage packages in `rootfs/` (`pkg-add`, `pkg-del`, `pkg-search`); bootstraps `rootfs/` first if needed. - `./rebuild-image.sh [--mkinitfs]` — verifies the clone, syncs `prebuilt/` into `overlay/rootfs/`, bootstraps `rootfs/` from scratch when missing, applies the overlay, and produces flashable images in `images/`. - `./scripts/bootstrap-rootfs.sh [rootfs-dir] [device] [--force|--check]` — creates a complete `armv7` rootfs from `scripts/rootfs-packages.txt` inside rootless Docker; idempotent via `etc/bananarchy/rootfs-bootstrap.done`. +- `./scripts/prune-rootfs-packages.sh world|purge` — removes Wayland-only, Rust-based, and retired packages from a target rootfs inside the build container. - `./scripts/check-rebuild.sh` — offline preflight for a clean clone (syntax, package list, plugin artifacts, overlay sync, ignored local agent config, Docker, version helper). - `./scripts/sync-prebuilt-overlay.sh [--check]` — mirrors `prebuilt/` artifacts into `overlay/rootfs/`; `--check` only reports drift. - `./scripts/bootstrap-flash-deps.sh` — installs `pyusb` and `pyserial` into the gitignored `.flash-deps/` directory for `flash-edl.py`. @@ -55,5 +58,7 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` - **Zero-lag plugin model**: phone UI apps must run as preloaded resident daemons (`--preload`) guarded by `/tmp/dwm_plugin_.lock`, sleeping at 0% CPU on `poll()` over `ConnectionNumber(dpy)` and `/tmp/dwm_plugin_.fifo`, and rendering into an offscreen `Pixmap` (`240x296` at `X=0, Y=24`) copied with `XCopyArea` to prevent flicker. - **Documentation**: keep `README.md`, `MANUAL.md`, `SDK.md`, and `CHANGELOG.md` synchronized with any new user-facing features, SDK functions, or keybindings, and do not leave third-party `.md` files inside `src/` or `edl/`. - **Artifact sources**: `prebuilt/` is the single source of truth for compiled artifacts and `scripts/rootfs-packages.txt` for the `armv7` package set. Never edit `overlay/rootfs/` copies of binaries by hand; run `./scripts/sync-prebuilt-overlay.sh` after changing `prebuilt/`. +- **Package hygiene**: keep `scripts/rootfs-packages.txt` free of Rust-based top-level packages (use C `sudo`, never `sudo-rs`) and Wayland-purpose packages; `libwpe` and the `wayland-libs-*` shared libraries stay because GTK3/WebKitGTK link them directly, but no Wayland compositor, backend, or viewer is shipped. `scripts/check-rebuild.sh` enforces this. +- **Image residue**: `rebuild-image.sh` strips `/var/cache/apk`, all `apk.log*` files, and unused gettext locale trees before `mke2fs` and aborts the build if any apk cache/log remains; never add an `apk` call after that guard. - **Local agent config**: `.bantam.cfg` is a local, gitignored credential file. Never read, edit, commit, or unignore it; `scripts/check-rebuild.sh` verifies that its ignore rule stays in place. - **Sentence case**: always use sentence case in subheadings and list items across all documentation files (`README.md`, `MANUAL.md`, `SDK.md`, `CHANGELOG.md`, `AGENTS.md`). diff --git a/CHANGELOG.md b/CHANGELOG.md index 199e9cf..69df786 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,18 @@ Release versions follow the `
` format (where `2026` is `a`, ## Unreleased +### Lean rootfs, Rust and Wayland removal, and dead code cleanup +- Replaced the Rust `sudo-rs` (and its `postmarketos-base-sudo-rs` companion) with the C `sudo` implementation in `scripts/rootfs-packages.txt`; the APK index confirms `sudo` provides `sudo-virt` at priority 100 with the same `sudo`, `sudoedit`, and `visudo` commands, so `postmarketos-base`, `sxmo_power.sh`, `gs-warp-simple.sh`, and the overlay setuid handling are unchanged. +- Added `scripts/prune-rootfs-packages.sh` with a `world` phase (before `apk add`, so apk atomically replaces `sudo-rs` with C `sudo` instead of failing on the `cmd:sudo` conflict) and a `purge` phase (after `apk add`, so `install_if` helpers are not re-added); verified in an `alpine:3.24` container against a real `armv7` pmOS rootfs. +- Removed the Wayland-purpose `libwpebackend-fdo` from the runtime package set. `webarchy.so` and `libwebkit2gtk-4.1.so` have no `DT_NEEDED` on `libWPEBackend-fdo-1.0.so.1`, and `libwpe` only loads a backend after an explicit `wpe_loader_init` that WebKitGTK never performs; `libwpebackend-fdo-dev` stays in the ephemeral cross-build sysroot for `pkgconf`. +- Added `imv-x11` alongside the `imv` wrapper so a clean bootstrap has a working X11 image viewer without pulling `imv-wayland`; the session unsets `WAYLAND_DISPLAY`, so the wrapper always takes the X11 branch. +- Removed unused or superseded packages: `mesa-demos` (Wayland-linked demo binaries and `libdecor`), `postmarketos-artwork-wallpapers` (already deleted by the overlay, which ships its own wallpapers), `ttyescape` (with the disabled Rust `hkdm` daemon and `kbd` data), `clickclack` (virtual-keyboard feedback daemon unused with `SXMO_NO_VIRTUAL_KEYBOARD=1`, plus `sdl3`), and `font-twemoji` (fontconfig uses Noto Color Emoji). `glxinfo`, `eglinfo`, and `glxgears` remain via `mesa-utils`; `README.md` and `MANUAL.md` no longer advertise `glteapot` or `es2gears_x11`. +- Added `scripts/rootfs-prune-packages.txt` and wired the pruner into `scripts/bootstrap-rootfs-container.sh` and `rebuild-image.sh` so existing rootfs trees are purged of Wayland-only components (`imv-wayland`, `xwayland`, `sxmo-utils-wayland`, `wofi`, `grim`, `slurp`, `libdecor`), retired packages, and optional Rust `install_if` helpers. `wayland-libs-*` shared libraries stay because GTK3/WebKitGTK link them directly; removing them would break the Webarchy browser. +- `rebuild-image.sh` now strips `/var/cache/apk`, `/var/log/apk.log`, and the 200 unused gettext locale trees (the X11 session forces `LANG=LC_ALL=C.UTF-8`) before creating the ext4 image, saving about 100 MiB of storage and boot I/O. +- Hardened that cleanup with an idempotent `strip_build_residue()` helper called both after the apk transactions and immediately before `mke2fs`, plus a hard guard that aborts the build if any `APKINDEX.*`, hidden cache entry, or rotated `apk.log*` survives; `scripts/check-rebuild.sh` statically verifies the guard is present. +- Removed the unreferenced legacy Sway/Wayland `scripts/configure-rootfs-from-scratch.sh` configurator and `patches/sxmo/0001-bananarchy-sxmo-240x320-keypad-ui.patch` (which set `SXMO_MENU=wofi` and `xwayland disable`); all live Sxmo configuration is already tracked under `overlay/rootfs/`. +- Hardened `scripts/check-rebuild.sh` with critical-package assertions, forbidden Rust/Wayland package assertions, and prune-list validation instead of the brittle 100-package count. + ### Autonomous rebuild from a clean clone - Added `scripts/rootfs-packages.txt` as the single source of truth for the `armv7` package set, shared by `scripts/bootstrap-rootfs.sh` and `rebuild-image.sh`. - Added `scripts/bootstrap-rootfs.sh` and `scripts/bootstrap-rootfs-container.sh` to create a complete `armv7` rootfs from scratch inside rootless Docker, including system accounts, OpenRC runlevels, base configuration, the overlay, prebuilt kernel modules, and an idempotency marker at `etc/bananarchy/rootfs-bootstrap.done`. diff --git a/MANUAL.md b/MANUAL.md index 4dcc204..34a9f80 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -276,7 +276,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/ 21. **Webarchy Web browser (`webarchy.so` / `webarchy` / `xwebarchy`)**: - **Open**: select **Webarchy (Web)** from the System or Applications menu, or run `webarchy [url]` / `xwebarchy [url]`. - - **Engine, User-Agent, encoding, fonts, and multimedia**: built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0` + `libwpebackend-fdo-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS` and WebGL) and 512 MB RAM pressure tuning (`160 MB` WebProcess cap). Uses `UTF-8` as the primary/default encoding when a server specifies none, configures Google **Noto** (`Noto Sans`, `Noto Serif`, `Noto Sans Symbols`, `Noto Sans Math`, `Noto Color Emoji`) as the default non-monospace web fonts while keeping **Fira Code** with OpenType ligatures (`calt`, `liga`) for monospace (`code`, `pre`, `kbd`, `samp`, `tt`), enables all HTML5/GStreamer multimedia playback (`MediaSource` / MSE, WebAudio, inline `