38 KiB
Bananarchy Linux — agent guide (AGENTS.md)
1. Project overview
Bananarchy is a keypad-first Linux distribution (armv7 / Alpine edge / postmarketOS v26.06 hardfork) for Qualcomm MSM8905 (Snapdragon 205) and MSM8909 (Snapdragon 210) smart feature phones with 240x320 QVGA non-touch SPI displays and 12-key T9 keypads (nokia-argon, nokia-beatles, nokia-tough, nokia-sparkler, nokia-leo).
It uses a pure X11 (Xlibre + sxmo-de-dwm) stack (no Wayland) with Adreno 304 (FD304) Glamor + DRI3 + GLX GPU acceleration over panel-mipi-dbi KMSRO, optimized for < 2 ms UI wakeup latency and < 95 MB idle RAM on 512 MB devices.
2. Repository layout
-
src/sxmo-dwm/: patcheddwmwindow manager (240x320verticalbstacklayout, 24px Pango status bar, nativeParentRelativedesktop clock and"Menu"/"Names"softkey bar, C-levelevdevSW_LIDslider and universal key wake handling,*+#screenshot chord viabananarchy-screenshot, live.Xresourcesreload, and.soplugin loader viadwm_plugin.h). -
src/sxmo-dmenu/: zero-lag resident DWM menu plugin (dmenu.so) and/tmp/dwm_plugin_dmenu.sockclient (dmenu/xdmenu), featuring built-in Sxmo menus (sys,applications,scripts,modem,config,power,audio,notifications,wm,timezone,games,st,nano,sthotkeys) andfcitx5-t9XIM input. -
src/neoui/: NeoUI240x320UI SDK (neoui.h->/usr/include/neoui.h,neoui.cpp->/usr/lib/libneoui.so) providing both a C-compatible FFI (neoui_*) and C++20 classes (ThemeSpec,PluginTheme,NeoWindow) for.Xresources/~/.xthemes/*.xththeme resolution, Xlib/Xft/Pango window and offscreenPixmapdouble buffering, standardized OS shell widgets, keypad/softkey chord handling, and multi-tap input (paired with Yabasic FFI librariesneoui.yabandneonet.yab+ examplesneoui_demo.yab,neonet_demo.yab, andbulls_cows.yabinoverlay/rootfs/home/user/Projects/). -
src/dwm-plugins/: preloaded C++20240x320DWM plugins linked againstlibneoui.soand shared headers:theme.h: header forwarding to../neoui/neoui.hfor unified.Xresources/~/.xthemes/*.xthparsing, proportional font sizing (theme.baseFontSize), automatic shade derivation, and live Xft/Pango theme reloading (PluginTheme).phone_data.h: shared X11 geometry (240x296below the 24px bar), FIFO IPC (/tmp/dwm_plugin_<name>.fifo), softkey chord detection, Sxmo TSV contact/call/SMS parsers (parseSmsHeaderLine()/stripSmsSimTag()tolerate the QMI WMS[SIM n]header tag), andlibjpeg/libpnghelpers.net_tls.h: shared C++20 TCP + OpenSSL TLS + STARTTLS socket class (NetStream), HTTP/HTTPSGETclient (httpGet), MD5/CSPRNG helpers, and RFC 2047 / Base64 / Quoted-Printable MIME decoders.pjsip_media.h: PJSIP (pjproject/pjmedia-codec/g722&pjmedia/alaw_ulaw) ITU-T G.722 wideband 16 kHz SB-ADPCM and G.711 PCMU/PCMA codec implementation forsip.so.monotone.h+bananarchy_melody.cpp(/usr/bin/bananarchy-melody): Nokia RTTTL (.nrt,.rtttl,.rtx), Ericsson eMelody (.emy), and IrDA iMelody (.imy) monophonic ringtone parser and 48 kHz WAV synthesizer.locker_plugin.cpp(locker.so/xlocker) +verify_passcode.c(/usr/bin/bananarchy-verify-passcode),passcode_plugin.cpp(passcode.so/xpasscode),dialer_plugin.cpp(dialer.so/xdialer),calllog_plugin.cpp(calllog.so/xcalllog),callscreen_plugin.cpp(callscreen.so/xcallscreen),contacts_plugin.cpp(contacts.so/xcontacts),sms_plugin.cpp(sms.so/xsms),files_plugin.cpp(files.so/xfiles),camera_plugin.cpp(camera.so/xcamera),themes_plugin.cpp(themes.so/xthemes),modem_plugin.cpp(modem.so/xmodem),networks_plugin.cpp(networks.so/xnetworks/xbluetooth),ringtones_plugin.cpp(ringtones.so/xringtones),wallpapers_plugin.cpp(wallpapers.so/xwallpapers/xbackground),music_plugin.cpp(music.so/xmusic/xplayer),sip_plugin.cpp(sip.so/xsip),email_plugin.cpp(email.so/xemail/xmail),irc_plugin.cpp(irc.so/xirc),tox_plugin.cpp(tox.so/xtox),smallweb_plugin.cpp(smallweb.so/xkopher/kopher/xsmallweb),webarchy_plugin.cpp(webarchy.so/webarchy/xwebarchy),gps_plugin.cpp(gps.so/xgps/xmaps/xnav),privacy_plugin.cpp(privacy.so/xprivacy/privacy),engmenu_plugin.cpp(engmenu.so/xengmenu).dwm_plugin_runner.c: lightweight/usr/bin/dwm-pluginlauncher symlinked byxlocker,xpasscode,xdrawer,xdialer,xcalllog,xcallscreen,xcontacts,xsms,xfiles,xcamera,xthemes,xmodem,xnetworks,xbluetooth,xringtones,xwallpapers,xbackground,xmusic,xplayer,xsip,xemail,xmail,xirc,xtox,xkopher,kopher,xsmallweb,webarchy,xwebarchy,xgps,xmaps,xnav,xprivacy,privacy,xengmenu,dmenu, andxdmenu.sms_plugin.cpp(sms.so/xsms): threaded conversation view whose message bodies are drawn line by line and clipped to the bubble byrenderLayoutLines(), with a per-message scroll offset (msgScrollPx) and right-edge scrollbar;smsTextMetrics()accounts GSM-7 septets versus UCS-2 UTF-16 units and concatenated part limits. Readssms.txtlogs written by the QMI WMS daemon after 8-bit/16-bit concatenated SMS reassembly.
-
src/xdrawer/: global phone controls overlay (xdrawer.so/xdrawer), toggled by pressing both softkeys simultaneously. -
src/sxmo-st/: patchedstterminal with HarfBuzz OpenType ligatures (Fira Code),XIM(fcitx5-t9), and liveSIGUSR1.Xresourcesreload. -
src/fcitx5-t9/: 6-mode keypad input method (abc,Abc,ABC,Sym,Ctl,123+*long-pressCtrl+latch) with fixed bottom preedit bar (Y=290, H=30). -
src/games/: standalone keypad-driven240x320X11 games and emulators (snake.cpp->/usr/bin/snake,tetris.cpp->/usr/bin/tetris,scoundrel.cpp->/usr/bin/scoundrel,gambatte_phone.cpp+gambatte/->/usr/bin/gambatte//usr/bin/gbemu, andremedy/->/usr/bin/remedy//usr/bin/j2meJ2ME MIDP 2.0 / CLDC 1.1 + JSR-184 M3G 3D emulator) with built-in 5x7 bitmap fonts, NeoUI integration,timerfd-driven pacing, and offscreenPixmap/ EGL double buffering. -
src/msm8905-cam/&src/leds-msm8905-torch/: out-of-tree Linux6.12.1-msm8916kernel modules for the rearGC2395/GC2385/GC2365camera (/dev/video0) andSY7807torch LED (white:torch) / WCD codec init / PM8909PONshutdown. -
overlay/rootfs/: system configuration overlay applied over the target rootfs (kept in sync withprebuilt/). -
prebuilt/: cross-compiledarmv7binaries and kernel modules (sxmo-x11,fcitx5-t9,xlibre,kernel-6.12.1-msm8916,bantam,games,gsocket). -
devices/&patches/: device trees (.dts/.dtb), MIPI-DBI panel init sequences, and upstream patch sets. -
The stock
systemsuperblock is wiped by default for every flash method;--no-wipe-systemis the opt-out and--wipe-systema redundant alias. Inrecoverymode the wipedsystemmeans a normal power-on hangs on the KaiOS logo and Volume Up is mandatory to boot Bananarchy. -
nokia-beatlesboot chain:images/boot-lk2nd-nokia-beatles.imgis built from upstreammsm8916-mainline/lk2ndat pinned commitcf45aefd22d744b2bf9b39455afae697ce430063plusbootloader/lk2nd/nokia-beatles.patch(seebootloader/lk2nd/README.md; rebuild withscripts/build-lk2nd-beatles.sh). It keeps the upstream QCDT layout (both0x14bentries0xb/0x100and0x1000b/0x100sharing onemsm8905-qrd-skubDTB, stockqcom,board-idorder) with a compact/lk2nd/nokia-beatlesnode injected, and adds/cpuswithcpu@0..cpu@3and 4-bytedevice_typeto the commonlk2nd.dtsiso every QCDT DTB has it. The 2720's MSM8905 is a partial-goods 2-core part and its abootASSERTs atplatform/msm_shared/partial_goods.c:80when/cpus,cpu@2orcpu@3is missing — that was the actual "black screen / no fastboot" crash (Sahara MEMORY_DEBUG RLOG log, seebootloader/lk2nd/README.mdandbackup/nokia-beatles-2720/crash-20261109/aboot-log.txt). cmdlinelk2nd lk2nd.compatible=nokia,beatles,lk2nd,match-panelfor all three GC9305 panel names the aboot reports, and the singleqcom,mdss_spi_gc9305_v2_qvga_cmd(the panel the live aboot reports)lk2nd,panel-initstream replayed on BLSP1 QUP5 (DC GPIO 110) only when aboot did not leave continuous splash enabled (or whenlk2nd.force-panel-initis in the cmdline), so the 240x320 RGB565 main panel is initialized even without cont-splash.spi-display.calso paints the branded RGB565 boot splash into the framebuffer (without flushing during init):DISABLE_SPLASH_PARTITION=1plusmenu.c's bottom-only text means upstream lk2nd otherwise pushes a nearly black frame, which is what the "KaiOS logo then blank screen" is.lk2nd/include/lk2nd/spi-panel-init.his shared with the host unit test; the repo copy isbootloader/lk2nd/spi-panel-init.handcheck-lk2nd-beatles.pykeeps them in sync and enforces that QCDT shape. Both the normal and diagnostic images carrylk2nd.no-display(RAM-only framebuffer, no QUP SPI before USB) because unbounded QUP/clock register polls used to wedge lk2nd with the boot vibrator stuck on. The port now bounds those polls (QUP_FIFO_TIMEOUT,CLK_POLL_TIMEOUT) and addsoem display-init/oem display-test/oem scan-dtbfastboot probes that run after USB is up, plusoem screenshotto verify the framebuffer. Liveoem display-initconfirmed the GC9305 v2 stream and the 240x320 RGB565 frame; a chain-loaded diagnostic falls back to the QCDT panel stream when aboot tags are absent,oem scan-dtbstages the final DTB after lk2nd DT updates,oem ramoops consolevalidates and bounds pstore data, and the QUP per-wordSPEWlog is removed. The r3 port also makesoem read-partitionblock-safe: it rounds MMC reads up to the eMMC block size, rejects unaligned offsets and stages only the requested byte count.images/boot-lk2nd-nokia-beatles-display.imguseslk2nd.display=onfor boot-time panel init via the downstream GC9305 v2lk2nd,panel-initstream; flash it with--lk2nd-image. The diagnostic image additionally hasDEBUG=2 LK2ND_FORCE_FASTBOOT=1.check-lk2nd-beatles.py --expect-displayguards the display variant;scripts/test-lk2nd-beatles-port.pyruns all three. lk2nd is confirmed working over live fastboot (lk2nd:compatible=nokia,beatles,model=Nokia 2720 Flip, panelqcom,mdss_spi_gc9305_v2_qvga_cmd,unlocked=yes).flash-edl.pydefaults to--method lk2ndfor every target; stock aboot accepts the port and lk2nd boots Bananarchy fromuserdataviaextlinux.conf(fdt /qcom-msm8905-nokia-beatles.dtb). Onnokia-beatlesthe default is now the Argon shape: lk2nd inboot, the standalone mainlineboot.imginrecovery(Volume Up fallback).--method bothremains as a fallback that writes the standalone mainlineboot.imgto both slots.--verifyreads back every slot and--dump-diagnosticssaves small bootloader/config partitions for secure-boot analysis.scripts/check-lk2nd-beatles.pyvalidates the boot header, both 2720 QCDT entries,/cpusin every QCDT DTB, the device node and the GC9305 v2 panel init stream;scripts/test-lk2nd-beatles-port.pyadds the host C parser test. The stock 2720 aboot is locked (devinfo.is_unlocked=0) and verifies boot images againstNokia_beatles ROOT CA0;flash-edl.pytherefore defaults to settingdevinfo.is_unlocked=1onnokia-beatlesviaunlock_devinfo()before writing any boot image, savesbackup/devinfo-locked-<device>.img, and supports--no-unlock-bootloaderto skip.scripts/make-unlocked-devinfo.pyproduces the same patched image offline. Correction: the GPT haskeystorebut nokeymaster, sotarget_get_vb_version()returnsVB_L=1whileVB_M=2; aboot therefore readsdevinfofrom eMMC, not RPMB. The 21:25 dump confirms eMMCis_unlocked=1, so the unlock is effective and no stock fastboot /oem unlock-gostep is required.--only-unlock,enable_oem_unlock()andscripts/make-oem-unlock-config.pyremain as harmless optional prerequisites, not a boot requirement. The appended DTB must carry the exact stockqcom,msm-id = <0x14b 0>,qcom,board-id = <0x1000b 0x100>andqcom,pmic-id = <0x1000d 0 0 0>values; older aboot revisions read only the firstqcom,board-idpair, so an extra0x0b 0x100variant ahead of it makes the DTB look like a different board (the lk2nd QCDT DTB keeps upstream's0x0bpair first)./memorykeepsdevice_type = "memory"and a 512 MiBreg = <0x80000000 0x20000000>fallback, so a bootloader that fails to patch it still gives Linux usable RAM.scripts/repack-beatles-bootimg.pyrebuilds only the standalone Android boot.img after a DTB change;scripts/sync-beatles-bootfs.pyupdates the boot.img, DTB and extlinux.conf inside the raw image's ext2pmOS_bootfilesystem (never write an Android boot.img at raw offset 1 MiB). The old binary-patched headless image andscripts/make-beatles-lk2nd-bootimg.pyare gone.check-beatles-bootimg.py,check-lk2nd-beatles.pyandsync-beatles-bootfs.py --checkare all called bycheck-rebuild.sh, which also guards the port source files. The kernel display stack now registers both GC9305 panels: agpio-muxon gpio13 selects the target for anspi-muxwhosedisplay@0(240x320, 25 MHz, gpio110 DC,/dev/fb0/card0) anddisplay@1(240x240, 25 MHz, gpio21 DC, gpio23 reset, write-only,/dev/fb1) children are bothpanel-mipi-dbi-spidevices. gpio13 has its own pull-down pinctrl state and is no longer part of the external panel pinctrl group;spidev@1stays disabled, and Xorg pins/dev/dri/card0. Themux-core,mux-gpioandspi-muxmodules are built and loaded, and the external panel firmware is in the initramfs file lists. lk2nd still paints its splash on the main panel through the direct QUP path, so the mux must default to state 0 before Linux drives it. The stock boot chain passes the Power-menu reboot reason inPON_SOFT_RB_SPARE[1:0]; the port reads those low bits and writes low-bit cookies so the visible Fastboot menu survivesReboot to bootloaderandfastboot reboot-bootloader. -
bootloader/loaders/: device-specific signed Firehose programmers;DEVICE_LOADERSinflash-edl.pymaps each target codename to one (8k.mbnserves bothnokia-sparklerandnokia-leo), andDEVICE_LOADER_VARIANTSmaps--variant usonnokia-beatlesto2720v.mbn(Nokia_bts_us). Never flash a different device's programmer: Sahara rejects the signature and--list-loadersshows the embedded attestation identity. -
vendor/edl/: vendored, patched EDL client library (MIT) used byflash-edl.py; a localedl/checkout orBANANARCHY_EDL_DIRoverrides it. -
scripts/rootfs-packages.txt: single source of truth for thearmv7rootfs package set, read by bothbootstrap-rootfs.shandrebuild-image.sh. It intentionally contains nodevice-*package;scripts/apply-bananarchy-overlay.shinstalls the per-devicedevices/<device>/modules-initfslist as/usr/share/mkinitfs/modules/00-device-<device>.modules(plus itsinitramfs.loadmapping) so a clean-clone bootstrap still builds the correct initramfs.scripts/check-rebuild.shguards this. The package set also includesmsm-firmware-loader, its OpenRC companion andmsm-firmware-loader-wcnss; explicit sysinit/boot links are required because packages are installed with--no-scripts. This mounts the stockmodemandpersistpartitions before udev and supplies WCNSS/modem firmware plus factory Wi-Fi NV data, allowing bothwlan0andhci0to enumerate. -
scripts/rootfs-prune-packages.txt: denylist of Wayland-only, Rust-based, and retired packages purged from existing rootfs trees bybootstrap-rootfs-container.shandrebuild-image.sh. -
scripts/prune-rootfs-packages.sh: two-phase rootfs pruner (worldbeforeapk add,purgeafter) that reads the denylist and pinsinstall_ifpackages with negative!pkgworld constraints plusapk fix; theworldphase is required so apk can atomically replace Rustsudo-rswith Csudo. -
Flip lid and cover daemon: the compiled C
bananarchy-lid(servicebananarchy-lid) reads the currentEV_SWswitch mask from/dev/input/event2, follows hall edge events with an 80 ms stability window and reconciles raw gpio36/gpio92 debugfs levels every 200 ms even when switch evdev is present, because the 2720 can miss edges or leaveEVIOCGSWstale. The main beatles panel uses 25 MHz SPI (other targets stay at 50 MHz) to prevent high-backlight PWM noise from corrupting the display at brightness levels above 10/14. It publishes/run/bananarchy/lid-stateso a boot-open flip starts X unlocked, directly blanks/restores the main backlight andwhite:kbd_backlight, clears the lock flag and sends a trustedCLOSEtolocker.soon open, and broadcastsLID CLOSED|OPENto the cover IPC. The compiled Cbananarchy-cover-idlereplaces the CPU-spinning nativebananarchy-coverdin the default runlevel: it is a 0%-CPU Unix SOCK_DGRAM server implementing thebananarchy-coverctlprotocol and renders a 240x240 XRGB8888 clock orTEST barsto the 32-bpp/dev/fb1withwrite()/fsync(). It keeps the cover fully off while the flip is open (black frame,FBIOBLANK/FB_BLANK_POWERDOWNand the optionalbacklight_pathsysfs node driven fromcover_is_lit()), shows clock/battery/network indicators only after a trustedBUTTONfrombananarchy-volume-keyswhile closed, and blanks again after the same~/.config/sxmo/idle_blank_timeoutused bydwm(blank_timeout = autoin/etc/bananarchy/cover-display.conf).usr/bin/bananarchy-cover-diagnose.shreports the live/dev/fb1state for hardware sign-off. The shipping beatles DTS now includes the external panel behindspi-mux, so/dev/fb1exists for the cover renderer;cover-panel.dtsiis the compile-checked reference overlay for older DTBs.scripts/test-cover-dt.pyguards the DT wiring, firmware, initramfs lists, mux modules and Xorg card0 pin. -
Camera, volume keys and cover spi-mux:
etc/modules-load.d/bananarchy-hardware.confplusetc/local.d/10-bananarchy-hardware.startloadmsm8905-cam(registers/dev/video0) andspidev. The demosaic sampler rotates frames 180 degrees only whenof_machine_is_compatible("nokia,beatles"), correcting the Flip's raw V4L2 orientation without changing other targets or adding a frame copy.scripts/busybox-sbin-applets.txtrestores the missing/sbinapplets includingreboot/poweroff. The compiled Cbananarchy-volume-keys(OpenRC servicebananarchy-volume-keys) handlesKEY_VOLUMEUP/KEY_VOLUMEDOWNstraight from evdev because the dwm passive X grab is unreliable;sxmo_audio.shmirrors the logical volume into the first live PipeWire sink viabananarchy_set_sink_volume()and debounces double steps withbananarchy_vol_debounce().spidev@1is disabled becausespi-muxowns chip select 1; the external panel is now a secondpanel-mipi-dbi-spidevice on/dev/fb1.dc_gpio = -1remains in/etc/bananarchy/cover-display.conffor the retained native spidev fallback. -
BusyBox applet completeness:
scripts/busybox-applets.txtis the canonical/binapplet list andapply-bananarchy-overlay.shrecreates any missing symlinks. A rootfs snapshot without/bin/ash(theuserlogin shell) or/bin/grep(used byopenrc-run.sh) breaks sshd logins and prevents the sysinitudevservice from starting; without udev, input nodes stay root-owned and untagged, elogind gives Xorg no devices and the keypad is dead.overlay/rootfs/etc/udev/rules.d/99-bananarchy-input-seat.rulesforcesTAG+="seat",GROUP="input",MODE="0660"; restarttinydmafter starting udev. The lk2ndpaint_boot_banner()inbootloader/lk2nd/nokia-beatles.patchdraws the branded RGB565 boot splash, not the old striped test pattern. -
First-boot access (2720 Flip):
overlay/rootfs/etc/pam.d/sshdsupplies an explicitpam_unixstack andoverlay/rootfs/etc/ssh/sshd_config.d/90-bananarchy-access.confenables password/keyboard-interactive auth, because50-postmarketos-ui-policy.confsetsUsePAM yeswhile the plain/usr/sbin/sshdrejects that directive;overlay/rootfs/etc/conf.d/sshdpins/usr/sbin/sshd.pam.overlay/rootfs/etc/ssh/sshd_config_debugplusetc/local.d/20-bananarchy-sshd-debug.startkeep a USB-only (172.16.42.1:2222) PAM-free fallback login;keys/phone_id_ed25519.pubis pre-authorized foruserandroot. The shippingextlinux.confmust containquiet splash(the pmOS initramfs defaults tonosplash=y);scripts/sync-beatles-bootfs.pyrestores it andscripts/check-beatles-bootimg.pyrejects debug cmdlines.overlay/rootfs/usr/lib/udev/rules.d/99-bananarchy-keypad.rulesandusr/share/X11/xorg.conf.d/60-bananarchy-keypad.confforce X to attach the GPIO matrix keypad;usr/bin/bananarchy-keypad-diagnose.shcollects live input state. The external 240x240 panel firmware lives indevices/nokia-beatles/nokia,beatles-gc9305-ext-panel.bin/.txtand is listed in both initramfs panel file lists;devices/nokia-beatles/cover-panel.dtsiis the compile-checked reference overlay, anddevices/nokia-beatles/qcom-msm8905-nokia-beatles.dtsnow ships the two-panelspi-muxlayout.scripts/check-rebuild.shverifies DTB/DTS sync and requires the cover wiring. Themux-core,mux-gpioandspi-muxmodules are built and loaded. The recovered nativeusr/bin/bananarchy-coverdis retained only for diagnostics;dc_gpio = -1keeps it from fightingpanel-mipi-dbi-spifor gpio110. gpio13 mux polarity, the external reset polarity and the lk2nd boot splash still need a physical sign-off on a live 2720 Flip.
3. Build and image generation commands
All cross-compilation scripts run inside rootless Docker (alpine:3.24 armv7 sysroot) and write to prebuilt/; build-sxmo-x11.sh, sync-prebuilt-overlay.sh, and rebuild-image.sh mirror those artifacts into overlay/rootfs/ (and build-sxmo-x11.sh also refreshes rootfs/ when present):
./scripts/build-sxmo-x11.sh— buildslibneoui.so,st,dmenu.so,dwm,dwm-plugin,bananarchy-verify-passcode,bananarchy-melody,sxmo_vibrate, and all C++.soplugins (locker,passcode,xdrawer,dialer,calllog,callscreen,contacts,sms,files,camera,themes,modem,networks,ringtones,wallpapers,music,sip,email,irc,tox,smallweb,webarchy,gps,privacy,engmenu)../scripts/build-gsocket.sh— fetches and cross-compilesgsocket(gs-netcat,gsocket,gs-sftp,gs-mount,blitz) forarmv7../scripts/build-dmenu.sh— rebuilds onlydmenu.so,stest,dmenu_path, anddmenu_run../scripts/build-games.sh— builds standalone X11 games and emulators insrc/games/(snake,tetris,scoundrel,gambatte/gbemu,remedy/j2me)../scripts/build-fcitx5-t9.sh— buildssrc/fcitx5-t9(libt9.so/t9.so)../scripts/build-kernel-audio.sh— builds6.12.1-msm8916Adreno 304drm/msm, QDSP6 audio, torch LED, camera, gpio-mux and spi-mux.komodules, device.dtbfiles, and thezImagekernel image frompatches/kernel/config-bananarchy-msm8909.armv7(exported asoverlay/rootfs/boot/vmlinuz,config,System.map). The resolved.configis written back to the config file so the module build and the shipped kernel never drift. Never changeCONFIG_PREEMPT*,CONFIG_PM_SLEEP/CONFIG_SUSPEND,CONFIG_SMP,CONFIG_MODVERSIONS,CONFIG_MODULE_UNLOAD,CONFIG_ENERGY_MODEL,CONFIG_PERF_EVENTS,CONFIG_FUNCTION_GRAPH_TRACERorCONFIG_HZin that config without also rebuilding every module from the pmaports kernel package: vermagic,struct dev_pm_info/struct device/struct task_structlayouts, and theHZmacro compiled into module inlines must match the untouched package modules.CONFIG_SCHED_HRTICKandCONFIG_CPU_IDLE_GOV_TEOare ABI-safe but effectively no-ops on this 2-core, 2-idle-state target. SeeBATTERY-OPTIMIZATION-ANALYSIS.md§14 for the full cost/benefit analysis../scripts/build-xlibre.sh— builds XlibreXorg,libglamoregl.so,libglx.so, andmodesetting/libinput/fbdevDDX drivers../scripts/build-bantam.sh— fetches and cross-compiles thebantamAI agent../scripts/generate-artwork.py— regenerates wallpapers, splashes, and icons fromartwork/icon-large.png../scripts/version.sh [--print | --print-codename | target_rootfs]— computes the date-based release version (<year-letter><MM><DD>with2026 = a) and its release codename, and substitutes@BANANARCHY_VERSION@/@BANANARCHY_CODENAME@inetc/os-release,usr/lib/os-release,etc/issue, andetc/motd(invoked automatically during overlay application and image builds). Current release isa1108/dejavu;scripts/check-rebuild.shguards it../chroot-shell.sh— opens anarmv7container shell to manage packages inrootfs/(pkg-add,pkg-del,pkg-search); bootstrapsrootfs/first if needed../rebuild-image.sh <device> [--mkinitfs]— verifies the clone, syncsprebuilt/intooverlay/rootfs/, bootstrapsrootfs/from scratch when missing, applies the overlay, and produces flashable images inimages/../scripts/bootstrap-rootfs.sh [rootfs-dir] [device] [--force|--check]— creates a completearmv7rootfs fromscripts/rootfs-packages.txtinside rootless Docker; idempotent viaetc/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/build-bananarchy-daemons.sh— cross-builds the three compiled ARM idle daemons (bananarchy-lid,bananarchy-cover-idle,bananarchy-volume-keys) fromsrc/bananarchy-daemons/;--checkvalidates the ARM ELF artifacts and overlay sync. No Python-based daemon runs in the idle system../scripts/build-lk2nd-beatles.sh— cross-builds all three beatles lk2nd images (normal, diagnostic and display; the display image is the flasher default) from the pinned upstream lk2nd commit plusbootloader/lk2nd/nokia-beatles.patchin rootless Docker (--checkvalidates all three shipped images,--only normal|diagnostic|displaybuilds one,--force-panel-initforces the panel replay,--with-displayenables SPI display during boot). Offline validators:scripts/check-lk2nd-beatles.pyandscripts/test-lk2nd-beatles-port.py../scripts/test-webarchy-renderer.py,./scripts/test-idle-blank-lock.py,./scripts/test-bluetooth-scan.py,./scripts/test-battery-charge-event.py,./scripts/test-gps-time-sync.py,./scripts/test-cover-idle.pyand./scripts/test-cover-dt.py— host unit/integration tests for the Webarchy renderer profile, the idle-blank screenlock wiring, the Bluetooth discovery parser, the charger plug/unplug icon refresh, the GPS-only time source, the cover display state machine and the external-panel DT wiring (all also run bycheck-rebuild.sh)../scripts/check-rebuild.sh— offline preflight for a clean clone (syntax, package list, plugin artifacts, overlay sync, SMS long-message rendering guard, ignored local agent config, Docker, version helper)../scripts/sync-prebuilt-overlay.sh [--check]— mirrorsprebuilt/artifacts intooverlay/rootfs/;--checkonly reports drift../scripts/bootstrap-flash-deps.sh— installspyusbandpyserialinto the gitignored.flash-deps/directory forflash-edl.py.sudo ./flash-edl.sh [device]— flasheslk2ndand the system image over Qualcomm USB EDL (05c6:9008), using the vendoredvendor/edl/library and auto-installed host dependencies.
4. Coding and architecture conventions
- Indentation: always use 2-space indentation in C, C++, Python, Yabasic, and shell scripts (tabs only in Makefiles and TSV files).
- No emojis: never use emojis in source code, UI strings, logs, or commit messages (use Nerd Font PUA codepoints defined in
neoui.h/phone_data.h/dmenu.cfor UI icons). - Unified theming: never hardcode UI colors or font sizes in
dwm,dmenu,st, or any DWM plugin. Read colors and proportional font sizes fromPluginTheme(src/neoui/neoui.h/src/dwm-plugins/theme.h) /.Xresources(theme.*), and handleRELOAD_THEMEon the plugin FIFO. - 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 onpoll()overConnectionNumber(dpy)and/tmp/dwm_plugin_<name>.fifo, and rendering into an offscreenPixmap(240x296atX=0, Y=24) copied withXCopyAreato prevent flicker. - Multiline text rendering: on the target Pango/Xft stack
pango_xft_render_layout()only paints the first line of a long multiline layout, so wrapped bodies must be drawn line by line withpango_xft_render_layout_line()using a scroll offset and a bounded visible line count (seesms_plugin.cpp,dialer_plugin.cpp,modem_plugin.cpp, andneoui_draw_text_wrapped()). Where the widget has a fixed rectangle, clip withXftDrawSetClipRectangles()and reset the clip afterwards so the softkey bar still draws; keep measurement and rendering at the same layout width. Wrapped document views must also map link focus through the same row expansion used for rendering (buildRenderRows()/ensureFocusedLinkVisible()insmallweb_plugin.cpp), so focusing a link scrolls the viewport in both wrap modes.scripts/check-rebuild.shguardssms_plugin.cppand the xkopher focus path. - SMS text accounting: never treat
std::string::size()(UTF-8 bytes) as an SMS character count. Use code-point-aware logic such assmsTextMetrics(): GSM-7 septets (160 per part, 153 when concatenated) or UCS-2 UTF-16 units (70 per part, 67 when concatenated). SMS log headers are parsed byparseSmsHeaderLine(), which strips[SIM n]tags; do not write those tags back intosms.txt. - Documentation: keep
README.md,MANUAL.md,SDK.md, andCHANGELOG.mdsynchronized with any new user-facing features, SDK functions, or keybindings, and do not leave third-party.mdfiles insidesrc/oredl/. - Artifact sources:
prebuilt/is the single source of truth for compiled artifacts andscripts/rootfs-packages.txtfor thearmv7package set. Never editoverlay/rootfs/copies of binaries by hand; run./scripts/sync-prebuilt-overlay.shafter changingprebuilt/. - Package hygiene: keep
scripts/rootfs-packages.txtfree of Rust-based top-level packages (use Csudo, neversudo-rs) and Wayland-purpose packages;libwpeand thewayland-libs-*shared libraries stay because GTK3/WebKitGTK link them directly, but no Wayland compositor, backend, or viewer is shipped.scripts/check-rebuild.shenforces this. - Power management: idle blanking is
dwm's native evdev timer (src/sxmo-dwm/dwm.c) plusbananarchy-idle-blank.sh; the timeout lives in~/.config/sxmo/idle_blank_timeout(default 300 s,0= off), is edited via Config -> Screen blank /bananarchy-idle-timeout.sh, and is reloaded onSIGUSR1.~/.cache/sxmo/sxmo.noidleandSXMO_UNLOCK_IDLE_TIMEstill override it.bananarchy-screen-wake.sh(called from the ring and notification hooks) wakes the panel for calls/SMS and resets the timer; locking or closing the lid blanks immediately. A blank also armsbananarchy-idle-lock.sh: after~/.config/sxmo/idle_lock_delayseconds of dark panel (default 30,0= immediate,off= disabled) it runs the trustedsxmo_state.sh set screenoffsolocker.soreceivesLOCK_BLANK; every wake path cancels the pending lock. Runtime power policy:/etc/bananarchy-power-policy.conf+/usr/bin/bananarchy-power-policy.sh(OpenRC default runlevel,doasrule) driveWIFI_LISTEN_INTERVAL(wcn36xx module option),MODEM_DRX_MODE(AT$QCDRX) andDSDS_SECONDARY_MODE=eco(QMI secondary GW provisioning session park onsxmo_wm.sh display off/on). Never park a SIM with--uim-sim-power-off: it clears PIN verification. Network time sync isetc/chrony/chrony.conf(iburst,minpoll 12 maxpoll 16,cmdport 0) plususr/bin/bananarchy-time-sync.sh, thebananarchy-time-syncOpenRC service and the NetworkManager dispatcher hook, which callchronyc refresh/burstover chronyd's root-only Unix socket when a connection comes up; Config -> Sync net time (src/sxmo-dmenu/dmenu.c+usr/bin/bananarchy-sync-net-time.sh) forces the same burst manually and notifies the user, and the helper'ssyncmode reports the result. Config -> Time source (networkdefault,gps) and Config -> Sync GPS time useusr/bin/bananarchy-gps-time-sync.shto set the datetime solely from GNSS; in GPS mode chronyd is stopped and every NTP burst is skipped. All GPS queries resolve the GNSS-capable modem throughusr/bin/bananarchy-gps-modem.sh, nevermmcli -m anyon dual-SIM targets. Keep DNS resolution outside the helper'sflockso a long boot retry cannot swallow network-up events, and keepvar/lib/chronyowned by thechronyuser. Network state changes are event-driven throughetc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh+usr/bin/bananarchy-network-event.sh; keepsuperctl disable sxmo_networkmonitorin the session start hooks, and never reintroducesuperctl start sxmo_networkmonitoror a long-livednmcli device monitor. The status bar clock must be refreshed synchronously on unlock (sxmo_hook_unlock.sh), by dmenu'supdate_t9_status_indicator()beforeXStoreName(), and every minute by thestatusbar_clockaligned job in the session start hooks;sxmo_hook_statusbar.shforces a root-name refresh ontime/state_change, and itsbatteryandrefreshactions republish the charge icon together with a fresh clock (bananarchy-time-sync.shcallsrefreshafter an NTP clock step).postmarketos-zram-swapuses/usr/bin/zramstart, not/etc/conf.d/zram-init: keepdeviceinfo_zram_swap_algo="lz4"in everydevices/*/deviceinfo*file. Keepvm.compaction_proactiveness=0inetc/sysctl.d/99-bananarchy-power.confandetc/local.d/10-power-save.start; seeBATTERY-OPTIMIZATION-ANALYSIS.md§17 and §18. Deep standby isbananarchy-suspend.sh/bananarchy-deep-standby.sh/sxmo_autosuspend.sh/sxmo_suspend.sh, gated by/etc/bananarchy-no-deep-standby(shipped present = disabled) and inert becauseCONFIG_SUSPENDis off. A full custom module tree rebuild is deliberately not planned: this firmware has no PSCISYSTEM_SUSPEND, soCONFIG_SUSPENDwould only give s2idle (freeze), notmem/ DDR self-refresh, for <1 mA of saving (seeBATTERY-OPTIMIZATION-ANALYSIS.md§14 and §17). Never forcesxmo.noidle/sxmo.nosuspendfrom the session scripts and never reintroduce the infinitesxmo_not_suspendablewakelock./etc/bananarchy/is root-only. - Image residue:
rebuild-image.shstrips/var/cache/apk, allapk.log*files, and unused gettext locale trees beforemke2fsand aborts the build if any apk cache/log remains; never add anapkcall after that guard. - No on-device compiler:
scripts/rootfs-packages.txtships nogcc/g++/musl-dev/makeand no Janet runtime (janet,janet-dev,jpm); cross-compile native code withscripts/build-*.sh. On-device development uses the Yabasic FFI SDK (neoui.yab/neonet.yab), which requiresyabasic,libffi,libneoui.so, andlibcurl.so.4— never remove those.scripts/check-rebuild.shguards both sides. - Core tools:
curl,bc,ed,rlwrap,mandoc,nano,less, andfrotzare pinned core tools asserted byscripts/check-rebuild.sh. Perl, Lua, optional Tcl extensions, and thesqliteCLI are excluded, whiletcl,python3,bash,luajit,gawk,jq,gojq, andquickjsremain as hard runtime dependencies. - Local agent config:
.bantam.cfgis a local, gitignored credential file. Never read, edit, commit, or unignore it;scripts/check-rebuild.shverifies 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).
5. Final 2720 Flip image method
images/bananarchy-nokia-beatles.img,images/boot-bananarchy-nokia-beatles.img, andimages/boot-lk2nd-nokia-beatles-display.imgare the current verified release artifacts. Their hashes are pinned byscripts/check-rebuild.sh, andimages/bananarchy-nokia-argon.imgis pinned as the matching 8110 4G release image. These files are local build outputs, not tracked in git; clean clones rebuild them from source.- The shipping display lk2nd image is rebuilt from the pinned source patch and must contain the low-bit reboot cookie.
scripts/check-lk2nd-beatles.py,scripts/build-lk2nd-beatles.sh,scripts/test-lk2nd-beatles-port.py, andscripts/check-rebuild.shreject a display image without it;prepare-release.shrebuilds stale or missing lk2nd images before packaging. scripts/set-bananarchy-hostname.shwrites/etc/hostname,/etc/hostsand the OpenRC hostname runlevel link from the canonical target name. Both bootstrap and overlay application call it, andcheck-rebuild.shverifies all five target codenames.- The Power menu item is Reboot to bootloader and calls
sxmo_power.sh bootloader. The torch module uses the low-bit cookie onnokia,beatlesand both low/high lanes on other targets, preserving generic lk2nd compatibility. The default147147unlock passcode provisioning is guarded, and the locker/passcode path is unchanged. src/sxmo-dwm/dwm.cuses the known-good 350 ms wake guard. Do not reintroduce the 120 msWAKE_KEY_DEBOUNCE_MSexperiment: it allowed a cold-boot key to open a residentdmenuwindow that held the keyboard grab.overlay/rootfs/usr/bin/bananarchy-x11-session.shperforms one startupdwm-plugin dmenu close, trusted lockerCLOSE, andEscapekey to release stale startup keyboard grabs. It does not leave a background poller running.prepare-release.shpackages the verified images by default and copiesbootloader/lk2nd-msm8909.imgfor non-beatles targets. SetBA_REBUILD=1only when intentionally regenerating images from source.- Release cleanup removes
backup/,.lk2nd-build/,__pycache__/, stale debug boot images, and scratch logs. Allimages/files are local build outputs and are not tracked in git;prepare-release.shrebuilds missing artifacts from source, andcheck-rebuild.shpins the physically verified hashes only when those local artifacts exist.