Autonomous testing (clean reboot, kernel SPI statistics, kHz GPIO sweeps, CS0/CS1 register reads, battery/ALS/hwmon checks, host webcam differential imaging) showed all twelve userspace PROBE cases delivered complete, error-free SPI traffic while the cover stayed dark. The QUP5 pinctrl group has one CS line and gpio110 (the kernel panel-mipi-dbi-spi driver's D/C) is shared behind the gpio13 bus switch, so no userspace D/C framing can work. backend = kernel is now the default. While the flip is closed the compiled cover daemon claims only gpio13 (mux) and gpio23 (cover reset), switches the bus to the cover and forces a DPMS off/on cycle through bananarchy-cover-dpms.sh reinit; mipi_dbi_enable() then replays the kernel's firmware init sequence onto the external panel with CS0 and gpio110 D/C. The cover UI is rendered as a 240x240 XR24 damage rect at the top of /dev/fb0 using the fbdev stride, which makes mipi_dbi set a 240x240 address window. The main backlight and keypad stay at 0, so only the outer panel can light. On open the mux returns to the internal panel and the lid daemon requests a reinit after an 80 ms settle. Live verification: closed -> backend=kernel-dark (DPMS off); BUTTON -> backend=kernel, dpms=On, gpio13 high, 172800 non-zero bytes of cover UI in /dev/fb0, kernel spi0.0 +460899 bytes and userspace spi0.1 +0, zero SPI errors; BLANK -> kernel-dark/DPMS off; LID OPEN -> mux=free, gpio13 low. Main backlight and keypad stayed at 0 throughout. All spidev/8-bit/9-bit paths, PROBE, bananarchy-cover-probe.sh and backend = fb|spidev|none remain as runtime rollback paths. New host test scripts/test-cover-kernel.py plus check-rebuild.sh guards. Rebuilt the a1108/dejavu nokia-beatles image and pinned the verified hash ce0542321990a8cff8ab122c0a47c0684fcc7e3d5f6fc97e74b3b0ea4c4826b5 in check-rebuild.sh. e2fsck -fn passed on both partitions, debugfs confirms the rebuilt daemons, helper and config byte-for-byte, and the bootfs sync, boot image check, artifact sync, host tests and rebuild preflight all pass. Limitation: Xorg shares /dev/fb0, so its repaints can still overwrite part of the cover UI; a dedicated override-redirect cover compositor is next. Physical illumination is still unverified from the host.
9.5 KiB
9.5 KiB
Bananarchy Linux — agent guide
Keep this file short. Full details live in README.md, MANUAL.md, SDK.md, CHANGELOG.md,
BATTERY-OPTIMIZATION-ANALYSIS.md, bootloader/lk2nd/README.md, and scripts/check-rebuild.sh.
Project scope
- Bananarchy is an
armv7Alpine/postmarketOS hardfork for MSM8905/MSM8909 keypad feature phones with 240x320 non-touch SPI displays:nokia-argon,nokia-beatles,nokia-tough,nokia-sparkler, andnokia-leo. - The stack is X11-only: Xlibre, patched
sxmo-de-dwm, preloaded C/C++ DWM plugins, NeoUI,fcitx5-t9, and Adreno 304 Glamor/DRI3/GLX overpanel-mipi-dbi. No Wayland compositor, backend, or viewer is shipped. - Design targets are keypad-first 240x320 UI, <2 ms wake latency, and <95 MB idle RAM on 512 MB devices. The pinned
release is
a1108/dejavu;scripts/version.shandscripts/check-rebuild.share authoritative.
Source of truth and workflow
- Treat
prebuilt/as the single source of truth for compiled artifacts andscripts/rootfs-packages.txtas the single source of truth for packages.overlay/rootfs/is a generated mirror; never hand-edit binaries there. Run./scripts/sync-prebuilt-overlay.shafter artifact changes. - Treat
images/,rootfs/, and build caches as local, gitignored outputs. Clean clones rebuild them from source;scripts/check-rebuild.shpins physically verified hashes only when those local artifacts exist. - Run
./scripts/check-rebuild.sh, relevantscripts/test-*.pytests,./scripts/sync-prebuilt-overlay.sh --check, andgit diff --checkbefore claiming a source, artifact, docs, or release change is complete. - Cross-compile inside rootless Docker. Main builders are
scripts/build-sxmo-x11.sh,build-dmenu.sh,build-bananarchy-daemons.sh,build-kernel-audio.sh,build-lk2nd-beatles.sh,build-games.sh,build-fcitx5-t9.sh, andbuild-xlibre.sh. - Use
scripts/build-dmenu.shfor dmenu-only changes. Do not run a fullbuild-sxmo-x11.shcasually: the shippeddwmbinary contains cover IPC strings absent from source, so a full rebuild driftsdwm; restore or reconcile it. - Rootfs/image tools are
scripts/bootstrap-rootfs.sh,scripts/apply-bananarchy-overlay.sh,scripts/compile-gsettings-schemas.sh,rebuild-image.sh,scripts/sync-beatles-bootfs.py --check,prepare-release.sh, andflash-edl.sh. - Rebuild the verified 2720 image with
BANANARCHY_VERSION=a1108 BANANARCHY_CODENAME=dejavu ./rebuild-image.sh nokia-beatles. After a verified rebuild, update the raw hash inscripts/check-rebuild.shandCHANGELOG.md; verify withe2fsck -fn,debugfs, bootfs sync, artifact sync, andcheck-rebuild.sh. - Do not push to
originunless explicitly requested. Do not update pinned hashes or release claims without actual verification.
Critical invariants
- Bluetooth requires
ControllerMode = dualinetc/bluetooth/main.conf; BlueZ 5.87 rejects LE-only HOGP inbredrmode. KeepUserspaceHID=true,LEAutoSecurity=true,ClassicBondedOnly=false, andIdleTimeout=0ininput.conf.bananarchy-bt-obexmust power on, enable LE, select the LE bearer for HID-over-GATT devices, and pair unbonded devices.util-linux-miscandbluez-btmgmtsupport the live PTY scan wrapper. - WebKit requires explicit
glibandgsettings-desktop-schemaspackages. Because apk uses--no-scripts,apply-bananarchy-overlay.shmust runcompile-gsettings-schemas.sh; withoutgschemas.compiled, the WebKit network process aborts. Keep the Webarchy renderer fallback. - Do not change
CONFIG_PREEMPT*,CONFIG_PM_SLEEP/CONFIG_SUSPEND,CONFIG_SMP,CONFIG_MODVERSIONS,CONFIG_MODULE_UNLOAD,CONFIG_ENERGY_MODEL,CONFIG_PERF_EVENTS,CONFIG_FUNCTION_GRAPH_TRACER, orCONFIG_HZwithout rebuilding every pmaports module.CONFIG_SUSPENDstays off; deep suspend and long-lived pollers are intentionally not planned. - Keep package and image hygiene: no top-level Rust packages such as
sudo-rs, no Wayland UI, no on-device compiler (gcc,g++,musl-dev,make), no Janet runtime, no targetpkilldependency, noapkcall afterrebuild-image.shstrips caches, and no__pycache__underoverlay/rootfs/. - Keep the core tools and runtime dependencies guarded by
check-rebuild.sh. On-device scripting uses the Yabasic FFI SDK, soyabasic,libffi,libneoui.so, andlibcurl.so.4must remain; Perl, Lua, optional Tcl extensions, and the sqlite CLI stay excluded. - Keep power/network behaviour event-driven:
superctl disable sxmo_networkmonitor, no longnmcli device monitor, no infinite wakelocks, no forcedsxmo.noidle/sxmo.nosuspend, lz4 zram via/usr/bin/zramstart, andvm.compaction_proactiveness=0. GPS resolves throughbananarchy-gps-modem.sh, nevermmcli -m any. - Keep idle daemons as compiled C ARM ELF binaries (
bananarchy-lid,bananarchy-cover-idle,bananarchy-volume-keys), not Python. Preserve/run/bananarchy/lid-state, the cover socket protocol,FBIOBLANK, cover diagnostics, andscripts/test-cover-idle.py. - Keep the zero-lag plugin model: preloaded resident daemons guarded by lock/FIFO,
poll()at 0% CPU, offscreen240x296Pixmaps atY=24,PluginTheme,RELOAD_THEME, idle blank/lock helpers, the 350 msdwmwake guard, and startup keyboard-grab cleanup without a background poller. - Draw Pango/Xft wrapped text line by line with clipping and matching render rows for link focus. Use
smsTextMetrics()for GSM-7/UCS-2 accounting; strip[SIM n]tags withparseSmsHeaderLine()and never write them back tosms.txt.
Hardware and release caveats
- The shipping 2720 Flip DTS/DTB is single-panel. The two-panel
/dev/fb1layout is opt-in viascripts/build-beatles-cover-panel.py; rollback isscripts/build-beatles-no-cover-dtb.py. Do not make it default until gpio13 mux polarity and gpio21/gpio23 D/C/reset polarity are physically probed: a live test darkened both screens. The shipping image drives the external GC9305 from userspace over/dev/spidev0.1while the flip is closed only (bananarchy-cover-idle); never claim gpio13/21/23 or send SPI traffic while the flip is open, and gate activation on the main panel being DPMS-off; always restore the mux to the internal panel onLID OPEN. - The cover panel's D/C wiring is unsigned-off: gpio21 is TE in the KaiOS DTS, not necessarily D/C. Keep both 8-bit (
spi_word_bits = 8) and 9-bit MIPI DBI (9) paths,bananarchy-coverctl PROBEandbananarchy-cover-probe.sh. Do not claim a winner without eyes-on confirmation. - Keep the internal beatles panel at 25 MHz,
dc_gpio = -1for the spidev fallback, external-panel firmware and initramfs module lists, the Xorgcard0pin,bananarchy-cover-diagnose.sh, and thescripts/test-cover-dt.py/scripts/test-cover-spidev.pyguards. - The shipping cover backend is
backend = kernel: the kernelpanel-mipi-dbi-spidriver owns CS0 and the shared gpio110 D/C. Keepbananarchy-cover-dpms.sh reinit, the gpio13 mux claim, the 240x240/dev/fb0damage rect, the main-backlight-off gate andscripts/test-cover-kernel.py. Keepspidev/fb/noneand PROBE as rollback paths. - Keep the 2720 Flip lid handling event-driven and instant: sticky hall state, immediate hall re-read on
EV_SWedges, 20 ms debounce, and synchronous lid-state/lock/backlight/DPMS writes inbananarchy-lid.c. Every main-panel wake path must callbananarchy-lid-gate.sh; a closed flip may only light the cover.sxmo_state.sh set unlockis gated too becausedwmcalls it directly. Guardscripts/test-lid-gate.py. - Build the lk2nd display image from pinned
bootloader/lk2nd/nokia-beatles.patch. Exact stock IDs, 512 MiB memory fallback, appended DTB,quiet splash, and the low-bit reboot cookie matter.check-lk2nd-beatles.py,test-lk2nd-beatles-port.py,check-beatles-bootimg.py,sync-beatles-bootfs.py --check, andcheck-rebuild.shguard the boot chain. - Flash with
flash-edl.py's default--method lk2nd; stocksystemis wiped by default, so recovery-mode 2720 boots need Volume Up. Keep the signed per-device Firehose programmers and do not mix them. - Keep first-boot access intact:
keys/phone_id_ed25519.pubforuser/root, PAM/sshd configs, USB-only SSH fallback, keypad udev/Xorg rules, BusyBox applet lists, andscripts/set-bananarchy-hostname.sh. - The Power menu label is Reboot to loader and still calls
sxmo_power.sh bootloader. Keep the compact label indmenu.c,dmenu.so,sxmo_appmenu.sh, and the context-menu hook. - Bluetooth HOGP config and plugin load are verified, but full hardware sign-off still needs a wake-up paired keyboard and Connect Device to confirm real HID key events.
Coding and documentation rules
- Use 2-space indentation in C, C++, Python, Yabasic, and shell; tabs only in Makefiles and TSV. No emojis in code, UI strings, logs, or commit messages; use Nerd Font PUA icons. Use sentence case in all docs.
- Keep
README.md,MANUAL.md,SDK.mdfor API/SDK changes,CHANGELOG.md, and this guide synchronized with user-facing features, keybindings, build changes, and verified image changes. Do not leave third-party.mdfiles insrc/oredl/. - Treat
.bantam.cfgas local, gitignored credential data: never read, edit, commit, or unignore it. Keep other agent scratch files outside the repo. - Consult
SDK.md,MANUAL.md,X_KEYPAD_MAPPING.md,BATTERY-OPTIMIZATION-ANALYSIS.md,bootloader/lk2nd/README.md, andCHANGELOG.mdfor APIs, keymaps, flashing details, power tradeoffs, bootloader history, and release rationale.