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.
This commit is contained in:
Luxferre committed 2026-11-05 14:18:59 +02:00
1 parent 0ab9367e28
commit 5d10b801ff
12 files changed
+187 -1024

No files matched your search

+5
View File
@@ -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 <device> [--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 <rootfs-dir> 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_<name>.lock`, sleeping at 0% CPU on `poll()` over `ConnectionNumber(dpy)` and `/tmp/dwm_plugin_<name>.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`).
+12
View File
@@ -11,6 +11,18 @@ Release versions follow the `<year-letter><MM><DD>` 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`.
+2 -4
View File
@@ -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 `<video>`/`<audio>`, and autoplay without user gesture requirements) by default, and uses `Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0` as the default User-Agent (overridable via `Menu -> User-Agent Override` across 4 presets or a custom multi-tap string persisted in `~/.config/sxmo/webarchy_ua.txt`).
- **Engine, User-Agent, encoding, fonts, and multimedia**: built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-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 `<video>`/`<audio>`, and autoplay without user gesture requirements) by default, and uses `Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0` as the default User-Agent (overridable via `Menu -> User-Agent Override` across 4 presets or a custom multi-tap string persisted in `~/.config/sxmo/webarchy_ua.txt`).
- **Dual navigation modes (`[LNK]` Keypad Link Mode vs `[CUR]` Mouse Cursor Emulation Mode)**:
- **Keypad Link Mode (default)**: `Up` / `Down` scrolls vertically; `4` / `Left` and `6` / `Right` (or customizable Kopher keys in `~/.config/sxmo/smallweb_controls.tsv`) highlight the previous / next interactive element (`<a>`, `<button>`, `<input>`, `<select>`, `<textarea>`, `<video>`, `<audio>`) and display its label/URL in the bottom status bar; `5` / `Center OK` clicks the highlighted element or opens a NeoUI multi-tap text entry modal when an HTML `<input>` or `<textarea>` is selected (`Left softkey` or `Call` submits the form); `1` / `7` scrolls horizontally; `3` / `9` jumps to page top / bottom; `0` reloads; `#` cycles page zoom (`100%` / `85%` / `120%` / `70%`).
- **Mouse Cursor Emulation Mode (optional, off by default — toggle with `*#` chord or `Menu -> Toggle Mouse Cursor`)**: renders an on-screen pointer that moves with acceleration using `D-Pad` or `2`/`4`/`6`/`8` (plus diagonals `1`/`3`/`7`/`9`), automatically scrolls the page when pushed against the viewport edges, updates the bottom status bar with `(x,y)` coordinates and the hovered DOM element, and clicks or opens multi-tap input on `5` / `Center OK`.
@@ -550,11 +550,9 @@ The **Xlibre** display server (`modesetting_drv.so`) uses **Glamor + DRI3 + GLX
DISPLAY=:0 glxinfo -B
DISPLAY=:0 eglinfo -B
```
- **Run 3D OpenGL and OpenGL ES hardware-accelerated demos on the `240x320` display**:
- **Run the 3D OpenGL hardware-accelerated demo on the `240x320` display**:
```bash
DISPLAY=:0 glxgears -info
DISPLAY=:0 glteapot
DISPLAY=:0 es2gears_x11
```
- **Inspect live Adreno 304 GPU hardware state, frequency, and ringbuffer fences**:
```bash
+2 -2
View File
@@ -43,14 +43,14 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs
- **IRCv3 client (`xirc` / `irc.so`)**: multi-server IRC client (`Buffers`, `Chat`, `Servers`) with OpenSSL TLS, IRCv3 capability negotiation (`CAP LS 302`: `sasl`, `server-time`, `message-tags`, `multi-prefix`, `away-notify`, `account-notify`, `chghost`, `cap-notify`), `SASL PLAIN` authentication, slash commands, and resident background mode with highlight vibration alerts.
- **Tox / Trifa P2P messenger and audio call client (`xtox` / `tox.so`)**: encrypted P2P messenger (`Friends`, `Chat`, `My Tox ID`) built on `c-toxcore` (`libtoxcore.so.2`) with DHT + TCP relay bootstrap, friend requests, persistent message history, and `ToxAV` 48 kHz Opus voice calls integrated with `xcallscreen`.
- **Kopher SmallWeb browser (`xkopher` / `kopher` / `xsmallweb` / `smallweb.so`)**: multi-protocol SmallWeb client for **Gopher** (`gopher://`) with optional TLS (`gophers://`), **Gemini** (`gemini://`), **Spartan** (`spartan://`), and **Nex** (`nex://`), featuring WAP-style default keypad controls from [Kopher](https://code.luxferre.top/luxferre/kopher.git), user-adjustable keybindings (`~/.config/sxmo/smallweb_controls.tsv`), 10 bookmarks, and custom homepage support.
- **Webarchy Web browser (`webarchy` / `xwebarchy` / `webarchy.so`)**: full-featured HTML5/CSS3/JS web browser built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0` + `libwpebackend-fdo-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`, WebGL, accelerated 2D canvas, and 512 MB RAM pressure tuning), default KaiOS 4.0 User-Agent (`Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0`) with preset and custom User-Agent override (`~/.config/sxmo/webarchy_ua.txt`), `UTF-8` default encoding fallback, `Noto Sans` / `Noto Serif` (`font-noto` + `font-noto-emoji`) as the default non-monospace browser fonts and `Fira Code` with OpenType ligatures as the monospace font, full GStreamer multimedia (`MediaSource` / MSE, WebAudio, inline HTML5 `<video>`/`<audio>` autoplay without user gesture requirements), unobtrusive bookmarking (`*HTTPS`/`*HTTP` header badge, `*`+`0-9` save / `#`+`0-9` load chords, and bookmark manager), and dual navigation modes (keypad link-stepping mode with NeoUI multi-tap form input by default, plus an optional `*#` accelerated mouse cursor emulation mode).
- **Webarchy Web browser (`webarchy` / `xwebarchy` / `webarchy.so`)**: full-featured HTML5/CSS3/JS web browser built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`, WebGL, accelerated 2D canvas, and 512 MB RAM pressure tuning), default KaiOS 4.0 User-Agent (`Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0`) with preset and custom User-Agent override (`~/.config/sxmo/webarchy_ua.txt`), `UTF-8` default encoding fallback, `Noto Sans` / `Noto Serif` (`font-noto` + `font-noto-emoji`) as the default non-monospace browser fonts and `Fira Code` with OpenType ligatures as the monospace font, full GStreamer multimedia (`MediaSource` / MSE, WebAudio, inline HTML5 `<video>`/`<audio>` autoplay without user gesture requirements), unobtrusive bookmarking (`*HTTPS`/`*HTTP` header badge, `*`+`0-9` save / `#`+`0-9` load chords, and bookmark manager), and dual navigation modes (keypad link-stepping mode with NeoUI multi-tap form input by default, plus an optional `*#` accelerated mouse cursor emulation mode).
- **GPS reception test utility (`bananarchy-gps`) and OpenStreetMap navigator (`xgps` / `xmaps` / `xnav` / `gps.so`)**: CLI GNSS/GPS diagnostic tool (`bananarchy-gps status|enable|disable|nmea|watch`) and 3-tab NeoUI GPS navigator (`1:GPS Status`, `2:OSM Map`, `3:Nav/Search`) with live NMEA/QMI PDS satellite and 3GPP cell telemetry, interactive `240x212` OpenStreetMap slippy-map tile viewer with offline PNG tile cache (`~/.cache/sxmo/osm_tiles/`), Nominatim place search, saved waypoints, and OSRM turn-by-turn route geometry and step navigation.
- **Themes (`xthemes`), wallpapers (`xwallpapers`), and ringtones (`xringtones`)**: installable `.Xresources` color and font themes (`~/.xthemes/*.xth`, 21 preinstalled schemes including `LynxLair.xth`) with live zero-restart reload across the entire UI, `dunst` notification popups (`bananarchy-sync-dunst-theme`), and terminal, alongside dedicated managers for desktop wallpapers and 3-tab call ringtones & notification/SMS alerts (`1:Ringtone`, `2:Notif/SMS`, `3:Settings`, supporting standard audio, tracker modules, and Nokia RTTTL `.nrt`/`.rtttl`/`.rtx`, Ericsson eMelody `.emy`, and IrDA iMelody `.imy` monophonic ringtones via `/usr/bin/bananarchy-melody`, wired into `sxmo_notifs.sh` and `sxmo_hook_notification.sh`) with 3-level vibration control.
### Input, terminal, and developer tools
- **6-mode `fcitx5-t9` keypad input**: press `#` to cycle between `abc`, `Abc`, `ABC`, `Sym` (all 32 ASCII punctuation symbols), `Ctl` (`Ctrl` sequences, arrows, `PageUp`/`PageDown`, `F1`–`F12`), and `123` numeric modes with a fixed bottom candidate bar.
- **First-class Linux terminal (`st`)**: patched with HarfBuzz OpenType ligatures (`Fira Code` as the default system and terminal font), XIM T9 input, and live theme reloading.
- **On-device development, scripting, 3D demos, and gaming**: preinstalled `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `mandoc`, `nano`, `ed`, `sqlite3`, `lua` (`5.5` and `5.4`), `yabasic` (with full `yabasic-doc` manual and HTML documentation), `perl`, `tcl`, the [Janet](https://janet-lang.org/) language and `jpm`, the [Bantam](https://bantam.luxferre.top/) coding agent, `frotz` (interactive fiction), OpenGL / OpenGL ES hardware diagnostics and demos (`glxinfo`, `eglinfo`, `glxgears`, `glteapot`, `es2gears_x11`), standalone X11 keypad games (`Snake`, `Tetris`, and `Scoundrel` roguelike solitaire), a full-featured Gambatte-based Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`) with readjustable keypad controls (`B=8`, `Turbo B=5`, `A=9`, `Turbo A=6`, `D-pad`, `Start=2`, `Select=3`, `Palette=*`), 10 color palettes, save states, and file manager `.gb`/`.gbc` integration, and **ReMEdy (`remedy` / `j2me`)**, a native `240x320` J2ME (MIDP 2.0 / CLDC 1.1) emulator with Adreno 304 hardware-accelerated JSR-184 M3G 3D graphics, NeoUI-themed high-level LCDUI widgets, socket/HTTP networking (`Connector`), `RecordStore` (RMS) persistence, MMAPI audio, readjustable keypad controls, and `.jar`/`.jad` file manager integration.
- **On-device development, scripting, and gaming**: preinstalled `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `mandoc`, `nano`, `ed`, `sqlite3`, `lua` (`5.5` and `5.4`), `yabasic` (with full `yabasic-doc` manual and HTML documentation), `perl`, `tcl`, the [Janet](https://janet-lang.org/) language and `jpm`, the [Bantam](https://bantam.luxferre.top/) coding agent, `frotz` (interactive fiction), OpenGL / OpenGL ES hardware diagnostics (`glxinfo`, `eglinfo`, `glxgears`), standalone X11 keypad games (`Snake`, `Tetris`, and `Scoundrel` roguelike solitaire), a full-featured Gambatte-based Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`) with readjustable keypad controls (`B=8`, `Turbo B=5`, `A=9`, `Turbo A=6`, `D-pad`, `Start=2`, `Select=3`, `Palette=*`), 10 color palettes, save states, and file manager `.gb`/`.gbc` integration, and **ReMEdy (`remedy` / `j2me`)**, a native `240x320` J2ME (MIDP 2.0 / CLDC 1.1) emulator with Adreno 304 hardware-accelerated JSR-184 M3G 3D graphics, NeoUI-themed high-level LCDUI widgets, socket/HTTP networking (`Connector`), `RecordStore` (RMS) persistence, MMAPI audio, readjustable keypad controls, and `.jar`/`.jad` file manager integration.
- **NeoUI `240x320` UI SDK (`libneoui.so` + `/usr/include/neoui.h` + `neoui.yab`) and NeoNet (`neonet.yab`)**: unified C-compatible FFI and C++20 UI SDK wrapping Xlib, Xft, Pango, `libjpeg`/`libpng`, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double buffering, standardized OS shell widgets (headers, tabs, softkey bars, list/toggle/slider rows, input boxes, progress bars, scrollbars, modals, popup menus, and toasts), keypad/softkey chord handling, and multi-tap text entry—usable from C, C++, or Yabasic (`~/Projects/neoui.yab`, `~/Projects/neoui_demo.yab`, and `~/Projects/bulls_cows.yab`), paired with **NeoNet (`~/Projects/neonet.yab` and `~/Projects/neonet_demo.yab`)** for `libcurl`-based HTTP/HTTPS requests with custom headers and TCP/TLS/UDP socket exchange in Yabasic. See [SDK.md](./SDK.md) for full documentation.
---
@@ -1,226 +0,0 @@
# Bananarchy Sxmo 240x320 Native Resolution & Physical Keypad Patch
# Targets: Nokia 8110 4G (nokia-argon), Nokia 2720 Flip (nokia-beatles),
# Nokia 800 Tough (nokia-coconut), Nokia 8000 4G (nokia-sparkler)
#
# Full modified files are tracked in overlay/rootfs/:
# - usr/bin/sxmo_deviceprofile_nokia,{argon,beatles,coconut,sparkler,leo}.sh
# - usr/share/sxmo/appcfg/{sway_template,conky.conf,wofi.config,wofi.css,foot.ini,wob.ini,dunst.conf}
# - usr/share/sxmo/default_hooks/{sxmo_hook_inputhandler.sh,sxmo_hook_start.sh}
# - home/user/.config/sxmo/{profile,sway,conky.conf}
--- a/usr/share/sxmo/appcfg/profile_template 2026-05-10 19:25:12.000000000 +0300
+++ b/overlay/rootfs/home/user/.config/sxmo/profile 2026-10-18 12:06:20.163476428 +0300
@@ -69,3 +69,10 @@
#Set to the default text for a new text message.
export SXMO_DEFAULT_DRAFT="Enter new message here."
+
+export GTK_IM_MODULE=fcitx
+export QT_IM_MODULE=fcitx
+export XMODIFIERS=@im=fcitx
+export SXMO_MENU=wofi
+
+export SXMO_BG_IMG="/usr/share/wallpapers/bananarchy.png"
--- a/usr/share/sxmo/appcfg/i3_template 2026-05-10 19:25:12.000000000 +0300
+++ b/overlay/rootfs/usr/share/sxmo/appcfg/sway_template 2026-10-18 14:06:00.979385569 +0300
@@ -1,9 +1,9 @@
-# Default config for i3
-# configversion: 7fd9eb1f82c8403c974da53df81b9d1e
+# Default config for sway
+# configversion: 076611fe8cc699bcaa01092a8e4481c0
#
-# Copy this to ~/.config/i3/config and edit it to your liking.
+# Copy this to ~/.config/sway/config and edit it to your liking.
#
-# Please see https://i3wm.org/docs/userguide.html for a complete reference!
+# Read `man 5 sway` for a complete reference.
### Variables
#
@@ -17,25 +17,59 @@
# Your preferred terminal emulator
set $term sxmo_terminal.sh
# Your preferred application launcher
-# Note: pass the final command to i3msg so that the resulting window can be opened
+# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
-set $menu dmenu_run
+set $menu bemenu-run
-font pango:Sxmo 11
+font "Sxmo 13"
+xwayland disable
+output * scale 1 bg /usr/share/wallpapers/bananarchy.png fill
+
+exec_always sxmo_swayinitconf.sh
+
+exec_always dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP
mode "menu" {
- # This is slower than remapping the keys using a keymap, but we don't need
- # to know the device names, so use it as a fallback so this functionality
- # keeps working if a deviceprofile doesn't exist.
- bindsym XF86PowerOff exec xdotool type Return
- bindsym XF86AudioRaiseVolume exec xdotool type Up
- bindsym XF86AudioLowerVolume exec xdotool type Down
+ bindsym --locked XF86PowerOff exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym --locked XF86PickupPhone exec sh -c "if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; else wtype -k Return; fi"
+ bindsym --locked XF86KbdLcdMenu1 exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym --locked XF86KbdLcdMenu2 exec sh -c "sxmo_dmenu.sh close; if sxmo_state.sh is_locked; then sxmo_state.sh set unlock; sxmo_wm.sh display on; fi"
+ bindsym XF86AudioRaiseVolume exec wtype -k Up
+ bindsym XF86AudioLowerVolume exec wtype -k Down
+ bindswitch --locked lid:on exec sh -c "sxmo_dmenu.sh close; brightnessctl -d white:kbd_backlight set 0; sxmo_state.sh set screenoff"
+ bindswitch --locked lid:off exec sh -c "brightnessctl -d white:kbd_backlight set 255; sxmo_state.sh set unlock; sxmo_wm.sh display on"
+}
+
+# Mode specifically for use with Nokia N900 hardware keyboard
+mode "N900" {
+ # follow the standard sxmo keybinds as far as possible
+ bindsym t exec $term; mode "default"
+ bindsym q mode "default"
+ bindsym Shift+p exec sxmo_appmenu.sh sys; mode "default"
+ bindsym p exec sxmo_appmenu.sh; mode "default"
+ bindsym d exec $menu; mode "default"
+ bindsym Shift+q kill; mode "default"
+ bindsym i exec sxmo_wmmenu.sh windowswitcher; mode "default"
+ bindsym Shift+c reload; mode "default"
+ bindsym f fullscreen; mode "default"
+ bindsym Shift+space floating toggle; mode "default"
+ bindsym a focus parent; mode "default"
}
### Key bindings
#
# Basics:
#
+ input * xkb_options compose:ralt
+
+ # Nokia N900 hardware keyboard
+ input "1:1:TWL4030_Keypad" {
+ xkb_model "nokiarx51"
+ xkb_layout "us"
+ # ralt has special meaning on N900 keyboard so do not use as
+ # compose key
+ xkb_options compose:rwin
+ }
# Start a terminal
bindsym $mod+Return exec $term
@@ -58,13 +92,13 @@
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
- floating_modifier $mod
+ floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
- # Exit i3 (logs you out of your i3 session)
- bindsym $mod+Shift+e exec i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your i3 session.' -b 'Yes, exit i3' 'i3-msg exit'
+ # Exit sway (logs you out of your Wayland session)
+ bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'sxmo_power.sh logout'
#
# Moving around:
#
@@ -157,7 +191,7 @@
#
# Scratchpad:
#
- # i3 has a "scratchpad", which is a bag of holding for windows.
+ # Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
@@ -194,48 +228,68 @@
#
# Status Bar:
#
-# Read `man 5 i3bar` for more information about this section.
+# Read `man 5 sway-bar` for more information about this section.
bar {
position top
+ height 24
+ font "Sxmo 13"
- # When the status_command prints a new line to stdout, i3bar updates.
+ # When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
- status_command sxmo_status_watch.sh -o plain
- font pango:Sxmo 11
+ status_command sxmo_status_watch.sh -o pango
- padding 0 20px 8px 8px
+ pango_markup enabled
colors {
statusline #ffffff
background #323232
inactive_workspace #323232 #323232 #ffffff
-
+ font "Sxmo 13"
}
}
-for_window [class="pinentry-.*"] floating enable
-for_window [class="st" title=".*sxmo/modem/.*/draft.txt.*"] resize set height 25
-for_window [class="megapixels"] inhibit_idle open
-for_window [class="ep[yr].*"] inhibit_idle visible
-for_window [class="tabbed"] border pixel 0
-no_focus [class="svkbd"]
-
-smart_gaps on
+for_window [app_id="pinentry-.*"] floating true
+for_window [app_id="foot" title=".*sxmo/modem/.*/draft.txt.*"] resize set height 25
+for_window [title="megapixels"] inhibit_idle open
+for_window [title="ep[yr].*"] inhibit_idle visible
+
+default_border pixel 2
+titlebar_border_thickness 2
+hide_edge_borders smart
# Need playerctl installed and running
-bindsym XF86AudioPlay exec playerctl play-pause
-bindsym XF86AudioPause exec playerctl play-pause
-bindsym XF86AudioStop exec playerctl stop
-bindsym XF86AudioNext exec playerctl next
-bindsym XF86AudioPrev exec playerctl previous
-
-bindsym XF86MonBrightnessUp exec sxmo_brightness.sh up
-bindsym XF86MonBrightnessDown exec sxmo_brightness.sh down
+bindsym --locked XF86AudioPlay exec playerctl play-pause
+bindsym --locked XF86AudioPause exec playerctl play-pause
+bindsym --locked XF86AudioStop exec playerctl stop
+bindsym --locked XF86AudioNext exec playerctl next
+bindsym --locked XF86AudioPrev exec playerctl previous
+
+bindsym --locked XF86MonBrightnessUp exec sxmo_brightness.sh up
+bindsym --locked XF86MonBrightnessDown exec sxmo_brightness.sh down
+
+# Nokia N900-specific key bindings:
+# 1. Bind lock key (XF86ScreenSaver)
+# Use keycode due to https://github.com/swaywm/sway/issues/8438
+bindcode --release --locked --input-device="1:1:gpio_keys" 160 exec sxmo_state.sh set unlock
+# 2. Workaround the lack of a free ModX key on hardware keyboard
+bindsym --input-device="1:1:TWL4030_Keypad" Shift+space mode "N900"
bindsym Print exec sxmo_screenshot.sh
bindsym button2 kill
-exec i3 --get-socketpath > "$XDG_RUNTIME_DIR"/sxmo.i3sock
+bindswitch --locked lid:on exec sh -c "brightnessctl -d white:kbd_backlight set 0; sxmo_state.sh set screenoff"
+bindswitch --locked lid:off exec sh -c "brightnessctl -d white:kbd_backlight set 255; sxmo_state.sh set unlock; sxmo_wm.sh display on"
+
+# Nokia 8110 4G hardware keypad bindings (User:Ybon)
+bindsym --locked --no-repeat XF86KbdLcdMenu1 exec sxmo_hook_inputhandler.sh menuleft_one
+bindsym --locked --no-repeat XF86KbdLcdMenu2 exec sxmo_hook_inputhandler.sh menuright_one
+bindsym --locked --no-repeat XF86PickupPhone exec sxmo_hook_inputhandler.sh enter_one
+
+include /etc/sway/config.d/*
+
+exec 'printf %s "$SWAYSOCK" > "$XDG_RUNTIME_DIR"/sxmo.swaysock'
+
+exec sxmo_hook_start.sh
-# vim: ft=i3config
+# vim: ft=swayconfig
+27
View File
@@ -162,6 +162,19 @@ EOF
BOOT_UUID="a1b2c3d4-8110-4000-8000-000000000001"
ROOT_UUID="a1b2c3d4-8110-4000-8000-000000000002"
# Build-only residue: apk index caches, apk transaction logs, and gettext
# trees (the X11 session forces LANG/LC_ALL=C.UTF-8). apk re-fetches
# indexes on demand on the device. Safe to call more than once.
strip_build_residue() {
rm -rf "$ROOTFS/var/cache/apk" 2>/dev/null || true
mkdir -p "$ROOTFS/var/cache/apk"
rm -f "$ROOTFS/var/log"/apk.log* 2>/dev/null || true
if [ -d "$ROOTFS/usr/share/locale" ]; then
find "$ROOTFS/usr/share/locale" -mindepth 1 -maxdepth 1 \
-exec rm -rf {} + 2>/dev/null || true
fi
}
echo "============================================================"
echo "Building Bananarchy Linux $BANANARCHY_VERSION (Sxmo 240x320) for: $TARGET_DEVICE"
echo "Source rootfs: $ROOTFS"
@@ -224,6 +237,10 @@ EOF
fi
done
# Retired world entries must go first: apk cannot install C sudo while the
# Rust sudo-rs still owns cmd:sudo in world.
/bananarchy/scripts/prune-rootfs-packages.sh "$ROOTFS" world
if [ -n "$MISSING_PKGS" ]; then
echo " -> Installing missing dependencies into $ROOTFS:$MISSING_PKGS"
# shellcheck disable=SC2086
@@ -237,6 +254,9 @@ EOF
ln -sf lua5.5 "$ROOTFS/usr/bin/lua"
ln -sf luac5.5 "$ROOTFS/usr/bin/luac"
/bananarchy/scripts/prune-rootfs-packages.sh "$ROOTFS" purge
strip_build_residue
echo "[1/5] Normalizing rootfs permissions and UIDs/GIDs..."
chown -R 0:0 "$ROOTFS"
chmod 755 "$ROOTFS" 2>/dev/null || true
@@ -365,6 +385,13 @@ EOF
fi
echo "[3/5] Creating ext2 boot (256 MiB) and ext4 root filesystems..."
strip_build_residue
APK_CACHE_LEFT="$(ls -A "$ROOTFS/var/cache/apk" 2>/dev/null || true)"
APK_LOGS_LEFT="$(ls "$ROOTFS/var/log"/apk.log* 2>/dev/null || true)"
if [ -n "$APK_CACHE_LEFT" ] || [ -n "$APK_LOGS_LEFT" ]; then
echo "Error: apk cache/log still present in target rootfs" >&2
exit 1
fi
BOOT_IMG="/tmp/boot.ext2"
ROOT_IMG="/tmp/root.ext4"
rm -f "$BOOT_IMG" "$ROOT_IMG"
+5
View File
@@ -37,6 +37,9 @@ apk add --no-cache python3 kmod openssl >/dev/null
echo "[3/8] Installing the Bananarchy armv7 package set..."
PKGS="$(grep -v '^[[:space:]]*#' "$PKGS_FILE" | grep -v '^[[:space:]]*$' | tr '\n' ' ')"
# Retired world entries must go first: apk cannot install C sudo while the
# Rust sudo-rs still owns cmd:sudo in world.
"$REPO/scripts/prune-rootfs-packages.sh" "$ROOTFS" world
if [ ! -f "$ROOTFS/lib/apk/db/installed" ]; then
# shellcheck disable=SC2086
apk --root "$ROOTFS" --arch armv7 add --initdb --no-scripts $PKGS >/dev/null
@@ -48,6 +51,8 @@ fi
ln -sf lua5.5 "$ROOTFS/usr/bin/lua"
ln -sf luac5.5 "$ROOTFS/usr/bin/luac"
"$REPO/scripts/prune-rootfs-packages.sh" "$ROOTFS" purge
echo "[4/8] Creating system accounts and default credentials..."
PW_HASH="$(openssl passwd -6 -salt bananarchy "$PASSWORD")"
python3 - "$ROOTFS" "$PW_HASH" <<'PYEOF'
+37 -1
View File
@@ -41,15 +41,51 @@ PYEOF
echo "[check] Rootfs package list..."
PKGS_FILE="$BASE_DIR/scripts/rootfs-packages.txt"
PRUNE_FILE="$BASE_DIR/scripts/rootfs-prune-packages.txt"
if [ ! -f "$PKGS_FILE" ]; then
fail "missing $PKGS_FILE"
else
PKG_COUNT="$(grep -v '^[[:space:]]*#' "$PKGS_FILE" | grep -cv '^[[:space:]]*$' || true)"
if [ "$PKG_COUNT" -lt 100 ]; then
if [ "$PKG_COUNT" -lt 80 ]; then
fail "package list has only $PKG_COUNT entries"
else
echo " $PKG_COUNT packages"
fi
for pkg in alpine-base postmarketos-ui-sxmo-de-dwm webkit2gtk-4.1 libwpe \
sudo imv-x11 fcitx5-gtk3 mesa-utils sfeed; do
if ! grep -Fxq "$pkg" "$PKGS_FILE"; then
fail "missing critical package: $pkg"
fi
done
# Pure X11 and Rust-free top-level package set.
for pkg in sudo-rs postmarketos-base-sudo-rs libwpebackend-fdo imv-wayland \
xwayland sxmo-utils-wayland wofi grim slurp; do
if grep -Fxq "$pkg" "$PKGS_FILE"; then
fail "forbidden Rust/Wayland package in package list: $pkg"
fi
done
fi
echo "[check] Rootfs prune list..."
if [ ! -f "$PRUNE_FILE" ]; then
fail "missing $PRUNE_FILE"
else
PRUNE_COUNT="$(grep -v '^[[:space:]]*#' "$PRUNE_FILE" | grep -cv '^[[:space:]]*$' || true)"
echo " $PRUNE_COUNT prune entries"
for pkg in sudo-rs libwpebackend-fdo imv-wayland; do
if ! grep -Fxq "$pkg" "$PRUNE_FILE"; then
fail "missing prune entry: $pkg"
fi
done
fi
if [ ! -x "$BASE_DIR/scripts/prune-rootfs-packages.sh" ]; then
fail "missing or non-executable scripts/prune-rootfs-packages.sh"
fi
echo "[check] Image residue guard..."
if ! grep -q 'strip_build_residue' "$BASE_DIR/rebuild-image.sh" || \
! grep -q 'apk cache/log still present' "$BASE_DIR/rebuild-image.sh"; then
fail "rebuild-image.sh is missing the apk cache/log guard"
fi
echo "[check] Vendored EDL client library..."
-784
View File
@@ -1,784 +0,0 @@
#!/bin/sh
# Legacy pmbootstrap-era rootfs configurator (Wayland/Sway based).
# Superseded by scripts/bootstrap-rootfs.sh, which builds a complete X11
# rootfs from scratch. Kept only for historical reference; do not use it for
# new builds.
set -eu
BANANARCHY_DIR="${BANANARCHY_DIR:-/bananarchy}"
WORK="${WORK:-/work}"
echo "[1/4] Installing lightweight host helper tools in container..."
cat > /etc/apk/repositories <<EOF
https://mirror.nura.eco/postmarketos/v26.06
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing
EOF
if [ -d "$BANANARCHY_DIR/keys" ]; then
cp "$BANANARCHY_DIR/keys/"* /etc/apk/keys/
elif [ -d "$WORK/pmbootstrap/pmb/data/keys" ]; then
cp "$WORK/pmbootstrap/pmb/data/keys/"* /etc/apk/keys/
fi
apk add --no-cache \
busybox-static \
busybox-extras \
dbus \
ca-certificates \
fontconfig \
glib \
gtk+3.0 \
gdk-pixbuf \
librsvg \
shared-mime-info \
desktop-file-utils \
gtk-update-icon-cache \
kmod \
eudev \
postmarketos-mkinitfs \
boot-deploy \
mkbootimg \
devicepkg-utils \
e2fsprogs \
e2fsprogs-extra \
util-linux \
sfdisk \
android-tools \
python3 \
zstd \
file
configure_common_rootfs() {
ROOTFS="$1"
UI_TYPE="$2"
BOOT_UUID="$3"
ROOT_UUID="$4"
echo "=== Configuring $ROOTFS ($UI_TYPE) ==="
cp /etc/apk/repositories "$ROOTFS/etc/apk/repositories"
echo " -> Ensuring fcitx5-gtk3 and Bananarchy development/scripting/privacy/multimedia packages are installed in $ROOTFS..."
apk --root "$ROOTFS" --arch armv7 add --no-scripts \
bash \
fcitx5 \
fcitx5-gtk3 \
font-fira-code \
font-noto \
font-noto-emoji \
git \
gcc \
g++ \
musl-dev \
make \
mandoc \
coreutils \
bc \
ed \
rlwrap \
less \
nano \
frotz \
janet \
janet-dev \
jpm \
lua5.4 \
lua5.4-dev \
lua5.5 \
lua5.5-dev \
yabasic \
yabasic-doc \
perl \
perl-io-socket-ssl \
tcl \
tcl-lib \
tcl-tls \
sqlite \
sqlite-tcl \
tor \
openvpn \
wireguard-tools \
wireguard-tools-wg \
wireguard-tools-wg-quick \
iptables \
ip6tables \
iproute2 \
webkit2gtk-4.1 \
libwpe \
libwpebackend-fdo \
gst-plugins-good \
gst-plugins-bad \
gst-libav \
mesa-demos \
mesa-utils \
scrot \
modemmanager \
modemmanager-udev \
mobile-broadband-provider-info \
postmarketos-base-ui-modemmanager \
postmarketos-base-ui-modemmanager-openrc \
i2c-tools \
v4l-utils
ln -sf lua5.5 "$ROOTFS/usr/bin/lua"
ln -sf luac5.5 "$ROOTFS/usr/bin/luac"
echo " -> Installing busybox and busybox-extras symlinks..."
for applet in $(/bin/busybox --list-full); do
target="$ROOTFS/$applet"
mkdir -p "$(dirname "$target")"
if [ ! -e "$target" ] && [ ! -L "$target" ]; then
ln -s /bin/busybox "$target"
fi
done
if [ -x /bin/busybox-extras ]; then
for applet in $(/bin/busybox-extras --list-full); do
target="$ROOTFS/$applet"
mkdir -p "$(dirname "$target")"
if [ ! -e "$target" ] && [ ! -L "$target" ]; then
ln -s /bin/busybox-extras "$target"
fi
done
fi
if [ -e "$ROOTFS/sbin/losetup" ] && [ ! -e "$ROOTFS/usr/sbin/losetup" ]; then
ln -sf /sbin/losetup "$ROOTFS/usr/sbin/losetup"
fi
echo " -> Setting up temporary x86_64 hostbin for chroot execution..."
rm -rf "$ROOTFS/tmp/hostbin"
mkdir -p "$ROOTFS/tmp/hostbin"
cp /bin/busybox.static "$ROOTFS/tmp/hostbin/busybox.static"
for app in $(/bin/busybox.static --list); do
ln -sf /tmp/hostbin/busybox.static "$ROOTFS/tmp/hostbin/$app"
done
for bin in \
/sbin/depmod \
/usr/sbin/mkinitfs \
/usr/bin/boot-deploy \
/usr/bin/generate-kernel-cmdline \
/usr/bin/mkbootimg \
/usr/bin/mkbootimg-osm0sis \
/usr/bin/zstd; do
if [ -e "$bin" ]; then
cp -L "$bin" "$ROOTFS/tmp/hostbin/"
fi
done
rm -f "$ROOTFS/tmp/hostbin/df"
cat > "$ROOTFS/tmp/hostbin/df" <<'EOF'
#!/tmp/hostbin/sh
printf "Filesystem 1024-blocks Used Available Capacity Mounted on\n/dev/root 52428800 5242880 47185920 10%% /\n"
EOF
chmod +x "$ROOTFS/tmp/hostbin/df"
mkdir -p "$ROOTFS/proc/1/root"
cp /lib/ld-musl-x86_64.so.1 "$ROOTFS/lib/"
cp -a /usr/lib/libgcc_s.so* "$ROOTFS/tmp/hostbin/" 2>/dev/null || true
cp -a /lib/libz.so* /usr/lib/libzstd.so* /usr/lib/liblzma.so* /lib/libcrypto.so* "$ROOTFS/tmp/hostbin/" 2>/dev/null || true
ln -sf /tmp/hostbin/busybox.static "$ROOTFS/bin/sh"
echo " -> Creating system groups, users, and default user (UID 10000)..."
chroot "$ROOTFS" /tmp/hostbin/busybox.static sh -e -c '
export PATH="/tmp/hostbin:/usr/sbin:/usr/bin:/sbin:/bin"
export LD_LIBRARY_PATH="/tmp/hostbin:/lib:/usr/lib"
addgroup -S -g 42 shadow 2>/dev/null || true
chown root:shadow /etc/shadow
[ -e /etc/shadow- ] && chown root:shadow /etc/shadow-
addgroup -S -g 86 avahi 2>/dev/null || true
adduser -S -u 86 -D -H -h /dev/null -s /sbin/nologin -G avahi -g "Avahi System User" avahi 2>/dev/null || true
addgroup -S klogd 2>/dev/null || true
adduser -S -D -H -h /dev/null -s /sbin/nologin -G klogd -g klogd klogd 2>/dev/null || true
addgroup -S chrony 2>/dev/null || true
adduser -S -D -H -h /dev/null -s /sbin/nologin -G chrony -g chrony chrony 2>/dev/null || true
addgroup -S messagebus 2>/dev/null || true
adduser -S -D -H -h /dev/null -s /sbin/nologin -G messagebus -g messagebus messagebus 2>/dev/null || true
addgroup -S dnsmasq 2>/dev/null || true
adduser -S -D -H -h /dev/null -s /sbin/nologin -G dnsmasq -g dnsmasq dnsmasq 2>/dev/null || true
addgroup -S geoclue 2>/dev/null || true
adduser -S -D -h /var/lib/geoclue -s /sbin/nologin -G geoclue geoclue 2>/dev/null || true
addgroup -S plugdev 2>/dev/null || true
addgroup -S pipewire 2>/dev/null || true
addgroup -S seat 2>/dev/null || true
addgroup -S feedbackd 2>/dev/null || true
addgroup -S polkitd 2>/dev/null || true
adduser -S -D -H -h /var/empty -s /sbin/nologin -G polkitd -g polkitd polkitd 2>/dev/null || true
addgroup -S colord 2>/dev/null || true
adduser -S -D -H -h /var/lib/colord -s /sbin/nologin -G colord -g colord colord 2>/dev/null || true
addgroup -S greetd 2>/dev/null || true
adduser -S -D -H -h /var/lib/greetd -s /sbin/nologin -G greetd -g greetd greetd 2>/dev/null || true
addgroup greetd video 2>/dev/null || true
if ! grep -q "^user:" /etc/passwd 2>/dev/null; then
adduser -D -u 10000 -s /bin/ash user 2>/dev/null || true
fi
for grp in audio input netdev plugdev video wheel seat feedbackd dialout tty pipewire; do
addgroup -S "$grp" 2>/dev/null || true
addgroup user "$grp" 2>/dev/null || true
done
echo "user:147147" | chpasswd
passwd -l root >/dev/null 2>&1 || true
'
echo " -> Configuring sudo/doas, hostname, locale, timezone, inittab, and sysctl..."
mkdir -p "$ROOTFS/etc/doas.d" "$ROOTFS/etc/sudoers.d"
rm -f "$ROOTFS/etc/doas.d/wheel.conf"
cat > "$ROOTFS/etc/sudoers.d/wheel" <<EOF
%wheel ALL=(ALL:ALL) ALL
EOF
chmod 440 "$ROOTFS/etc/sudoers.d/wheel"
echo "nokia-argon" > "$ROOTFS/etc/hostname"
cat > "$ROOTFS/etc/hosts" <<EOF
127.0.0.1 nokia-argon localhost.localdomain localhost
::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
EOF
echo "LANG=C.UTF-8" > "$ROOTFS/etc/locale.conf"
if [ -f "$ROOTFS/usr/share/zoneinfo/UTC" ]; then
cp "$ROOTFS/usr/share/zoneinfo/UTC" "$ROOTFS/etc/localtime"
echo "UTC" > "$ROOTFS/etc/timezone"
fi
touch "$ROOTFS/etc/apk/interactive"
mkdir -p "$ROOTFS/run/openrc"
touch "$ROOTFS/run/openrc/shutdowntime"
dbus-uuidgen --ensure="$ROOTFS/etc/machine-id"
for mod in panel_mipi_dbi leds_msm8905_torch msm8905-cam; do
if ! grep -qx "$mod" "$ROOTFS/etc/modules" 2>/dev/null; then
echo "$mod" >> "$ROOTFS/etc/modules"
fi
done
mkdir -p "$ROOTFS/etc/udev/rules.d"
cat > "$ROOTFS/etc/udev/rules.d/90-nokia-argon-leds.rules" <<EOF
SUBSYSTEM=="leds", ACTION=="add", RUN+="/bin/chgrp video /sys/class/leds/%k/brightness", RUN+="/bin/chmod 0664 /sys/class/leds/%k/brightness"
SUBSYSTEM=="backlight", ACTION=="add", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness", RUN+="/bin/chmod 0664 /sys/class/backlight/%k/brightness"
EOF
mkdir -p "$ROOTFS/etc/sysctl.d"
cat > "$ROOTFS/etc/sysctl.d/90-nokia-argon-lowram.conf" <<EOF
vm.swappiness = 180
vm.page-cluster = 0
vm.vfs_cache_pressure = 150
vm.min_free_kbytes = 16384
EOF
echo " -> Installing patched audio DTB, QDSP6/torch/camera kernel modules, UCM, and WirePlumber S16LE rules..."
cp "$BANANARCHY_DIR/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-argon.dtb" \
"$ROOTFS/boot/dtbs/qcom-msm8905-nokia-argon.dtb"
cp "$BANANARCHY_DIR/prebuilt/kernel-6.12.1-msm8916/qdsp6/"*.ko* \
"$ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6/"
mkdir -p "$ROOTFS/lib/modules/6.12.1-msm8916/extra"
cp "$BANANARCHY_DIR/prebuilt/kernel-6.12.1-msm8916/leds/"*.ko* \
"$ROOTFS/lib/modules/6.12.1-msm8916/extra/" 2>/dev/null || true
cp "$BANANARCHY_DIR/prebuilt/kernel-6.12.1-msm8916/camera/"*.ko* \
"$ROOTFS/lib/modules/6.12.1-msm8916/extra/" 2>/dev/null || true
depmod -b "$ROOTFS" 6.12.1-msm8916
sed -i 's/"CS-Voice"/"VoiceMMode1"/g' \
"$ROOTFS/usr/share/alsa/ucm2/platforms/msm8916/qdsp6.conf"
mkdir -p \
"$ROOTFS/usr/share/wireplumber/wireplumber.conf.d" \
"$ROOTFS/etc/wireplumber/wireplumber.conf.d" \
"$ROOTFS/etc/skel/.config/wireplumber/wireplumber.conf.d" \
"$ROOTFS/home/user/.config/wireplumber/wireplumber.conf.d"
cat > "$ROOTFS/usr/share/wireplumber/wireplumber.conf.d/msm8916-s16le.conf" <<EOF
monitor.alsa.rules = [
{
matches = [
{
device.name = "alsa_card.comprC0"
}
]
actions = {
update-props = {
device.disabled = true
}
}
},
{
matches = [
{
node.name = "~alsa_output.platform-7702000.*"
},
{
node.name = "~alsa_output.platform-sound.*"
},
{
node.name = "~alsa_input.platform-7702000.*"
},
{
node.name = "~alsa_input.platform-sound.*"
}
]
actions = {
update-props = {
audio.format = "S16LE"
}
}
}
]
EOF
cp "$ROOTFS/usr/share/wireplumber/wireplumber.conf.d/msm8916-s16le.conf" \
"$ROOTFS/etc/wireplumber/wireplumber.conf.d/msm8916-s16le.conf"
cp "$ROOTFS/usr/share/wireplumber/wireplumber.conf.d/msm8916-s16le.conf" \
"$ROOTFS/etc/skel/.config/wireplumber/wireplumber.conf.d/msm8916-s16le.conf"
cp "$ROOTFS/usr/share/wireplumber/wireplumber.conf.d/msm8916-s16le.conf" \
"$ROOTFS/home/user/.config/wireplumber/wireplumber.conf.d/msm8916-s16le.conf"
echo " -> Installing fcitx5-t9 addon and T9 profile..."
cp -a "$BANANARCHY_DIR/prebuilt/fcitx5-t9/usr/"* "$ROOTFS/usr/"
mkdir -p \
"$ROOTFS/usr/share/superd/services" \
"$ROOTFS/etc/skel/.config/superd/services/enabled" \
"$ROOTFS/home/user/.config/superd/services/enabled" \
"$ROOTFS/etc/skel/.config/fcitx5" \
"$ROOTFS/home/user/.config/fcitx5"
cat > "$ROOTFS/usr/share/superd/services/fcitx5.service" <<EOF
[Unit]
Description=fcitx5 input support
[Service]
Type=simple
ExecStart=/usr/bin/fcitx5
Restart=always
EOF
ln -sf /usr/share/superd/services/fcitx5.service \
"$ROOTFS/etc/skel/.config/superd/services/enabled/fcitx5.service"
ln -sf /usr/share/superd/services/fcitx5.service \
"$ROOTFS/home/user/.config/superd/services/enabled/fcitx5.service"
cat > "$ROOTFS/etc/skel/.config/fcitx5/profile" <<EOF
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=t9
[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=
[Groups/0/Items/1]
# Name
Name=t9
# Layout
Layout=
[GroupOrder]
0=Default
EOF
cp "$ROOTFS/etc/skel/.config/fcitx5/profile" "$ROOTFS/home/user/.config/fcitx5/profile"
cat > "$ROOTFS/etc/profile.d/fcitx5-t9.sh" <<'EOF'
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export SXMO_MENU=wofi
export SXMO_BEMENU_PORTRAIT_LINES=11
export SXMO_BEMENU_LANDSCAPE_LINES=8
export BEMENU_OPTS='--fn "Sxmo 11.5" -H 24 -B 2 --hp 4 -s --no-overlap --fixed-height --scrollbar none --cw 2 --bdr "#005577" --tb "#383838" --tf "#aaaaaa" --fb "#383838" --ff "#ffffff" --cb "#ffffff" --cf "#383838" --nb "#1c1c1c" --nf "#ffffff" --ab "#1c1c1c" --af "#ffffff" --hb "#005577" --hf "#ffffff" -w -i'
EOF
chmod 755 "$ROOTFS/etc/profile.d/fcitx5-t9.sh"
if ! grep -q "GTK_IM_MODULE=fcitx" "$ROOTFS/etc/skel/.profile" 2>/dev/null; then
cat >> "$ROOTFS/etc/skel/.profile" <<'EOF'
export PATH="$HOME/.local/bin:$PATH"
export WLR_RENDERER=pixman
export WLR_NO_HARDWARE_CURSORS=1
export SXMO_DISABLE_LEDS=1
export SXMO_NO_VIRTUAL_KEYBOARD=1
export NO_AT_BRIDGE=1
export GTK_A11Y=none
export GTK_USE_PORTAL=0
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export SXMO_MENU=wofi
export SXMO_BEMENU_PORTRAIT_LINES=11
export SXMO_BEMENU_LANDSCAPE_LINES=8
export BEMENU_OPTS='--fn "Sxmo 11.5" -H 24 -B 2 --hp 4 -s --no-overlap --fixed-height --scrollbar none --cw 2 --bdr "#005577" --tb "#383838" --tf "#aaaaaa" --fb "#383838" --ff "#ffffff" --cb "#ffffff" --cf "#383838" --nb "#1c1c1c" --nf "#ffffff" --ab "#1c1c1c" --af "#ffffff" --hb "#005577" --hf "#ffffff" -w -i'
EOF
fi
cp "$ROOTFS/etc/skel/.profile" "$ROOTFS/home/user/.profile"
echo " -> Enabling OpenRC runlevel services..."
mkdir -p \
"$ROOTFS/etc/runlevels/sysinit" \
"$ROOTFS/etc/runlevels/boot" \
"$ROOTFS/etc/runlevels/default" \
"$ROOTFS/etc/runlevels/shutdown"
rm -f "$ROOTFS/etc/runlevels/boot/hwclock"
for svc in devfs dmesg msm-firmware-loader udev udev-trigger udev-settle; do
if [ -e "$ROOTFS/etc/init.d/$svc" ]; then
ln -sf "/etc/init.d/$svc" "$ROOTFS/etc/runlevels/sysinit/$svc"
fi
done
for svc in osclock swclock-offset-boot modules sysctl hostname bootmisc logbookd tmpfs msm-firmware-loader-unpack; do
if [ -e "$ROOTFS/etc/init.d/$svc" ]; then
ln -sf "/etc/init.d/$svc" "$ROOTFS/etc/runlevels/boot/$svc"
fi
done
for svc in \
udev-postmount \
rmtfs \
msm-modem-uim-selection \
msm8909-modem-wwan-port \
q6voiced \
modemmanager \
networkmanager \
wpa_supplicant \
bluetooth \
dbus \
cgroups \
haveged \
chronyd \
rfkill \
sleep-inhibitor \
sshd \
swapfile \
local \
postmarketos-zram-swap \
nftables \
iio-sensor-proxy \
hkdm \
kill-plymouth; do
if [ -e "$ROOTFS/etc/init.d/$svc" ]; then
ln -sf "/etc/init.d/$svc" "$ROOTFS/etc/runlevels/default/$svc"
fi
done
for svc in mount-ro killprocs savecache swclock-offset-shutdown; do
if [ -e "$ROOTFS/etc/init.d/$svc" ]; then
ln -sf "/etc/init.d/$svc" "$ROOTFS/etc/runlevels/shutdown/$svc"
fi
done
if [ "$UI_TYPE" = "sxmo" ]; then
echo " -> Applying Sxmo UI & User:Ybon keypad/RAM/display tweaks..."
for svc in seatd tinydm; do
if [ -e "$ROOTFS/etc/init.d/$svc" ]; then
ln -sf "/etc/init.d/$svc" "$ROOTFS/etc/runlevels/default/$svc"
fi
done
mkdir -p "$ROOTFS/var/lib/tinydm"
ln -sf /usr/share/wayland-sessions/swmo.desktop "$ROOTFS/var/lib/tinydm/default-session.desktop"
cat > "$ROOTFS/usr/bin/sxmo_deviceprofile_nokia,argon.sh" <<EOF
#!/bin/sh
export SXMO_WM=sway
export SXMO_ROTATION=normal
# Scaling factor for 240x320 QVGA screen
export SXMO_SWAY_SCALE=0.7
# Physical button mappings as determined via evtest
export SXMO_POWER_BUTTON="0:0:pm8916_pon"
export SXMO_VOLUME_UP_BUTTON="0:103:KEY_UP"
export SXMO_VOLUME_DOWN_BUTTON="0:108:KEY_DOWN"
export SXMO_MENU_LEFT_BUTTON="0:139:KEY_MENU"
export SXMO_MENU_RIGHT_BUTTON="0:158:KEY_BACK"
export SXMO_ENTER_BUTTON="0:352:KEY_OK"
# Nokia 8110 4G has a physical keypad and no touchscreen
export SXMO_NO_VIRTUAL_KEYBOARD=1
export SXMO_DISABLE_LEDS=1
export KEYBOARD_ARGS="-H 1 -L 1"
export WLR_RENDERER=pixman
export WLR_NO_HARDWARE_CURSORS=1
export NO_AT_BRIDGE=1
export GTK_A11Y=none
export GTK_USE_PORTAL=0
export SXMO_MENU=wofi
export SXMO_BEMENU_PORTRAIT_LINES=11
export SXMO_BEMENU_LANDSCAPE_LINES=8
EOF
chmod 755 "$ROOTFS/usr/bin/sxmo_deviceprofile_nokia,argon.sh"
cat > "$ROOTFS/usr/bin/sxmo_inputhandler.sh" <<'EOF'
#!/bin/sh
exec sxmo_hook_inputhandler.sh "$@"
EOF
chmod 755 "$ROOTFS/usr/bin/sxmo_inputhandler.sh"
sed -i 's|--input-device="$pwr" ||g' "$ROOTFS/usr/bin/sxmo_swayinitconf.sh"
if ! grep -q "superctl start fcitx5" "$ROOTFS/usr/share/sxmo/default_hooks/sxmo_hook_start.sh"; then
sed -i 's|superctl start bonsaid|[ "$(command -v bonsaid)" ] \&\& superctl start bonsaid\n\t\t[ "$(command -v fcitx5)" ] \&\& superctl start fcitx5|' \
"$ROOTFS/usr/share/sxmo/default_hooks/sxmo_hook_start.sh"
fi
mkdir -p "$ROOTFS/etc/skel/.cache/sxmo" "$ROOTFS/home/user/.cache/sxmo"
touch "$ROOTFS/etc/skel/.cache/sxmo/sxmo.nogesture" "$ROOTFS/home/user/.cache/sxmo/sxmo.nogesture"
cat > "$ROOTFS/usr/share/sxmo/appcfg/wofi.config" <<EOF
# Space to setup configversion
# configversion: eb37989d3b93bf46e0df32db4ffd833e
matching=multi-contains
width=240
height=320
halign=fill
orientation=vertical
content_halign=fill
insensitive=true
prompt=
show=dmenu
no_actions=true
EOF
cat > "$ROOTFS/usr/share/sxmo/appcfg/wofi.css" <<EOF
/* Space to setup configversion */
/* configversion: 2ecca20b604bc0b37d13aba5a0fabc07 */
* {
font-family: monospace;
font-size: 12px;
}
window {
margin: 0px;
border: 1px solid #005577;
background-color: #222222;
}
#input {
margin: 0px;
border-radius: 0px;
border: 1px solid #005577;
background-color: #444444;
color: white;
}
#inner-box {
margin: 0px;
}
#outer-box {
margin: 1px;
}
#scroll {
margin: 0px;
color: yellow;
}
#text {
margin: 1px;
color: white;
}
#entry {
padding: 0;
margin: 0;
}
#entry:selected {
background-color: #005577;
}
EOF
cat > "$ROOTFS/usr/share/sxmo/appcfg/conky.conf" <<EOF
-- Space to setup configversion
-- configversion: 19ec5c7f9e83bc6534d657f6180feba2
conky.config = {
out_to_x = false,
out_to_wayland = true,
alignment = 'middle_middle',
own_window_argb_value = 0,
own_window_type = 'desktop',
default_shade_color = 'grey',
draw_shades = true,
font = 'Sxmo:size=11',
use_xft = true,
update_interval = 15,
}
conky.text = [[
\${alignc}\${font Sxmo:size=36:style=Bold}\${time %H}\${font Sxmo:size=36}:\${time %M}\${font}
\${alignc}\${font Sxmo:size=14}\${time %a %d %b %Y}\${font}
]]
EOF
python3 - "$ROOTFS/usr/share/sxmo/appcfg/sway_template" <<'PYEOF'
import sys
path = sys.argv[1]
txt = open(path).read()
if "xwayland disable" not in txt:
txt = txt.replace('font "Sxmo 11"\n', 'font "Sxmo 11"\nxwayland disable\n', 1)
old_menu = """mode "menu" {
# This is slower than remapping the keys using a keymap, but we don't need
# to know the device names, so use it as a fallback so this functionality
# keeps working if a deviceprofile doesn't exist.
# TODO: the correct way to do this is to implement custom keybindings in
# bemenu & wofi
bindsym XF86PowerOff exec wtype -k Return
bindsym XF86AudioRaiseVolume exec wtype -k Up
bindsym XF86AudioLowerVolume exec wtype -k Down
}"""
new_menu = """mode "menu" {
bindsym XF86PowerOff exec sxmo_dmenu.sh close
bindsym XF86PickupPhone exec wtype -k Return
bindsym XF86KbdLcdMenu1 exec sxmo_dmenu.sh close
bindsym XF86KbdLcdMenu2 exec sxmo_dmenu.sh close
bindsym XF86NumericStar exec wtype "*"
bindsym XF86NumericPound exec fcitx5-remote -t
bindsym XF86AudioRaiseVolume exec wtype -k Up
bindsym XF86AudioLowerVolume exec wtype -k Down
}"""
if old_menu in txt:
txt = txt.replace(old_menu, new_menu, 1)
old_lid = """bindswitch lid:on exec sxmo_wm.sh display off
bindswitch lid:off exec sxmo_wm.sh display on"""
new_lid = """bindswitch lid:on exec sh -c "brightnessctl -d white:kbd_backlight set 0; sxmo_wm.sh display off"
bindswitch lid:off exec sh -c "brightnessctl -d white:kbd_backlight set 255; sxmo_wm.sh display on"
# Nokia 8110 4G hardware keypad bindings (User:Ybon)
bindsym --no-repeat XF86KbdLcdMenu1 exec sxmo_hook_inputhandler.sh menuleft_one
bindsym --no-repeat XF86KbdLcdMenu2 exec sxmo_hook_inputhandler.sh menuright_one
bindsym --no-repeat XF86PickupPhone exec sxmo_hook_inputhandler.sh enter_one
bindsym --no-repeat XF86NumericStar exec wtype "*"
bindsym --no-repeat XF86NumericPound exec sh -c 'fcitx5-remote -t && sxmo_notify_user.sh -t 1500 "Input: $(fcitx5-remote -n)"'"""
if old_lid in txt:
txt = txt.replace(old_lid, new_lid, 1)
open(path, "w").write(txt)
PYEOF
python3 - "$ROOTFS/usr/share/sxmo/default_hooks/sxmo_hook_inputhandler.sh" <<'PYEOF'
import sys
path = sys.argv[1]
txt = open(path).read()
old_power = """ "powerbutton_one")
if echo "$WMCLASS" | grep -i "megapixels"; then
sxmo_type.sh -k space
else
sxmo_state.sh click
fi
exit 0
;;"""
new_power = """ "menuright"*|"menuright_one")
if sxmo_dmenu.sh isopen; then
sxmo_dmenu.sh close
else
sxmo_appmenu.sh "$WMCLASS" "$WMNAME"
fi
exit 0
;;
"menuleft"*|"menuleft_one")
if sxmo_dmenu.sh isopen; then
sxmo_dmenu.sh close
else
sxmo_appmenu.sh sys
fi
exit 0
;;
"enter_one")
if pidof -q sxmo_RepeatRing.sh; then
sxmo_hook_pickup.sh
else
sxmo_appmenu.sh "$WMCLASS" "$WMNAME"
fi
exit 0
;;
"powerbutton_one")
if echo "$WMCLASS" | grep -i "megapixels"; then
sxmo_type.sh -k space
else
sxmo_appmenu.sh power
fi
exit 0
;;"""
if "menuright_one" not in txt:
assert old_power in txt, "old_power block not found in sxmo_hook_inputhandler.sh"
txt = txt.replace(old_power, new_power, 1)
open(path, "w").write(txt)
PYEOF
for target_home in "$ROOTFS/etc/skel" "$ROOTFS/home/user"; do
mkdir -p \
"$target_home/.config/sxmo/hooks" \
"$target_home/.config/fontconfig/conf.d"
cp "$ROOTFS/usr/share/sxmo/appcfg/profile_template" "$target_home/.config/sxmo/profile"
cp "$ROOTFS/usr/share/sxmo/appcfg/xinit_template" "$target_home/.config/sxmo/xinit"
cp "$ROOTFS/usr/share/sxmo/appcfg/conky.conf" "$target_home/.config/sxmo/conky.conf"
cp "$ROOTFS/usr/share/sxmo/appcfg/Xresources" "$target_home/.Xresources"
cp "$ROOTFS/usr/share/sxmo/appcfg/fontconfig.conf" "$target_home/.config/fontconfig/conf.d/50-sxmo.conf"
cp "$ROOTFS/usr/share/sxmo/default_hooks/sxmo_hook_inputhandler.sh" "$target_home/.config/sxmo/hooks/sxmo_hook_inputhandler.sh"
chmod 755 "$target_home/.config/sxmo/hooks/sxmo_hook_inputhandler.sh" "$target_home/.config/sxmo/xinit" "$target_home/.config/sxmo/profile"
done
fi
sed -i "/^P:sxmo-utils-common$/,/^$/ s/ vim//" "$ROOTFS/lib/apk/db/installed" 2>/dev/null || true
apk --root "$ROOTFS" --arch armv7 del --no-scripts vim vim-common nftables-vim protobuf-vim 2>/dev/null || true
if [ -x /bananarchy/scripts/apply-bananarchy-overlay.sh ]; then
/bananarchy/scripts/apply-bananarchy-overlay.sh "$ROOTFS" nokia-argon
depmod -b "$ROOTFS" 6.12.1-msm8916
fi
chown -R 10000:10000 "$ROOTFS/home/user"
echo " -> Generating initramfs, boot.img, and extlinux.conf via mkinitfs..."
chroot "$ROOTFS" /tmp/hostbin/busybox.static sh -e -c '
export PATH="/tmp/hostbin:/usr/sbin:/usr/bin:/sbin:/bin"
export LD_LIBRARY_PATH="/tmp/hostbin:/lib:/usr/lib"
/tmp/hostbin/mkinitfs
'
echo " -> Restoring armv7 /bin/sh symlink and cleaning up temporary hostbin..."
ln -sf /bin/busybox "$ROOTFS/bin/sh"
rm -rf "$ROOTFS/tmp/hostbin" "$ROOTFS/lib/ld-musl-x86_64.so.1" "$ROOTFS/proc/1"
echo " -> Verifying $ROOTFS boot artifacts:"
ls -lh "$ROOTFS/boot/initramfs" "$ROOTFS/boot/boot.img" "$ROOTFS/boot/extlinux/extlinux.conf"
cat "$ROOTFS/boot/extlinux/extlinux.conf"
}
BOOT_UUID_SXMO="a1b2c3d4-8110-4000-8000-000000000001"
ROOT_UUID_SXMO="a1b2c3d4-8110-4000-8000-000000000002"
configure_common_rootfs "$WORK/rootfs-sxmo" "sxmo" "$BOOT_UUID_SXMO" "$ROOT_UUID_SXMO"
echo "BANANARCHY ROOTFS CONFIGURATION COMPLETED SUCCESSFULLY!"
+56
View File
@@ -0,0 +1,56 @@
#!/bin/sh
# Remove Wayland-only, Rust-based, and retired packages from a target rootfs.
# Usage: prune-rootfs-packages.sh <rootfs-dir> world|purge
# world - drop retired entries from etc/apk/world before apk add, so apk can
# atomically replace conflicting providers (C sudo replaces sudo-rs)
# purge - apk del the still-installed entries after apk add, so install_if
# helpers are not re-added by the same transaction
# Runs inside the build container, where apk and the repositories are available.
set -eu
ROOTFS="$1"
PHASE="$2"
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
PRUNE_FILE="$BASE_DIR/scripts/rootfs-prune-packages.txt"
INSTALLED_DB="$ROOTFS/lib/apk/db/installed"
WORLD_FILE="$ROOTFS/etc/apk/world"
if [ ! -f "$PRUNE_FILE" ]; then
echo "Error: missing $PRUNE_FILE" >&2
exit 1
fi
PRUNE_PKGS="$(grep -v '^[[:space:]]*#' "$PRUNE_FILE" | grep -v '^[[:space:]]*$' | tr '\n' ' ')"
case "$PHASE" in
world)
if [ -f "$WORLD_FILE" ]; then
cp "$WORLD_FILE" "$WORLD_FILE.bananarchy-tmp"
for pkg in $PRUNE_PKGS; do
grep -vxF "$pkg" "$WORLD_FILE.bananarchy-tmp" > "$WORLD_FILE.bananarchy-tmp2" || true
mv "$WORLD_FILE.bananarchy-tmp2" "$WORLD_FILE.bananarchy-tmp"
done
mv "$WORLD_FILE.bananarchy-tmp" "$WORLD_FILE"
fi
;;
purge)
if [ -f "$INSTALLED_DB" ]; then
PRUNE_INSTALLED=""
for pkg in $PRUNE_PKGS; do
if grep -Fxq "P:$pkg" "$INSTALLED_DB"; then
PRUNE_INSTALLED="$PRUNE_INSTALLED $pkg"
fi
done
if [ -n "$PRUNE_INSTALLED" ]; then
echo "[prune] Removing:$PRUNE_INSTALLED"
# shellcheck disable=SC2086
if ! apk --root "$ROOTFS" --arch armv7 del --no-scripts $PRUNE_INSTALLED; then
echo " -> Warning: some retired packages could not be purged" >&2
fi
fi
fi
;;
*)
echo "Usage: $0 <rootfs-dir> world|purge" >&2
exit 1
;;
esac
+6 -7
View File
@@ -2,13 +2,16 @@
# Single source of truth for scripts/bootstrap-rootfs.sh and rebuild-image.sh.
# One package per line; lines starting with '#' and blank lines are ignored.
# Keep this list synchronized with the packages used by the overlay and plugins.
# Pure X11: no Wayland-purpose packages. sudo is the C implementation; the
# Rust sudo-rs variant and its postmarketos-base-sudo-rs companion are excluded.
# scripts/rootfs-prune-packages.txt lists packages purged from existing rootfs
# trees (Wayland-only components and retired packages).
adwaita-icon-theme
alpine-base
alsa-utils
bash
bc
brightnessctl
clickclack
coreutils
doas
ed
@@ -20,7 +23,6 @@ font-droid-nonlatin
font-fira-code
font-noto
font-noto-emoji
font-twemoji
frotz
g++
gcc
@@ -32,6 +34,7 @@ harfbuzz
htop
i2c-tools
imv
imv-x11
ip6tables
iproute2
iptables
@@ -41,7 +44,6 @@ jpm
lang
less
libwpe
libwpebackend-fdo
libxcvt
libxft
libxinerama
@@ -53,7 +55,6 @@ lua5.5
lua5.5-dev
make
mandoc
mesa-demos
mesa-utils
modemmanager
musl-dev
@@ -63,7 +64,6 @@ openssh-server-pam
openvpn
perl
perl-io-socket-ssl
postmarketos-artwork-wallpapers
postmarketos-base
postmarketos-base-nofde
postmarketos-base-ui
@@ -85,12 +85,11 @@ soc-qcom-msm8916-rproc-openrc
soc-qcom-msm8916-ucm
sqlite
sqlite-tcl
sudo-rs
sudo
tcl
tcl-lib
tcl-tls
tor
ttyescape
v4l-utils
w3m
webkit2gtk-4.1
+35
View File
@@ -0,0 +1,35 @@
# Packages that must never be present in the final armv7 image.
# Read by scripts/bootstrap-rootfs-container.sh and rebuild-image.sh, which
# remove only the entries actually installed in the target rootfs.
# One package per line; lines starting with '#' and blank lines are ignored.
# Wayland-purpose components (Bananarchy is pure X11). wayland-libs-* are
# shared libraries linked by GTK3/WebKitGTK and are deliberately not listed:
# removing them would break the Webarchy browser.
grim
imv-wayland
libdecor
libwpebackend-fdo
slurp
sxmo-utils-wayland
wofi
xwayland
# Rust-based top-level packages replaced by C equivalents or retired daemons.
# The remaining Rust libraries (libglycin, librsvg, rav1e-libs, libdovi,
# generate-kernel-cmdline, py3-cryptography) are hard dependencies of GTK3,
# FFmpeg, mpv, boot-deploy and yt-dlp and cannot be removed without regressions.
hkdm
postmarketos-base-sudo-rs
sudo-rs
# Optional Rust install_if helpers with no hard reverse dependency.
gstreamer-ptp-helper
libheif-rav1e
# Retired, unused, or superseded packages.
clickclack
font-twemoji
mesa-demos
postmarketos-artwork-wallpapers
ttyescape