6.8 KiB
6.8 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) 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, desktop"Menu"/"Names"softkey bar, C-levelSW_LIDslider and locked-key wake handling, 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/dwm-plugins/: Preloaded C++20240x320DWM plugins and shared headers:theme.h: Unified.Xresources/~/.xthemes/*.xthparser, 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, andlibjpeg/libpnghelpers.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).dwm_plugin_runner.c: Lightweight/usr/bin/dwm-pluginlauncher symlinked byxdrawer,xdialer,xcalllog,xcallscreen,xcontacts,xsms,xfiles,xcamera,xthemes,xmodem,xnetworks,xbluetooth,xringtones,xwallpapers,xbackground,xmusic,xplayer,dmenu, andxdmenu.
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 (snake.cpp->/usr/bin/snake,tetris.cpp->/usr/bin/tetris) with built-in 5x7 bitmap fonts,timerfd-driven pacing, and offscreenPixmapdouble buffering.src/msm8905-cam/&src/leds-msm8905-torch/: Out-of-tree Linux6.12.1-msm8916kernel modules for the rearGC2395camera (/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).devices/&patches/: Device trees (.dts/.dtb), MIPI-DBI panel init sequences, and upstream patch sets.
3. Build & Image Generation Commands
All cross-compilation scripts run inside rootless Docker (alpine:3.24 armv7 sysroot) and automatically update both prebuilt/ and overlay/rootfs/:
./scripts/build-sxmo-x11.sh— Buildsst,dmenu.so,dwm,dwm-plugin,sxmo_vibrate, and all C++.soplugins (xdrawer,dialer,calllog,callscreen,contacts,sms,files,camera,themes,modem,networks,ringtones,wallpapers,music)../scripts/build-dmenu.sh— Rebuilds onlydmenu.so,stest,dmenu_path, anddmenu_run../scripts/build-games.sh— Builds standalone X11 games insrc/games/(snake,tetris)../scripts/build-fcitx5-t9.sh— Buildssrc/fcitx5-t9(libt9.so/t9.so)../scripts/build-kernel-audio.sh— Builds6.12.1-msm8916QDSP6 audio, torch LED, camera.komodules, and device.dtbfiles../scripts/build-xlibre.sh— Builds XlibreXorgandlibinput/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 | target_rootfs]— Computes the date-based release version (<year-letter><MM><DD>with2026 = a) and substitutes@BANANARCHY_VERSION@inetc/os-release,etc/issue, andetc/motd(invoked automatically during overlay application and image builds)../chroot-shell.sh— Opens anarmv7container shell to manage packages inrootfs/(pkg-add,pkg-del,pkg-search)../rebuild-image.sh <device> [--mkinitfs]— Appliesoverlay/rootfs/+prebuilt/intorootfs/and produces flashable images inimages/.sudo ./flash-edl.sh [device]— Flasheslk2ndand the system image over Qualcomm USB EDL (05c6:9008).
4. Coding & Architecture Conventions
- Indentation: Always use 2-space indentation in C, C++, Python, 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
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/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. - Documentation: Keep
README.mdandMANUAL.mdsynchronized with any new user-facing features or keybindings, and do not leave third-party.mdfiles insidesrc/oredl/.