Gate the two-panel DT behind an opt-in build after live phone regression

This commit is contained in:
Luxferre committed 2026-11-10 14:53:47 +02:00
1 parent 31db372779
commit a7b1a75465
15 files changed
+2757 -265

No files matched your search

+6 -5
View File
@@ -27,17 +27,17 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adre
- `prebuilt/`: cross-compiled `armv7` binaries 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 `system` superblock is wiped by default for every flash method; `--no-wipe-system` is the opt-out and `--wipe-system` a redundant alias. In `recovery` mode the wiped `system` means a normal power-on hangs on the KaiOS logo and Volume Up is mandatory to boot Bananarchy.
- `nokia-beatles` boot chain: `images/boot-lk2nd-nokia-beatles.img` is built from upstream `msm8916-mainline/lk2nd` at pinned commit `cf45aefd22d744b2bf9b39455afae697ce430063` plus `bootloader/lk2nd/nokia-beatles.patch` (see `bootloader/lk2nd/README.md`; rebuild with `scripts/build-lk2nd-beatles.sh`). It keeps the upstream QCDT layout (both `0x14b` entries `0xb/0x100` and `0x1000b/0x100` sharing one `msm8905-qrd-skub` DTB, stock `qcom,board-id` order) with a compact `/lk2nd/nokia-beatles` node injected, and **adds `/cpus` with `cpu@0`..`cpu@3` and 4-byte `device_type` to the common `lk2nd.dtsi` so every QCDT DTB has it**. The 2720's MSM8905 is a partial-goods 2-core part and its aboot `ASSERT`s at `platform/msm_shared/partial_goods.c:80` when `/cpus`, `cpu@2` or `cpu@3` is missing — that was the actual "black screen / no fastboot" crash (Sahara MEMORY_DEBUG RLOG log, see `bootloader/lk2nd/README.md` and `backup/nokia-beatles-2720/crash-20261109/aboot-log.txt`). cmdline `lk2nd lk2nd.compatible=nokia,beatles`, `lk2nd,match-panel` for all three GC9305 panel names the aboot reports, and the single `qcom,mdss_spi_gc9305_v2_qvga_cmd` (the panel the live aboot reports) `lk2nd,panel-init` stream replayed on BLSP1 QUP5 (DC GPIO 110) only when aboot did not leave continuous splash enabled (or when `lk2nd.force-panel-init` is in the cmdline), so the 240x320 RGB565 main panel is initialized even without cont-splash. `spi-display.c` also paints the branded RGB565 boot splash into the framebuffer (without flushing during init): `DISABLE_SPLASH_PARTITION=1` plus `menu.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.h` is shared with the host unit test; the repo copy is `bootloader/lk2nd/spi-panel-init.h` and `check-lk2nd-beatles.py` keeps them in sync and enforces that QCDT shape. Both the normal and diagnostic images carry `lk2nd.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 adds `oem display-init` / `oem display-test` / `oem scan-dtb` fastboot probes that run after USB is up, plus `oem screenshot` to verify the framebuffer. Live `oem display-init` confirmed 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-dtb` stages the final DTB after lk2nd DT updates, `oem ramoops console` validates and bounds pstore data, and the QUP per-word `SPEW` log is removed. The r3 port also makes `oem read-partition` block-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.img` uses `lk2nd.display=on` for boot-time panel init via the downstream GC9305 v2 `lk2nd,panel-init` stream; flash it with `--lk2nd-image`. The diagnostic image additionally has `DEBUG=2 LK2ND_FORCE_FASTBOOT=1`. `check-lk2nd-beatles.py --expect-display` guards the display variant; `scripts/test-lk2nd-beatles-port.py` runs all three. lk2nd is confirmed working over live fastboot (`lk2nd:compatible=nokia,beatles`, `model=Nokia 2720 Flip`, panel `qcom,mdss_spi_gc9305_v2_qvga_cmd`, `unlocked=yes`). `flash-edl.py` defaults to `--method lk2nd` for every target; stock aboot accepts the port and lk2nd boots Bananarchy from `userdata` via `extlinux.conf` (`fdt /qcom-msm8905-nokia-beatles.dtb`). On `nokia-beatles` the default is now the Argon shape: lk2nd in `boot`, the standalone mainline `boot.img` in `recovery` (Volume Up fallback). `--method both` remains as a fallback that writes the standalone mainline `boot.img` to both slots. `--verify` reads back every slot and `--dump-diagnostics` saves small bootloader/config partitions for secure-boot analysis. `scripts/check-lk2nd-beatles.py` validates the boot header, both 2720 QCDT entries, `/cpus` in every QCDT DTB, the device node and the GC9305 v2 panel init stream; `scripts/test-lk2nd-beatles-port.py` adds the host C parser test. The stock 2720 aboot is locked (`devinfo.is_unlocked=0`) and verifies boot images against `Nokia_beatles ROOT CA0`; `flash-edl.py` therefore defaults to setting `devinfo.is_unlocked=1` on `nokia-beatles` via `unlock_devinfo()` before writing any boot image, saves `backup/devinfo-locked-<device>.img`, and supports `--no-unlock-bootloader` to skip. `scripts/make-unlocked-devinfo.py` produces the same patched image offline. Correction: the GPT has `keystore` but no `keymaster`, so `target_get_vb_version()` returns `VB_L=1` while `VB_M=2`; aboot therefore reads `devinfo` from eMMC, not RPMB. The 21:25 dump confirms eMMC `is_unlocked=1`, so the unlock is effective and no stock fastboot / `oem unlock-go` step is required. `--only-unlock`, `enable_oem_unlock()` and `scripts/make-oem-unlock-config.Line truncated
- `nokia-beatles` boot chain: `images/boot-lk2nd-nokia-beatles.img` is built from upstream `msm8916-mainline/lk2nd` at pinned commit `cf45aefd22d744b2bf9b39455afae697ce430063` plus `bootloader/lk2nd/nokia-beatles.patch` (see `bootloader/lk2nd/README.md`; rebuild with `scripts/build-lk2nd-beatles.sh`). It keeps the upstream QCDT layout (both `0x14b` entries `0xb/0x100` and `0x1000b/0x100` sharing one `msm8905-qrd-skub` DTB, stock `qcom,board-id` order) with a compact `/lk2nd/nokia-beatles` node injected, and **adds `/cpus` with `cpu@0`..`cpu@3` and 4-byte `device_type` to the common `lk2nd.dtsi` so every QCDT DTB has it**. The 2720's MSM8905 is a partial-goods 2-core part and its aboot `ASSERT`s at `platform/msm_shared/partial_goods.c:80` when `/cpus`, `cpu@2` or `cpu@3` is missing — that was the actual "black screen / no fastboot" crash (Sahara MEMORY_DEBUG RLOG log, see `bootloader/lk2nd/README.md` and `backup/nokia-beatles-2720/crash-20261109/aboot-log.txt`). cmdline `lk2nd lk2nd.compatible=nokia,beatles`, `lk2nd,match-panel` for all three GC9305 panel names the aboot reports, and the single `qcom,mdss_spi_gc9305_v2_qvga_cmd` (the panel the live aboot reports) `lk2nd,panel-init` stream replayed on BLSP1 QUP5 (DC GPIO 110) only when aboot did not leave continuous splash enabled (or when `lk2nd.force-panel-init` is in the cmdline), so the 240x320 RGB565 main panel is initialized even without cont-splash. `spi-display.c` also paints the branded RGB565 boot splash into the framebuffer (without flushing during init): `DISABLE_SPLASH_PARTITION=1` plus `menu.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.h` is shared with the host unit test; the repo copy is `bootloader/lk2nd/spi-panel-init.h` and `check-lk2nd-beatles.py` keeps them in sync and enforces that QCDT shape. Both the normal and diagnostic images carry `lk2nd.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 adds `oem display-init` / `oem display-test` / `oem scan-dtb` fastboot probes that run after USB is up, plus `oem screenshot` to verify the framebuffer. Live `oem display-init` confirmed 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-dtb` stages the final DTB after lk2nd DT updates, `oem ramoops console` validates and bounds pstore data, and the QUP per-word `SPEW` log is removed. The r3 port also makes `oem read-partition` block-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.img` uses `lk2nd.display=on` for boot-time panel init via the downstream GC9305 v2 `lk2nd,panel-init` stream; flash it with `--lk2nd-image`. The diagnostic image additionally has `DEBUG=2 LK2ND_FORCE_FASTBOOT=1`. `check-lk2nd-beatles.py --expect-display` guards the display variant; `scripts/test-lk2nd-beatles-port.py` runs all three. lk2nd is confirmed working over live fastboot (`lk2nd:compatible=nokia,beatles`, `model=Nokia 2720 Flip`, panel `qcom,mdss_spi_gc9305_v2_qvga_cmd`, `unlocked=yes`). `flash-edl.py` defaults to `--method lk2nd` for every target; stock aboot accepts the port and lk2nd boots Bananarchy from `userdata` via `extlinux.conf` (`fdt /qcom-msm8905-nokia-beatles.dtb`). On `nokia-beatles` the default is now the Argon shape: lk2nd in `boot`, the standalone mainline `boot.img` in `recovery` (Volume Up fallback). `--method both` remains as a fallback that writes the standalone mainline `boot.img` to both slots. `--verify` reads back every slot and `--dump-diagnostics` saves small bootloader/config partitions for secure-boot analysis. `scripts/check-lk2nd-beatles.py` validates the boot header, both 2720 QCDT entries, `/cpus` in every QCDT DTB, the device node and the GC9305 v2 panel init stream; `scripts/test-lk2nd-beatles-port.py` adds the host C parser test. The stock 2720 aboot is locked (`devinfo.is_unlocked=0`) and verifies boot images against `Nokia_beatles ROOT CA0`; `flash-edl.py` therefore defaults to setting `devinfo.is_unlocked=1` on `nokia-beatles` via `unlock_devinfo()` before writing any boot image, saves `backup/devinfo-locked-<device>.img`, and supports `--no-unlock-bootloader` to skip. `scripts/make-unlocked-devinfo.py` produces the same patched image offline. Correction: the GPT has `keystore` but no `keymaster`, so `target_get_vb_version()` returns `VB_L=1` while `VB_M=2`; aboot therefore reads `devinfo` from eMMC, not RPMB. The 21:25 dump confirms eMMC `is_unlocked=1`, so the unlock is effective and no stock fastboot / `oem unlock-go` step is required. `--only-unlock`, `enable_oem_unlock()` and `scripts/make-oem-unlock-config.Line truncated
- `bootloader/loaders/`: device-specific signed Firehose programmers; `DEVICE_LOADERS` in `flash-edl.py` maps each target codename to one (`8k.mbn` serves both `nokia-sparkler` and `nokia-leo`), and `DEVICE_LOADER_VARIANTS` maps `--variant us` on `nokia-beatles` to `2720v.mbn` (`Nokia_bts_us`). Never flash a different device's programmer: Sahara rejects the signature and `--list-loaders` shows the embedded attestation identity.
- `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`. It intentionally contains no `device-*` package; `scripts/apply-bananarchy-overlay.sh` installs the per-device `devices/<device>/modules-initfs` list as `/usr/share/mkinitfs/modules/00-device-<device>.modules` (plus its `initramfs.load` mapping) so a clean-clone bootstrap still builds the correct initramfs. `scripts/check-rebuild.sh` guards this. The package set also includes `msm-firmware-loader`, its OpenRC companion and `msm-firmware-loader-wcnss`; explicit sysinit/boot links are required because packages are installed with `--no-scripts`. This mounts the stock `modem` and `persist` partitions before udev and supplies WCNSS/modem firmware plus factory Wi-Fi NV data, allowing both `wlan0` and `hci0` to enumerate.
- `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 and pins `install_if` packages with negative `!pkg` world constraints plus `apk fix`; the `world` phase is required so apk can atomically replace Rust `sudo-rs` with C `sudo`.
- **Flip lid and cover daemon**: the compiled C `bananarchy-lid` (service `bananarchy-lid`) reads the current `EV_SW` switch 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 leave `EVIOCGSW` stale. 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-state` so a boot-open flip starts X unlocked, directly blanks/restores the main backlight and `white:kbd_backlight`, clears the lock flag and sends a trusted `CLOSE` to `locker.so` on open, and broadcasts `LID CLOSED|OPEN` to the cover IPC. The compiled C `bananarchy-cover-idle` replaces the CPU-spinning native `bananarchy-coverd` in the default runlevel: it is a 0%-CPU Unix SOCK_DGRAM server implementing the `bananarchy-coverctl` protocol and renders a 240x240 XRGB8888 clock or `TEST bars` to the 32-bpp `/dev/fb1` with `write()`/`fsync()`. It keeps the cover fully off while the flip is open (black frame, `FBIOBLANK`/`FB_BLANK_POWERDOWN` and the optional `backlight_path` sysfs node driven from `cover_is_lit()`), shows clock/battery/network indicators only after a trusted `BUTTON` from `bananarchy-volume-keys` while closed, and blanks again after the same `~/.config/sxmo/idle_blank_timeout` used by `dwm` (`blank_timeout = auto` in `/etc/bananarchy/cover-display.conf`). `usr/bin/bananarchy-cover-diagnose.sh` reports the live `/dev/fb1` state for hardware sign-off. The shipping beatles DTS now includes the external panel behind `spi-mux`, so `/dev/fb1` exists for the cover renderer; `cover-panel.dtsi` is the compile-checked reference overlay for older DTBs. `scripts/test-cover-dt.py` guards 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.conf` plus `etc/local.d/10-bananarchy-hardware.start` load `msm8905-cam` (registers `/dev/video0`) and `spidev`. The demosaic sampler rotates frames 180 degrees only when `of_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.txt` restores the missing `/sbin` applets including `reboot`/`poweroff`. The compiled C `bananarchy-volume-keys` (OpenRC service `bananarchy-volume-keys`) handles `KEY_VOLUMEUP`/`KEY_VOLUMEDOWN` straight from evdev because the dwm passive X grab is unreliable; `sxmo_audio.sh` mirrors the logical volume into the first live PipeWire sink via `bananarchy_set_sink_volume()` and debounces double steps with `bananarchy_vol_debounce()`. `spidev@1` is disabled because `spi-mux` owns chip select 1; the external panel is now a second `panel-mipi-dbi-spi` device on `/dev/fb1`. `dc_gpio = -1` remains in `/etc/bananarchy/cover-display.conf` for the retained native spidev fallback.
- **Flip lid and cover daemon**: the compiled C `bananarchy-lid` (service `bananarchy-lid`) reads the current `EV_SW` switch 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 leave `EVIOCGSW` stale. 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-state` so a boot-open flip starts X unlocked, directly blanks/restores the main backlight and `white:kbd_backlight`, clears the lock flag and sends a trusted `CLOSE` to `locker.so` on open, and broadcasts `LID CLOSED|OPEN` to the cover IPC. The compiled C `bananarchy-cover-idle` replaces the CPU-spinning native `bananarchy-coverd` in the default runlevel: it is a 0%-CPU Unix SOCK_DGRAM server implementing the `bananarchy-coverctl` protocol and renders a 240x240 XRGB8888 clock or `TEST bars` to the 32-bpp `/dev/fb1` with `write()`/`fsync()`. It keeps the cover fully off while the flip is open (black frame, `FBIOBLANK`/`FB_BLANK_POWERDOWN` and the optional `backlight_path` sysfs node driven from `cover_is_lit()`), shows clock/battery/network indicators only after a trusted `BUTTON` from `bananarchy-volume-keys` while closed, and blanks again after the same `~/.config/sxmo/idle_blank_timeout` used by `dwm` (`blank_timeout = auto` in `/etc/bananarchy/cover-display.conf`). `usr/bin/bananarchy-cover-diagnose.sh` reports the live `/dev/fb1` state for hardware sign-off. The shipping beatles DTS keeps the single-panel layout; the two-panel DT is opt-in (see above). `cover-panel.dtsi` is the compile-checked reference overlay. `scripts/test-cover-dt.py` guards both layouts, the firmware, initramfs lists, mux modules and Xorg card0 pin.
- **Camera, volume keys and cover spi-mux**: `etc/modules-load.d/bananarchy-hardware.conf` plus `etc/local.d/10-bananarchy-hardware.start` load `msm8905-cam` (registers `/dev/video0`) and `spidev`. The demosaic sampler rotates frames 180 degrees only when `of_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.txt` restores the missing `/sbin` applets including `reboot`/`poweroff`. The compiled C `bananarchy-volume-keys` (OpenRC service `bananarchy-volume-keys`) handles `KEY_VOLUMEUP`/`KEY_VOLUMEDOWN` straight from evdev because the dwm passive X grab is unreliable; `sxmo_audio.sh` mirrors the logical volume into the first live PipeWire sink via `bananarchy_set_sink_volume()` and debounces double steps with `bananarchy_vol_debounce()`. The shipping `spidev@1` stays enabled for diagnostics; it is disabled only in the opt-in two-panel DT where `spi-mux` owns chip select 1. `dc_gpio = -1` remains in `/etc/bananarchy/cover-display.conf` for the retained native spidev fallback.
- **BusyBox applet completeness**: `scripts/busybox-applets.txt` is the canonical `/bin` applet list and `apply-bananarchy-overlay.sh` recreates any missing symlinks. A rootfs snapshot without `/bin/ash` (the `user` login shell) or `/bin/grep` (used by `openrc-run.sh`) breaks sshd logins and prevents the sysinit `udev` service 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.rules` forces `TAG+="seat"`, `GROUP="input"`, `MODE="0660"`; restart `tinydm` after starting udev. The lk2nd `paint_boot_banner()` in `bootloader/lk2nd/nokia-beatles.patch` draws the branded RGB565 boot splash, not the old striped test pattern.
- **First-boot access (2720 Flip)**: `overlay/rootfs/etc/pam.d/sshd` supplies an explicit `pam_unix` stack and `overlay/rootfs/etc/ssh/sshd_config.d/90-bananarchy-access.conf` enables password/keyboard-interactive auth, because `50-postmarketos-ui-policy.conf` sets `UsePAM yes` while the plain `/usr/sbin/sshd` rejects that directive; `overlay/rootfs/etc/conf.d/sshd` pins `/usr/sbin/sshd.pam`. `overlay/rootfs/etc/ssh/sshd_config_debug` plus `etc/local.d/20-bananarchy-sshd-debug.start` keep a USB-only (172.16.42.1:2222) PAM-free fallback login; `keys/phone_id_ed25519.pub` is pre-authorized for `user` and `root`. The shipping `extlinux.conf` must contain `quiet splash` (the pmOS initramfs defaults to `nosplash=y`); `scripts/sync-beatles-bootfs.py` restores it and `scripts/check-beatles-bootimg.py` rejects debug cmdlines. `overlay/rootfs/usr/lib/udev/rules.d/99-bananarchy-keypad.rules` and `usr/share/X11/xorg.conf.d/60-bananarchy-keypad.conf` force X to attach the GPIO matrix keypad; `usr/bin/bananarchy-keypad-diagnose.sh` collects live input state. The external 240x240 panel firmware lives in `devices/nokia-beatles/nokia,beatles-gc9305-ext-panel.bin/.txt` and is listed in both initramfs panel file lists; `devices/nokia-beatles/cover-panel.dtsi` is the compile-checked reference overlay, and `devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts` now ships the two-panel `spi-mux` layout. `scripts/check-rebuild.sh` verifies DTB/DTS sync and requires the cover wiring. The `mux-core`, `mux-gpio` and `spi-mux` modules are built and loaded. The recovered native `usr/bin/bananarchy-coverd` is retained only for diagnostics; `dc_gpio = -1` keeps it from fighting `panel-mipi-dbi-spi` for gpio110. gpio13 mux polarity, the external reset polarity and the lk2nd boot splash still need a physical sign-off on a live 2720 Flip.
- **First-boot access (2720 Flip)**: `overlay/rootfs/etc/pam.d/sshd` supplies an explicit `pam_unix` stack and `overlay/rootfs/etc/ssh/sshd_config.d/90-bananarchy-access.conf` enables password/keyboard-interactive auth, because `50-postmarketos-ui-policy.conf` sets `UsePAM yes` while the plain `/usr/sbin/sshd` rejects that directive; `overlay/rootfs/etc/conf.d/sshd` pins `/usr/sbin/sshd.pam`. `overlay/rootfs/etc/ssh/sshd_config_debug` plus `etc/local.d/20-bananarchy-sshd-debug.start` keep a USB-only (172.16.42.1:2222) PAM-free fallback login; `keys/phone_id_ed25519.pub` is pre-authorized for `user` and `root`. The shipping `extlinux.conf` must contain `quiet splash` (the pmOS initramfs defaults to `nosplash=y`); `scripts/sync-beatles-bootfs.py` restores it and `scripts/check-beatles-bootimg.py` rejects debug cmdlines. `overlay/rootfs/usr/lib/udev/rules.d/99-bananarchy-keypad.rules` and `usr/share/X11/xorg.conf.d/60-bananarchy-keypad.conf` force X to attach the GPIO matrix keypad; `usr/bin/bananarchy-keypad-diagnose.sh` collects live input state. The external 240x240 panel firmware lives in `devices/nokia-beatles/nokia,beatles-gc9305-ext-panel.bin/.txt` and is listed in both initramfs panel file lists; `devices/nokia-beatles/cover-panel.dtsi` is the compile-checked reference overlay, and `devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts` holds the opt-in two-panel layout. `scripts/check-rebuild.sh` verifies DTB/DTS sync and rejects an accidentally applied cover overlay in the shipping DTB. The `mux-core`, `mux-gpio` and `spi-mux` modules are built and loaded. The recovered native `usr/bin/bananarchy-coverd` is retained only for diagnostics; `dc_gpio = -1` keeps it from fighting `panel-mipi-dbi-spi` for 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):
@@ -57,7 +57,8 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7`
- `./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`) from `src/bananarchy-daemons/`; `--check` validates 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 plus `bootloader/lk2nd/nokia-beatles.patch` in rootless Docker (`--check` validates all three shipped images, `--only normal|diagnostic|display` builds one, `--force-panel-init` forces the panel replay, `--with-display` enables SPI display during boot). Offline validators: `scripts/check-lk2nd-beatles.py` and `scripts/test-lk2nd-beatles-port.py`.
- `./scripts/build-beatles-no-cover-dtb.py` — builds a 2720 Flip DTB (and optionally a boot image / `pmOS_boot` patch) with the external panel disabled, for the physical gpio13/reset sign-off rollback.
- `./scripts/build-beatles-cover-panel.py` — builds the opt-in two-panel DTB (and optionally a boot image / `pmOS_boot` patch) for the physical gpio13/reset sign-off.
- `./scripts/build-beatles-no-cover-dtb.py` — builds the verified single-panel rollback DTB (and optionally a boot image / `pmOS_boot` patch).
- `./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.py` and `./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 by `check-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]` — mirrors `prebuilt/` artifacts into `overlay/rootfs/`; `--check` only reports drift.
+12 -4
View File
@@ -13,22 +13,30 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
Work since `a1108` has focused on reliable 2720 Flip hardware support and a reproducible boot/flash path. Earlier incremental and superseded diagnostic entries are consolidated here.
### Live 2720 Flip verification and cover DT gating
- **Live test performed**: the phone was reachable over root SSH (`keys/phone_id_ed25519`). We backed up `/boot` on the phone and the host, deployed the two-panel DTB, a rebuilt `boot.img`, an initramfs containing the external panel firmware and the `mux-core`/`mux-gpio`/`spi-mux` modules, plus the updated cover daemon/scripts, then rebooted. `/dev/fb1` appeared as 240x240 @ 32bpp (stride 960), `card0` internal / `card1` external / `card2` msm, `bananarchy-coverctl STATUS` reported `backend=fb`, and the real framebuffer passed the whole state machine (open = all black, `LID CLOSED` = still black, `BUTTON` = clock/network/battery lit, `LID OPEN` = black again, `BUTTON` while open ignored, 3 s blank timeout = black with `visible=0`). Keypad, Xorg, dwm, backlight and `sxmo_state.sh` stayed healthy at the software level. Loading the mux modules in the initramfs also moved both panel probes from ~27 s to ~1.1 s and removed the `[pmOS-rd] /dev/fb0 did not appear after waiting 10 seconds` error.
- **Regression found**: the user reported **both screens off**. Software state still said the main panel was on (`brightness=10`, `bl_power=0`, `card0-SPI-1 dpms=On`, Xorg `Monitor is On`), so the shared QUP5 SPI bus routing is the suspect: gpio13 mux polarity and/or the external gpio21 D/C / gpio23 reset lines disrupt the 240x320 main panel. This is exactly the physical sign-off that could not be done offline.
- **Action**: restored the phone to the original single-panel boot files (`qcom-msm8905-nokia-beatles.dtb` `a536b77c...`, `boot.img` `2b5c61ab...`, `initramfs` `05e3315...`) and verified `/dev/fb0` only, Xorg/dwm up, backlight 10. The shipping DTS/DTB are back on the verified single-panel layout; the two-panel wiring moved to `devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts` and is opt-in via `scripts/build-beatles-cover-panel.py`. `scripts/build-beatles-no-cover-dtb.py` is now the single-panel rollback builder. All renderer, diagnostics, firmware, initramfs-module, guard and boot-artifact work is retained, and the pinned image hashes were restored to the shipping set.
- **Next hardware step**: probe gpio13 mux state 0/1 against the main and cover panels, and the external gpio21/gpio23 polarity, before making the opt-in DT the default. `bananarchy-cover-diagnose.sh` on the phone and `scripts/build-beatles-cover-panel.py --install` are the tools for that.
### 2720 Flip external panel (`/dev/fb1`)
- **Enabled the external GC9305 in the shipping DTS**: `spi@78b9000` now hosts a `spi-mux@0` controlled by a root-level `gpio-mux` (gpio13, `idle-state = 0`). Its `display@0` child is the unchanged 240x320 internal panel (25 MHz, gpio25 reset, gpio110 D/C, pinctrl `0x6e`, `backlight`), and `display@1` is the 240x240 external panel (25 MHz, gpio21 D/C, gpio23 reset, `write-only`, 240x240 timing). dtc registers `display@0` first, so the internal panel stays `/dev/fb0` / `card0` and the second `panel-mipi-dbi-spi` device becomes `/dev/fb1` for `bananarchy-cover-idle`. `spidev@1` is disabled because the mux owns chip select 1.
- **Enabled the external GC9305 in an opt-in DTS (superseded, see the live verification section above)**: `spi@78b9000` now hosts a `spi-mux@0` controlled by a root-level `gpio-mux` (gpio13, `idle-state = 0`). Its `display@0` child is the unchanged 240x320 internal panel (25 MHz, gpio25 reset, gpio110 D/C, pinctrl `0x6e`, `backlight`), and `display@1` is the 240x240 external panel (25 MHz, gpio21 D/C, gpio23 reset, `write-only`, 240x240 timing). dtc registers `display@0` first, so the internal panel stays `/dev/fb0` / `card0` and the second `panel-mipi-dbi-spi` device becomes `/dev/fb1` for `bananarchy-cover-idle`. `spidev@1` is disabled because the mux owns chip select 1.
- **Fixed the three causes of the earlier live regression**: both panels keep the verified 25 MHz clock (the experimental overlay restored 50 MHz and reintroduced high-brightness corruption); the external panel uses its own gpio21 D/C line, so the QUP controller stays in supported 8-bit mode instead of 9-bit MIPI DBI Type C Option 1 and gpio110 remains exclusive to the internal panel; gpio13 now has a dedicated pull-down pinctrl group and is no longer part of the external panel's pinctrl state that re-biased the mux during probe. Xorg's `10-bananarchy-msm8909.conf` pins `/dev/dri/card0`, so the new DRM device cannot steal the main display.
- **Provisioned the driver path**: `/lib/firmware/nokia,beatles-gc9305-ext-panel.bin` is now listed in `overlay/rootfs/usr/share/mkinitfs/files/00-nokia-argon-display.files` and `devices/nokia-beatles/00-nokia-beatles-display.files`, so `panel-mipi-dbi` (an initramfs module) can load it. `mux-core`, `mux-gpio` and `spi-mux` remain in `modules-load.d`/`local.d`, and `CONFIG_MULTIPLEXER`/`CONFIG_MUX_GPIO`/`CONFIG_SPI_MUX` stay `=m`.
- **Rebuilt and revalidated the boot artifacts**: the DTB was recompiled from the DTS and synced to `devices/`, `overlay/rootfs/boot/` and `prebuilt/kernel-6.12.1-msm8916/dtbs/`; `scripts/repack-beatles-bootimg.py` replaced the appended DTB in the standalone boot image and `scripts/sync-beatles-bootfs.py` refreshed `boot.img` and the DTB inside the raw image's `pmOS_boot` ext2 filesystem. The pinned beatles image hashes in `check-rebuild.sh` were updated, and `check-beatles-bootimg.py` plus `sync-beatles-bootfs.py --check` still pass. `devices/nokia-beatles/cover-panel.dtsi` was rewritten to mirror the shipping wiring and remains compile-checked as a reference for older DTBs.
- **Guards**: `scripts/test-cover-dt.py` validates the decompiled DTB (two displays, 25 MHz clocks, isolated gpio13, disabled spidev, stock IDs and 512 MiB memory fallback), DTB/DTS/copy consistency, initramfs firmware lists, kernel config, module loading and the Xorg card0 pin. `check-rebuild.sh` now requires the cover wiring instead of rejecting it.
- **Renderer "fully off" now uses fbdev blanking**: `bananarchy-cover-idle` calls `FBIOBLANK` with `FB_BLANK_POWERDOWN` after writing the black frame (and `FB_BLANK_UNBLANK` for a lit frame), so a real DRM fbdev powers the external connector down instead of just showing black. `cover_is_lit()` is the single source of truth for the frame, the optional `backlight_path` sysfs node and the blanking ioctl; the host state-machine test also guards these tokens. `/usr/bin/bananarchy-cover-diagnose.sh` reports `/dev/fb1`, its geometry, DRM cards, mux/panel modules, firmware, lid state and `bananarchy-coverctl STATUS` for the physical sign-off.
- **Rollback path for the physical sign-off**: `scripts/build-beatles-no-cover-dtb.py` derives a DTB that disables only `display@1` (verified by `test-cover-dt.py`-style checks on the decompiled result) and `--install` builds a separate no-cover boot image and patches the local raw image's `pmOS_boot`. `scripts/sync-beatles-bootfs.py` gained `--dtb`/`--boot-image` overrides so the tracked shipping DTB never has to be swapped. The rollback was validated against a copy of the raw image; the shipping image hash is unchanged.
- **Still needs a live device**: gpio13 mux polarity, external reset polarity, the external panel init stream and the lk2nd boot splash (which drives QUP directly before Linux applies the mux pinctrl) cannot be confirmed offline. The DT and renderer are shipped; the physical sign-off remains the last validation step.
- **Live result**: the physical sign-off failed (both screens dark), so the shipping DT was reverted and the two-panel DT is now opt-in. See the live verification section above.
### 2720 Flip cover display behaviour
- **External panel never showed anything useful**: `bananarchy-cover-idle` repainted a clock every 30 s regardless of lid state, ignored its `blank_timeout` setting, had no button input and drew no network indicators. It now implements the full behaviour contract: an **open flip** is fully off (black frame + backlight 0 and `BUTTON` ignored), a **closed flip** waits off until a trusted `BUTTON` datagram arrives, and that button shows the live clock, date, battery and a compact network line. The cover then blanks after exactly the main **Config -> Screen blank** timeout (`~/.config/sxmo/idle_blank_timeout`, default 300 s, `0` = never; `blank_timeout = auto` follows it). While off the daemon blocks in `poll()` with no timer at all, so it stays at 0% CPU.
- `bananarchy-volume-keys` now reads `/run/bananarchy/lid-state` and turns external side keys (volume up/down and End/Power) into cover wake buttons while the flip is closed instead of changing the volume. `bananarchy-cover-status.sh` publishes `4G SIG75 WIFI`-style indicators and battery state to the daemon from the NetworkManager dispatcher, the cover service start, and `bananarchy-cover-event.sh network|button`. `bananarchy-coverctl STATUS` now reports `lid`, `visible`, `blank_ms` and `network`.
- `scripts/test-cover-idle.py` compiles the daemon on the host and drives its real socket protocol against a fake framebuffer/backlight, verifying open/closed gating, button wake, indicator republishing, the shared blank timeout (including `0` = never) and backlight state. `check-rebuild.sh` guards the rebuilt ARM daemons and the IPC wiring. The shipping beatles DTB intentionally still keeps the single internal panel: gpio13 mux selection and external reset polarity remain hardware-gated, but the compile-tested `cover-panel.dtsi` now uses the verified 25 MHz internal-panel clock so enabling it later cannot reintroduce high-brightness corruption. The hardware path was enabled in the follow-up `/dev/fb1` section below.
- `scripts/test-cover-idle.py` compiles the daemon on the host and drives its real socket protocol against a fake framebuffer/backlight, verifying open/closed gating, button wake, indicator republishing, the shared blank timeout (including `0` = never) and backlight state. `check-rebuild.sh` guards the rebuilt ARM daemons and the IPC wiring. The shipping beatles DTB intentionally still keeps the single internal panel: gpio13 mux selection and external reset polarity remain hardware-gated, but the compile-tested `cover-panel.dtsi` now uses the verified 25 MHz internal-panel clock so enabling it later cannot reintroduce high-brightness corruption. The follow-up `/dev/fb1` work made the two-panel DT opt-in after live testing (see the live verification section above).
### GPS reception and GPS-only system time
@@ -70,7 +78,7 @@ Work since `a1108` has focused on reliable 2720 Flip hardware support and a repr
### Flashing and external display status
- **Device-aware EDL flashing**: added the correct signed Firehose programmer for every target, including the 2720 US variant, plus loader identity listing and EDL PID detection. The 2720 flow unlocks eMMC `devinfo`, supports config/FRP preparation, verifies boot-slot reads, writes each slot from the correct image, and wipes the stock system superblock by default with `--no-wipe-system` as the opt-out.
- **External cover was hardware-gated (superseded)**: the experimental spi-mux cover overlay was rolled back after it broke the main panel/keypad path; the follow-up `/dev/fb1` section below describes the corrected wiring that is now shipping.
- **External cover was hardware-gated (superseded)**: the experimental spi-mux cover overlay was rolled back after it broke the main panel/keypad path; the follow-up `/dev/fb1` work kept the corrected wiring opt-in after a live test darkened the main panel (see the live verification section above).
### Build and release hygiene
+1 -1
View File
@@ -456,7 +456,7 @@ Three native X11 games (`/usr/bin/snake`, `/usr/bin/tetris`, and `/usr/bin/scoun
- **X startup and keypad**: OpenRC starts independent services in parallel; `etc/init.d/local` replaces its stock `after *` dependency, which deadlocked with parallel startup on this image. `udev_settle_timeout=2` stops missing modem firmware from holding the display manager behind a long `udevadm settle`, and `bananarchy-sshd-debug` starts independently of `local.d`. A boot-open flip reads `/run/bananarchy/lid-state` and starts in `state=unlock` with no passcode screen, so the keypad is live as soon as `dwm` starts. If the keypad is dead, check `rc-service bananarchy-lid status`, `cat /run/bananarchy/lid-state`, `sxmo_state.sh get`, `/tmp/bananarchy_screen_locked`, `DISPLAY=:0 xwininfo -id 0xa00001` and `DISPLAY=:0 xinput list`.
- **Display distortion above 71% brightness**: the internal panel uses 25 MHz SPI on `nokia-beatles`, rather than the 50 MHz timing used by the other targets. This keeps the link stable when the MPP2 backlight PWM duty rises above the level-10/14 operating point. The brightness range remains 1–14 with no artificial cap, and panel offsets/init registers are unchanged. The timing can be checked with `dtc -I dtb -O dts /boot/qcom-msm8905-nokia-beatles.dtb | grep -A8 'display@0'`.
- **Closing the flip**: `bananarchy-lid` reads the current `EV_SW` switch mask from `/dev/input/event2`, follows hall edge events with an 80 ms stability window, and reconciles the raw gpio36/gpio92 debugfs levels every 200 ms even while evdev is present. This covers missed edges and stale `EVIOCGSW` state without a busy-polling loop. On close it blanks the main panel and keypad LED immediately, runs `sxmo_state.sh set screenoff` and tells the cover daemon `LID CLOSED`; on open it clears the lock flag, restores both backlights, sends a trusted `CLOSE` to `locker.so` and runs `sxmo_state.sh set unlock`. Check `rc-service bananarchy-lid status`, `sxmo_state.sh get` and `grep -E " gpio(36|92) " /sys/kernel/debug/gpio`. If the hall polarity is inverted on your unit, set `BANANARCHY_LID_GPIO_FILE` to a different debugfs GPIO file for the fallback path.
- **Cover display status and behaviour**: `bananarchy-cover-idle` is the compiled 0%-CPU default daemon and answers `bananarchy-coverctl` (`PING`, `STATUS`, `LID CLOSED|OPEN`, `BUTTON`, `NETWORK`, `BATTERY`, `NOTIFY`, `BLANK`/`UNBLANK`, `TEST`); the native `bananarchy-coverd` is retained only for diagnostics. With the flip **open** the external panel is fully off (all-black frame plus backlight 0) and `BUTTON` is ignored. With the flip **closed** the panel stays off until an external side key is pressed: `bananarchy-volume-keys` reads `/run/bananarchy/lid-state` and sends the trusted `BUTTON` datagram instead of changing the volume, which shows the live clock, date, battery percentage and the compact main network indicators (`4G SIG75 WIFI`-style, published by `bananarchy-cover-status.sh` from the NetworkManager dispatcher and at service start). No further button blanks the cover after exactly the same **Config -> Screen blank** timeout that `dwm` uses (`~/.config/sxmo/idle_blank_timeout`, default 300 s, `0` = never; `blank_timeout = auto` in `/etc/bananarchy/cover-display.conf` selects it, a numeric value overrides it). The daemon blocks in `poll()` with no timer while off, so idle CPU stays at 0%. The renderer uses the 32-bpp fbdev `write()` path (not `mmap()`, which raises `SIGBUS` on the DRM fbdev). The shipping DTS now registers both panels on an `spi-mux`: `display@0` keeps the verified 240x320 internal panel at 25 MHz with gpio110 as D/C (Xorg still pins `/dev/dri/card0`), while `display@1` is the 240x240 external GC9305 at 25 MHz with its own gpio21 D/C line, gpio23 reset and `write-only` framebuffer, exposed as `/dev/fb1`. gpio13 selects the mux and has a dedicated pull-down pinctrl state so the internal panel stays selected until `gpio-mux` drives it; the external panel's pinctrl group no longer touches gpio13. `spidev@1` is disabled, the `mux-core`/`mux-gpio`/`spi-mux` modules are loaded, and the external panel firmware is included in the initramfs. `bananarchy-coverctl STATUS` should now report `backend=fb`. `scripts/test-cover-idle.py` verifies the state machine with a fake framebuffer and `scripts/test-cover-dt.py` validates the DTB, firmware lists and Xorg pin; the DTB, appended boot DTB and `pmOS_boot` copy are rebuilt together. Physical sign-off of gpio13 mux polarity, external reset polarity and the lk2nd boot splash is still required on a live 2720 Flip; `devices/nokia-beatles/cover-panel.dtsi` remains a compile-checked reference for older DTBs. Run `bananarchy-cover-diagnose.sh` on the phone to check `/dev/fb1`, its geometry, the DRM cards, the loaded mux/panel modules, the firmware, the lid state and `bananarchy-coverctl STATUS` in one report. If the external panel disturbs the main display during sign-off, `scripts/build-beatles-no-cover-dtb.py --install` builds a DTB with only `display@1` disabled and patches the local boot image / `pmOS_boot`; run `sync-beatles-bootfs.py` without overrides to restore the shipping DTB. "Fully off" is a black frame plus `FBIOBLANK`/`FB_BLANK_POWERDOWN` on the fbdev (and the optional `backlight_path` sysfs node when present).
- **Cover display status and behaviour**: `bananarchy-cover-idle` is the compiled 0%-CPU default daemon and answers `bananarchy-coverctl` (`PING`, `STATUS`, `LID CLOSED|OPEN`, `BUTTON`, `NETWORK`, `BATTERY`, `NOTIFY`, `BLANK`/`UNBLANK`, `TEST`); the native `bananarchy-coverd` is retained only for diagnostics. With the flip **open** the external panel is fully off (all-black frame plus backlight 0) and `BUTTON` is ignored. With the flip **closed** the panel stays off until an external side key is pressed: `bananarchy-volume-keys` reads `/run/bananarchy/lid-state` and sends the trusted `BUTTON` datagram instead of changing the volume, which shows the live clock, date, battery percentage and the compact main network indicators (`4G SIG75 WIFI`-style, published by `bananarchy-cover-status.sh` from the NetworkManager dispatcher and at service start). No further button blanks the cover after exactly the same **Config -> Screen blank** timeout that `dwm` uses (`~/.config/sxmo/idle_blank_timeout`, default 300 s, `0` = never; `blank_timeout = auto` in `/etc/bananarchy/cover-display.conf` selects it, a numeric value overrides it). The daemon blocks in `poll()` with no timer while off, so idle CPU stays at 0%. The renderer uses the 32-bpp fbdev `write()` path (not `mmap()`, which raises `SIGBUS` on the DRM fbdev). The shipping DTS deliberately keeps the verified single-panel layout, so `/dev/fb1` is normally absent. A live test produced a working 240x240 external framebuffer but made the main panel go dark, so the two-panel `spi-mux` wiring is opt-in in `devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts`: build it with `scripts/build-beatles-cover-panel.py`, install the resulting DTB/boot.img into `pmOS_boot`, and verify the main panel before keeping it. `scripts/build-beatles-no-cover-dtb.py` builds the single-panel rollback DTB. The external firmware and `mux-core`/`mux-gpio`/`spi-mux` modules are already provisioned in the initramfs; `bananarchy-coverctl STATUS` reports `backend=fb` only when the opt-in DT is installed, otherwise `backend=none`. `scripts/test-cover-idle.py` verifies the state machine with a fake framebuffer, while `scripts/test-cover-dt.py` validates both the shipping single-panel DTB and the opt-in two-panel DT, the firmware lists and the Xorg pin. Physical sign-off of gpio13 mux polarity, the external gpio21 D/C and gpio23 reset polarity, and the lk2nd boot splash is still required on a live 2720 Flip; `devices/nokia-beatles/cover-panel.dtsi` remains a compile-checked reference for older DTBs. Run `bananarchy-cover-diagnose.sh` on the phone to check `/dev/fb1`, its geometry, the DRM cards, the loaded mux/panel modules, the firmware, the lid state and `bananarchy-coverctl STATUS` in one report. If the external panel disturbs the main display during sign-off, `scripts/build-beatles-no-cover-dtb.py --install` builds the verified single-panel DTB and patches the local boot image / `pmOS_boot`; `sync-beatles-bootfs.py` without overrides restores the shipping DTB. "Fully off" is a black frame plus `FBIOBLANK`/`FB_BLANK_POWERDOWN` on the fbdev (and the optional `backlight_path` sysfs node when present).
- **Camera app frozen / UI unresponsive**: check `top` for `bananarchy-volume-keys`. The daemon must be a single instance at 0% CPU; stale evdev fds are pruned by `prune_devices()`/`drop_device()` and guarded by `flock`. `rc-service bananarchy-volume-keys status` and `bananarchy-keypad-diagnose.sh` report its state. `xcamera` should return immediately and `bananarchy-photo <file>` should write a 600x800 JPEG.
- **Camera**: `/dev/video0` is provided by the out-of-tree `msm8905-cam` module, loaded at boot by `/etc/modules-load.d/bananarchy-hardware.conf` and `etc/local.d/10-bananarchy-hardware.start`. Check with `v4l2-ctl --list-devices`; a missing node means the module did not load (previously caused by a missing `/bin/sed` breaking the `modules` service).
- **Side volume keys**: the compiled evdev daemon `bananarchy-volume-keys` reads `KEY_VOLUMEUP`/`KEY_VOLUMEDOWN` directly and calls `sxmo_audio.sh vol up/down 5`; `sxmo_audio.sh` mirrors that percentage into the live PipeWire sink (the MSM8905 mainline kernel has no ALSA card yet). Press a side button and check `wpctl get-volume <sink-id>`; `bananarchy-keypad-diagnose.sh` reports the XKB mapping and both volume values.
+2 -2
View File
@@ -50,7 +50,7 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs
- **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, custom homepage support, and link focus that always scrolls the viewport to the focused link in both wrapped and unwrapped modes.
- **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), and a device-aware renderer profile: the 2720 Flip uses the WebKit CPU renderer (with automatic software fallback after a WebProcess crash) while the 8110 4G keeps Adreno 304 acceleration; `~/.config/sxmo/webarchy_software_renderer` forces the CPU profile on any target.
- **GPS-only system time**: **Config -> Time source** switches from NTP to GNSS only (stopping `chronyd` and disabling every network-up NTP burst) and **Config -> Sync GPS time** steps the clock from a ModemManager GPS UTC value or a valid RMC fix, writes the RTC and refreshes the status bar. All GPS queries now resolve the GNSS-capable modem through `bananarchy-gps-modem.sh` instead of the ambiguous `mmcli -m any`, which fixes empty GPS data on the dual-SIM 2720 Flip. See `MANUAL.md` sections 5.6 and 5.8.
- **2720 Flip cover display behaviour**: the compiled `bananarchy-cover-idle` renderer keeps the external panel fully off while the flip is open, waits for a side-button `BUTTON` event when closed, then shows the clock, battery and compact main network indicators until the same **Config -> Screen blank** timeout expires with no further button press. `bananarchy-volume-keys` turns the external keys into trusted cover wake events, `bananarchy-cover-status.sh` publishes modem/Wi-Fi indicators from network events, and the daemon blocks in `poll()` with no timer while off. The shipping DTS now exposes the external GC9305 as `/dev/fb1` behind `gpio-mux`/`spi-mux` (25 MHz, dedicated gpio21 D/C, gpio13 isolated, Xorg pinned to card0), with the panel firmware in the initramfs and the DTB/boot images rebuilt; `scripts/test-cover-idle.py` and `scripts/test-cover-dt.py` verify the renderer and DT wiring on the host, `FBIOBLANK` powers the fbdev down when the cover is off, and `bananarchy-cover-diagnose.sh` reports the live panel state for hardware sign-off and `scripts/build-beatles-no-cover-dtb.py` provides a one-command rollback if the external panel disturbs the main display.
- **2720 Flip cover display behaviour**: the compiled `bananarchy-cover-idle` renderer keeps the external panel fully off while the flip is open, waits for a side-button `BUTTON` event when closed, then shows the clock, battery and compact main network indicators until the same **Config -> Screen blank** timeout expires with no further button press. `bananarchy-volume-keys` turns the external keys into trusted cover wake events, `bananarchy-cover-status.sh` publishes modem/Wi-Fi indicators from network events, and the daemon blocks in `poll()` with no timer while off. The external GC9305 DT is **opt-in** (`devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts`, built with `scripts/build-beatles-cover-panel.py`): a live test produced `/dev/fb1` (240x240, 32bpp) and the full renderer state machine, but the shared SPI bus darkened the main panel, so the shipping DTB stays on the verified single-panel layout. `FBIOBLANK` powers the cover fbdev down when it is off, `bananarchy-cover-diagnose.sh` reports the live panel state, `scripts/test-cover-idle.py` and `scripts/test-cover-dt.py` validate the renderer and both DT layouts on the host, and `scripts/build-beatles-no-cover-dtb.py` builds the single-panel rollback.
- **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.
@@ -201,7 +201,7 @@ sudo ./flash-edl.sh nokia-argon
The patched EDL client library is vendored under `vendor/edl/` (MIT), so a clean clone flashes without any manual download. `flash-edl.sh` also installs `pyusb` and `pyserial` into the gitignored `.flash-deps/` directory when the host lacks them; set `BANANARCHY_EDL_DIR` to use a different library checkout.
After a successful flash the phone boots lk2nd's branded boot splash, then the Plymouth boot splash, then X. Log in over the USB network with `ssh user@172.16.42.1` (password `147147`); if the main sshd's PAM stack is ever broken, a USB-only fallback listener accepts the same credentials on `ssh -p 2222 user@172.16.42.1`. Selecting **Reboot to bootloader** from the Power menu shows the visible lk2nd Fastboot menu; **Bootloader** stays in fastboot, **EDL** enters Sahara, and `fastboot reboot` returns to Linux. On the 2720 Flip, OpenRC starts independent services in parallel with a patched `local` service, a bounded `udevadm settle` and an independent USB fallback sshd keep X from waiting on modem firmware, a boot-open lid starts unlocked with a live keypad, and the external cover panel is now registered in the shipping DTS as a second `panel-mipi-dbi-spi` device on `/dev/fb1`; gpio13 mux and reset polarity still need a live hardware sign-off. See `MANUAL.md` section 4.1 for first-boot troubleshooting of the boot splash, keypad input and the external cover display.
After a successful flash the phone boots lk2nd's branded boot splash, then the Plymouth boot splash, then X. Log in over the USB network with `ssh user@172.16.42.1` (password `147147`); if the main sshd's PAM stack is ever broken, a USB-only fallback listener accepts the same credentials on `ssh -p 2222 user@172.16.42.1`. Selecting **Reboot to bootloader** from the Power menu shows the visible lk2nd Fastboot menu; **Bootloader** stays in fastboot, **EDL** enters Sahara, and `fastboot reboot` returns to Linux. On the 2720 Flip, OpenRC starts independent services in parallel with a patched `local` service, a bounded `udevadm settle` and an independent USB fallback sshd keep X from waiting on modem firmware, a boot-open lid starts unlocked with a live keypad, and the external cover panel wiring is opt-in pending gpio13 mux / reset polarity sign-off; the shipping DTS keeps the known-good single internal panel. See `MANUAL.md` section 4.1 for first-boot troubleshooting of the boot splash, keypad input and the external cover display.
See [MANUAL.md](MANUAL.md) for complete EDL, Fastboot, and microSD installation instructions, keypad navigation shortcuts, and the multi-mode T9 reference.
+9 -4
View File
@@ -3,10 +3,15 @@
// Nokia 2720 Flip (nokia-beatles) external 240x240 GC9305 panel.
//
// Reference overlay for a DTB that still has the old single-panel layout.
// The shipping qcom-msm8905-nokia-beatles.dts now carries these exact nodes,
// so /dev/fb1 is available without applying an overlay at boot. Do NOT apply
// this overlay to the current shipping DTB (it would duplicate the mux); use
// scripts/build-beatles-no-cover-dtb.py instead to roll the cover panel back.
// The two-panel wiring is NOT applied to the shipping DTB: it lives in
// qcom-msm8905-nokia-beatles-cover.dts (opt-in, built by
// scripts/build-beatles-cover-panel.py). A live 2720 Flip test produced
// /dev/fb1 (240x240, 32bpp) and the full cover state machine, but the main
// 240x320 panel went dark with both panels registered; the gpio13 mux select
// and gpio21/gpio23 external DC/reset routing therefore still need physical
// probing before the opt-in DT can become the default. This file documents
// the wiring for older/stock DTBs; do not apply it to the current shipping
// DTB (it would duplicate the mux).
//
// Both panels share BLSP1 QUP5 SPI; gpio13 selects which one the bus reaches.
// spi-mux selects the mux state from the child chip-select number, so
+3
View File
@@ -3,3 +3,6 @@ pm8916-bms-vm
panel-mipi-dbi
matrix_keypad
matrix_keymap
mux-core
mux-gpio
spi-mux
File diff suppressed because it is too large. Load diff
Binary file not shown.
@@ -1033,24 +1033,12 @@
};
cover-panel-gpios-default-state {
/* External DC (gpio21) and reset (gpio23) only. gpio13 is the
* SPI mux select and must not be re-biased by the panel probe. */
pins = "gpio21", "gpio23";
pins = "gpio21", "gpio23", "gpio13";
function = "gpio";
drive-strength = <0x02>;
bias-pull-down;
phandle = <0x92>;
};
cover-mux-gpio-default-state {
/* Hold the mux on the internal panel until gpio-mux drives it,
* so the boot chain and Xorg keep the 240x320 main display. */
pins = "gpio13";
function = "gpio";
drive-strength = <0x02>;
bias-pull-down;
phandle = <0x93>;
};
};
clock-controller@1800000 {
@@ -1863,80 +1851,39 @@
#size-cells = <0x00>;
status = "okay";
spi-mux@0 {
compatible = "spi-mux";
display@0 {
compatible = "nokia,beatles-gc9305-panel", "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi";
reg = <0x00>;
#address-cells = <0x01>;
#size-cells = <0x00>;
backlight = <0x6b>;
reset-gpios = <0x27 0x19 0x00>;
dc-gpios = <0x27 0x6e 0x00>;
/* 25 MHz avoids high-backlight PWM noise corrupting the panel link. */
spi-max-frequency = <0x17d7840>;
mux-controls = <0x96>;
power-supply = <0x6c>;
io-supply = <0x6d>;
width-mm = <0x24>;
height-mm = <0x30>;
pinctrl-0 = <0x6e>;
pinctrl-names = "default";
display@0 {
compatible = "nokia,beatles-gc9305-panel", "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi";
reg = <0x00>;
backlight = <0x6b>;
reset-gpios = <0x27 0x19 0x00>;
dc-gpios = <0x27 0x6e 0x00>;
/* 25 MHz avoids high-backlight PWM noise corrupting the panel link. */
spi-max-frequency = <0x17d7840>;
power-supply = <0x6c>;
io-supply = <0x6d>;
width-mm = <0x24>;
height-mm = <0x30>;
pinctrl-0 = <0x6e>;
pinctrl-names = "default";
panel-timing {
hactive = <0xf0>;
vactive = <0x140>;
hback-porch = <0x00>;
vback-porch = <0x00>;
hfront-porch = <0x00>;
vfront-porch = <0x00>;
hsync-len = <0x00>;
vsync-len = <0x00>;
clock-frequency = "", "#(";
};
panel-timing {
hactive = <0xf0>;
vactive = <0x140>;
hback-porch = <0x00>;
vback-porch = <0x00>;
hfront-porch = <0x00>;
vfront-porch = <0x00>;
hsync-len = <0x00>;
vsync-len = <0x00>;
clock-frequency = "", "#(";
};
display@1 {
compatible = "nokia,beatles-gc9305-ext-panel", "panel-mipi-dbi-spi";
reg = <0x01>;
/* gpio21 is the external D/C line: 8-bit SPI works on QUP
* and gpio110 stays owned by the internal panel. */
dc-gpios = <0x27 0x15 0x00>;
reset-gpios = <0x27 0x17 0x00>;
/* Same verified 25 MHz clock as the internal panel. */
spi-max-frequency = <0x17d7840>;
power-supply = <0x6c>;
io-supply = <0x6d>;
width-mm = <0x1e>;
height-mm = <0x1e>;
pinctrl-0 = <0x92>;
pinctrl-names = "default";
write-only;
panel-timing {
hactive = <0xf0>;
vactive = <0xf0>;
hback-porch = <0x00>;
vback-porch = <0x00>;
hfront-porch = <0x00>;
vfront-porch = <0x00>;
hsync-len = <0x00>;
vsync-len = <0x00>;
clock-frequency = "", "#(";
};
};
};
spidev@1 {
compatible = "rohm,dh2228fv";
reg = <0x01>;
spi-max-frequency = <0x2faf080>;
/* spi-mux owns chip select 1 now; keep the node for the
* diagnostic spidev fallback, but leave it disabled. */
status = "disabled";
status = "okay";
};
};
@@ -2357,16 +2304,6 @@
phandle = <0x29>;
};
spi-panel-mux {
compatible = "gpio-mux";
#mux-control-cells = <0x00>;
mux-gpios = <0x27 0x0d 0x00>;
idle-state = <0x00>;
pinctrl-0 = <0x93>;
pinctrl-names = "default";
phandle = <0x96>;
};
gpio-keys {
compatible = "gpio-keys";
pinctrl-0 = <0x86 0x87>;
Binary file not shown.
+109
View File
@@ -0,0 +1,109 @@
#!/usr/bin/env python3
"""Build the opt-in 2720 Flip two-panel DTB (external GC9305 on /dev/fb1).
The shipping DTB keeps the verified single-panel layout. A live test showed
that registering the external panel makes the main panel go dark, so this DT
is deliberately opt-in until gpio13 mux polarity and the gpio21/gpio23 DC/
reset routing are probed on hardware.
./scripts/build-beatles-cover-panel.py # writes images/...cover.dtb
./scripts/build-beatles-cover-panel.py --check # validation only
./scripts/build-beatles-cover-panel.py --install # also patch local images
--install builds a separate cover boot.img and replaces boot.img/DTB in the
local raw image's pmOS_boot; it never changes the tracked DTS/DTB.
"""
import argparse
import pathlib
import subprocess
import sys
import tempfile
BASE = pathlib.Path(__file__).resolve().parent.parent
SOURCE = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts"
OUTPUT = BASE / "images/qcom-msm8905-nokia-beatles-cover.dtb"
def validate(text):
checks = (
'compatible = "spi-mux";',
'compatible = "gpio-mux";',
'nokia,beatles-gc9305-ext-panel',
'display@1 {',
'dc-gpios = <0x27 0x15 0x00>;',
'reset-gpios = <0x27 0x17 0x00>;',
'spi-max-frequency = <0x17d7840>;',
'status = "disabled";',
'qcom,msm-id = <0x14b 0x00>;',
'qcom,board-id = <0x1000b 0x100>;',
'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;',
'reg = <0x80000000 0x20000000>;',
)
for token in checks:
if token not in text:
return "opt-in DTB lost %s" % token
if 'pins = "gpio13";' not in text or \
'pins = "gpio21", "gpio23", "gpio13";' in text:
return "gpio13 is not isolated from the external panel pinctrl group"
return None
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--check", action="store_true",
help="validate the opt-in DT without writing images/")
parser.add_argument("--install", action="store_true",
help="also build a cover boot.img and patch the local raw image")
args = parser.parse_args()
if not SOURCE.is_file():
sys.stderr.write("FAIL: missing %s\n" % SOURCE.relative_to(BASE))
return 1
with tempfile.TemporaryDirectory(prefix="bananarchy-cover-dtb-") as tmp:
root = pathlib.Path(tmp)
dtb = root / "cover.dtb"
dec = root / "cover.dts"
for cmd in (["dtc", "-I", "dts", "-O", "dtb", "-o", str(dtb), str(SOURCE)],
["dtc", "-I", "dtb", "-O", "dts", "-o", str(dec), str(dtb)]):
proc = subprocess.run(cmd, capture_output=True, text=True)
if proc.returncode:
sys.stderr.write("FAIL: %s\n%s" % (" ".join(cmd), proc.stderr))
return 1
text = dec.read_text(encoding="utf-8", errors="replace")
problem = validate(text)
if problem:
sys.stderr.write("FAIL: %s\n" % problem)
return 1
if args.check:
print("[ok] opt-in two-panel DTB validated (%d bytes)" % dtb.stat().st_size)
return 0
OUTPUT.parent.mkdir(parents=True, exist_ok=True)
OUTPUT.write_bytes(dtb.read_bytes())
print("wrote %s" % OUTPUT.relative_to(BASE))
cover_boot = BASE / "images/boot-bananarchy-nokia-beatles-cover.img"
shipping_boot = BASE / "images/boot-bananarchy-nokia-beatles.img"
raw = BASE / "images/bananarchy-nokia-beatles.img"
repack = ["python3", str(BASE / "scripts/repack-beatles-bootimg.py"),
"--boot-image", str(shipping_boot), "--dtb", str(OUTPUT),
"--output", str(cover_boot)]
sync = ["python3", str(BASE / "scripts/sync-beatles-bootfs.py"),
"--raw-image", str(raw), "--boot-image", str(cover_boot),
"--dtb", str(OUTPUT)]
if not args.install:
print("install with: %s" % " ".join(repack))
print("then: %s" % " ".join(sync))
print("WARNING: verify the main panel before using this DT as a default.")
return 0
for cmd in (repack, sync):
proc = subprocess.run(cmd, capture_output=True, text=True)
if proc.returncode:
sys.stderr.write("FAIL: %s\n%s%s" %
(" ".join(cmd), proc.stdout, proc.stderr))
return 1
print(proc.stdout.strip())
print("opt-in DT installed into %s; update the pinned image hash in "
"check-rebuild.sh if this image is kept." % raw.name)
return 0
if __name__ == "__main__":
sys.exit(main())
+22 -54
View File
@@ -1,19 +1,14 @@
#!/usr/bin/env python3
"""Build a 2720 Flip DTB with the external panel disabled (hardware rollback).
"""Rollback DTB for the 2720 Flip: the verified single-panel shipping layout.
The cover panel DT is shipped enabled, but gpio13 mux polarity / external
reset polarity still need a live sign-off. If the main panel or keypad
regresses, this script produces a DTB that keeps the verified internal panel
and disables only display@1, without touching the spi-mux or the DTS source.
After enabling the opt-in two-panel DT, this is the file to put back in
pmOS_boot (and in the standalone boot image via repack-beatles-bootimg.py)
if the main panel or keypad regresses. It is simply the shipping DTB compiled
from the tracked DTS, so no source file is ever modified.
./scripts/build-beatles-no-cover-dtb.py # writes images/...no-cover.dtb
./scripts/build-beatles-no-cover-dtb.py --check # validation only
./scripts/build-beatles-no-cover-dtb.py --install # also patches local images
--install builds a separate no-cover boot.img and replaces boot.img/DTB in
the local raw image's pmOS_boot; it never changes the tracked DTS/DTB. Run
check-rebuild.sh before rolling back: in the rollback state its pmOS_boot
check expects the shipping DTB and will report the deliberate mismatch.
./scripts/build-beatles-no-cover-dtb.py --install # also patch local images
"""
import argparse
import pathlib
@@ -22,78 +17,52 @@ import sys
import tempfile
BASE = pathlib.Path(__file__).resolve().parent.parent
DTS = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts"
SOURCE = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts"
OUTPUT = BASE / "images/qcom-msm8905-nokia-beatles-no-cover.dtb"
OPENING = '\t\t\t\tdisplay@1 {\n'
MARKER = 'nokia,beatles-gc9305-ext-panel'
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--check", action="store_true",
help="validate the transformation without writing images/")
help="validate the rollback DTB without writing images/")
parser.add_argument("--install", action="store_true",
help="also build a no-cover boot.img and patch the local raw image")
help="also build a rollback boot.img and patch the local raw image")
args = parser.parse_args()
source = DTS.read_text()
start = source.find(OPENING)
if start < 0:
sys.stderr.write("FAIL: display@1 is missing from the shipping DTS\n")
return 1
end = source.find("\n\t\t\t\t};\n", start)
if end < 0:
sys.stderr.write("FAIL: display@1 node is not terminated\n")
return 1
block = source[start:end]
if MARKER not in block or 'status = "disabled";' in block:
sys.stderr.write("FAIL: unexpected display@1 node contents\n")
return 1
patched = (source[:start] + OPENING +
'\t\t\t\t\tstatus = "disabled";\n' +
source[start + len(OPENING):])
with tempfile.TemporaryDirectory(prefix="bananarchy-no-cover-") as tmp:
root = pathlib.Path(tmp)
dts = root / "no-cover.dts"
dtb = root / "no-cover.dtb"
dec = root / "no-cover-decomp.dts"
dts.write_text(patched)
for cmd in (["dtc", "-I", "dts", "-O", "dtb", "-o", str(dtb), str(dts)],
dec = root / "no-cover.dts"
for cmd in (["dtc", "-I", "dts", "-O", "dtb", "-o", str(dtb), str(SOURCE)],
["dtc", "-I", "dtb", "-O", "dts", "-o", str(dec), str(dtb)]):
proc = subprocess.run(cmd, capture_output=True, text=True)
if proc.returncode:
sys.stderr.write("FAIL: %s\n%s" % (" ".join(cmd), proc.stderr))
return 1
text = dec.read_text(encoding="utf-8", errors="replace")
ext_start = text.find("display@1 {")
ext = text[ext_start:text.find("\n\t\t\t\t};", ext_start) + 10] \
if ext_start >= 0 else ""
if 'status = "disabled";' not in ext or MARKER not in ext:
sys.stderr.write("FAIL: rollback DTB did not disable the external panel\n")
return 1
for token in ('qcom,msm-id = <0x14b 0x00>;',
'qcom,board-id = <0x1000b 0x100>;',
'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;',
'reg = <0x80000000 0x20000000>;',
'dc-gpios = <0x27 0x6e 0x00>;',
'spi-max-frequency = <0x17d7840>;'):
for token in ('display@0 {', 'spidev@1 {', 'status = "okay";',
'qcom,msm-id = <0x14b 0x00>;',
'reg = <0x80000000 0x20000000>;'):
if token not in text:
sys.stderr.write("FAIL: rollback DTB lost %s\n" % token)
return 1
if 'compatible = "spi-mux"' in text or 'display@1 {' in text:
sys.stderr.write("FAIL: rollback DTB still contains the cover mux\n")
return 1
if args.check:
print("[ok] no-cover DTB transformation validated (%d bytes)" %
print("[ok] single-panel rollback DTB validated (%d bytes)" %
dtb.stat().st_size)
return 0
OUTPUT.parent.mkdir(parents=True, exist_ok=True)
OUTPUT.write_bytes(dtb.read_bytes())
print("wrote %s" % OUTPUT.relative_to(BASE))
no_cover_boot = BASE / "images/boot-bananarchy-nokia-beatles-no-cover.img"
rollback_boot = BASE / "images/boot-bananarchy-nokia-beatles-no-cover.img"
shipping_boot = BASE / "images/boot-bananarchy-nokia-beatles.img"
raw = BASE / "images/bananarchy-nokia-beatles.img"
repack = ["python3", str(BASE / "scripts/repack-beatles-bootimg.py"),
"--boot-image", str(shipping_boot), "--dtb", str(OUTPUT),
"--output", str(no_cover_boot)]
"--output", str(rollback_boot)]
sync = ["python3", str(BASE / "scripts/sync-beatles-bootfs.py"),
"--raw-image", str(raw), "--boot-image", str(no_cover_boot),
"--raw-image", str(raw), "--boot-image", str(rollback_boot),
"--dtb", str(OUTPUT)]
if not args.install:
print("install with: %s" % " ".join(repack))
@@ -106,8 +75,7 @@ def main():
(" ".join(cmd), proc.stdout, proc.stderr))
return 1
print(proc.stdout.strip())
print("rollback installed into %s; restore the shipping DTB/boot.img with "
"sync-beatles-bootfs.py (no overrides) to undo." % raw.name)
print("rollback installed into %s" % raw.name)
return 0
+38 -17
View File
@@ -369,8 +369,8 @@ fi
echo "[check] Known-good flashable image set..."
for pair in \
"69a44f60eb123ebddf600be927155dc4a599ec35b7a0cf80060f4ba01f599f08 images/bananarchy-nokia-argon.img" \
"185ae4fcd8aa4bb65ff03711e50c68a1af073ff13402ddd053e65b65f11b6460 images/bananarchy-nokia-beatles.img" \
"9862c9f7c22988537737e5a1d0d07952200bc5aecc9577107fca775ef8c9514b images/boot-bananarchy-nokia-beatles.img" \
"30c470600d1187f463cd76319e96ecf0ed0af55858b2ae8244e588340a641942 images/bananarchy-nokia-beatles.img" \
"2b5c61aba307dbbda61f3b19a2ad5770f9854f41cba4e2c97e24efb7e20879f3 images/boot-bananarchy-nokia-beatles.img" \
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do
set -- $pair
want=$1
@@ -634,14 +634,13 @@ for token in 'qcom,msm-id = <0x14b 0x00>;' \
fail "the shipping beatles DTB lost a stock Qualcomm ID ($token)"
fi
done
if ! grep -qF 'compatible = "spi-mux"' "$COVER_DTS" || \
! grep -qF 'compatible = "gpio-mux"' "$COVER_DTS" || \
! grep -qF 'nokia,beatles-gc9305-ext-panel' "$COVER_DTS" || \
! grep -qF 'display@1 {' "$COVER_DTS"; then
fail "the shipping beatles DTB lost the external panel (/dev/fb1) wiring"
if grep -qF 'compatible = "spi-mux"' "$COVER_DTS" || \
grep -qF 'compatible = "gpio-mux"' "$COVER_DTS" || \
grep -qF 'display@1 {' "$COVER_DTS"; then
fail "the shipping beatles DTB applies the hardware-gated cover overlay"
fi
if ! grep -A6 'spidev@1 {' "$COVER_DTS" | grep -qF 'status = "disabled"'; then
fail "spidev@1 must stay disabled while spi-mux owns chip select 1"
if ! grep -A4 'spidev@1 {' "$COVER_DTS" | grep -qF 'status = "okay"'; then
fail "the shipping beatles DTB lost the spidev@1 diagnostic fallback"
fi
for f in "$BASE_DIR/overlay/rootfs/usr/share/mkinitfs/files/00-nokia-argon-display.files" \
"$BASE_DIR/devices/nokia-beatles/00-nokia-beatles-display.files"; do
@@ -1320,12 +1319,19 @@ if command -v gcc >/dev/null 2>&1 && \
fail "host cover display behaviour test failed"
fi
echo "[check] 2720 Flip external panel (/dev/fb1)..."
if [ ! -x "$BASE_DIR/scripts/test-cover-dt.py" ]; then
fail "missing host DT validation scripts/test-cover-dt.py"
elif command -v dtc >/dev/null 2>&1 && \
! "$BASE_DIR/scripts/test-cover-dt.py" >/dev/null 2>&1; then
fail "host 2720 Flip /dev/fb1 DT validation failed"
echo "[check] 2720 Flip external panel (opt-in DT)..."
if [ ! -f "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts" ] || \
[ ! -x "$BASE_DIR/scripts/build-beatles-cover-panel.py" ] || \
[ ! -x "$BASE_DIR/scripts/test-cover-dt.py" ]; then
fail "missing the opt-in cover DT source or its host validation tools"
fi
if command -v dtc >/dev/null 2>&1; then
if ! "$BASE_DIR/scripts/build-beatles-cover-panel.py" --check >/dev/null 2>&1; then
fail "opt-in two-panel DTB validation failed"
fi
if ! "$BASE_DIR/scripts/test-cover-dt.py" >/dev/null 2>&1; then
fail "host 2720 Flip DT wiring validation failed"
fi
fi
echo "[check] Cover panel diagnostics..."
@@ -1343,12 +1349,27 @@ if ! grep -qF 'bananarchy-cover-diagnose.sh' \
fail "apply-bananarchy-overlay.sh no longer installs the cover diagnostics"
fi
echo "[check] 2720 Flip cover rollback..."
echo "[check] 2720 Flip initramfs mux modules..."
MODULES_INITFS="$BASE_DIR/devices/nokia-beatles/modules-initfs"
for mod in mux-core mux-gpio spi-mux panel-mipi-dbi; do
if ! grep -qxF "$mod" "$MODULES_INITFS"; then
fail "devices/nokia-beatles/modules-initfs no longer loads $mod in the initramfs"
fi
done
for ko in "$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/mux/mux-core.ko.zst" \
"$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/mux/mux-gpio.ko.zst" \
"$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/spi/spi-mux.ko.zst"; do
if [ ! -f "$ko" ]; then
fail "${ko#"$BASE_DIR/"} is missing from the overlay module tree"
fi
done
echo "[check] 2720 Flip single-panel rollback..."
if [ ! -x "$BASE_DIR/scripts/build-beatles-no-cover-dtb.py" ]; then
fail "missing rollback builder scripts/build-beatles-no-cover-dtb.py"
elif command -v dtc >/dev/null 2>&1 && \
! "$BASE_DIR/scripts/build-beatles-no-cover-dtb.py" --check >/dev/null 2>&1; then
fail "the no-cover DTB rollback transformation failed validation"
fail "the single-panel rollback DTB failed validation"
fi
if ! grep -qF 'parser.add_argument("--dtb"' \
"$BASE_DIR/scripts/sync-beatles-bootfs.py" || \
+102 -91
View File
@@ -1,9 +1,11 @@
#!/usr/bin/env python3
"""Host validation for the 2720 Flip external panel (/dev/fb1) DT wiring.
"""Host validation for the 2720 Flip external panel DT wiring.
Checks the shipping DTB (not just its DTS source), the firmware/initramfs
lists and the Xorg/ module configuration so the second panel cannot silently
disappear or regress the verified main-panel path.
The shipping DTB must stay on the verified single-panel layout: a live test
showed that registering the external panel darkens the main panel. The
two-panel wiring is therefore an opt-in source, validated here in detail so
it is ready for the gpio13/reset/DC hardware sign-off. Also checks the
firmware/initramfs lists, mux modules and Xorg pin shared by both layouts.
"""
import hashlib
import pathlib
@@ -15,6 +17,7 @@ import tempfile
BASE = pathlib.Path(__file__).resolve().parent.parent
DTS = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts"
DTB = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles.dtb"
OPTIN_DTS = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts"
DTB_COPIES = (
BASE / "overlay/rootfs/boot/qcom-msm8905-nokia-beatles.dtb",
BASE / "prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-beatles.dtb",
@@ -29,36 +32,15 @@ XORG = BASE / "overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf"
KCONFIG = BASE / "patches/kernel/config-bananarchy-msm8909.armv7"
MODULES_LOAD = BASE / "overlay/rootfs/etc/modules-load.d/bananarchy-hardware.conf"
LOCAL_START = BASE / "overlay/rootfs/etc/local.d/10-bananarchy-hardware.start"
BOOT_IMAGE = BASE / "images/boot-bananarchy-nokia-beatles.img"
def fail(message):
sys.stderr.write("FAIL: %s\n" % message)
return 1
def appended_dtb_matches(dtb_bytes):
"""The standalone boot.img must carry the same DTB as devices/."""
if not BOOT_IMAGE.is_file():
return True, "skipped (local build output absent)"
data = BOOT_IMAGE.read_bytes()
if data[:8] != b"ANDROID!":
return False, "boot image has no Android header"
page = struct.unpack_from("<I", data, 36)[0] # page_size
kernel_size = struct.unpack_from("<I", data, 8)[0]
dtb_rel = struct.unpack_from("<I", data, page + 0x2c)[0]
dtb_abs = page + dtb_rel
if not 0 < dtb_rel < kernel_size or data[dtb_abs:dtb_abs + 4] != b"\xd0\x0d\xfe\xed":
return False, "kernel+0x2c does not point at an FDT"
embedded = data[dtb_abs:page + kernel_size]
if embedded[:len(dtb_bytes)] != dtb_bytes:
return False, "appended DTB is stale"
return True, "ok"
def node(text, opening):
"""Return the text of a DT node from its opening line to its matching brace."""
start = text.find(opening)
if start < 0:
return ""
@@ -73,9 +55,35 @@ def node(text, opening):
return ""
def appended_dtb_matches(dtb_bytes):
if not BOOT_IMAGE.is_file():
return True, "skipped (local build output absent)"
data = BOOT_IMAGE.read_bytes()
if data[:8] != b"ANDROID!":
return False, "boot image has no Android header"
page = struct.unpack_from("<I", data, 36)[0]
kernel_size = struct.unpack_from("<I", data, 8)[0]
dtb_rel = struct.unpack_from("<I", data, page + 0x2c)[0]
dtb_abs = page + dtb_rel
if not 0 < dtb_rel < kernel_size or data[dtb_abs:dtb_abs + 4] != b"\xd0\x0d\xfe\xed":
return False, "kernel+0x2c does not point at an FDT"
embedded = data[dtb_abs:page + kernel_size]
if embedded[:len(dtb_bytes)] != dtb_bytes:
return False, "appended DTB is stale"
return True, "ok"
def decompile(dtb, target):
proc = subprocess.run(["dtc", "-I", "dtb", "-O", "dts", "-o", str(target),
str(dtb)], capture_output=True, text=True)
if proc.returncode:
return None
return target.read_text(encoding="utf-8", errors="replace")
def main():
for path in (DTS, DTB, FIRMWARE, XORG, KCONFIG, MODULES_LOAD, LOCAL_START,
*DTB_COPIES, *INITRAMFS_LISTS):
for path in (DTS, DTB, OPTIN_DTS, FIRMWARE, XORG, KCONFIG, MODULES_LOAD,
LOCAL_START, *DTB_COPIES, *INITRAMFS_LISTS):
if not path.is_file():
return fail("missing %s" % path.relative_to(BASE))
with tempfile.TemporaryDirectory(prefix="bananarchy-cover-dt-") as tmp:
@@ -88,7 +96,7 @@ def main():
return fail("shipping DTS does not compile: %s" % build.stderr.strip())
if built.read_bytes() != DTB.read_bytes():
return fail("the shipping DTB is stale; recompile it from the DTS")
print("[ok] DTB matches the shipping DTS")
print("[ok] shipping DTB matches the shipping DTS")
for copy in DTB_COPIES:
if hashlib.sha256(copy.read_bytes()).digest() != \
hashlib.sha256(DTB.read_bytes()).digest():
@@ -98,83 +106,86 @@ def main():
if not ok:
return fail("2720 boot image: %s" % detail)
print("[ok] standalone boot.img appended DTB: %s" % detail)
decompile = subprocess.run(["dtc", "-I", "dtb", "-O", "dts", "-o", str(dec),
str(DTB)], capture_output=True, text=True)
if decompile.returncode:
text = decompile(DTB, dec)
if text is None:
return fail("cannot decompile the shipping DTB")
text = dec.read_text(encoding="utf-8", errors="replace")
for token in ('qcom,msm-id = <0x14b 0x00>;',
'qcom,board-id = <0x1000b 0x100>;',
'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;',
'reg = <0x80000000 0x20000000>;'):
if token not in text:
return fail("shipping DTB lost %s" % token)
if 'compatible = "spi-mux"' in text or 'display@1 {' in text:
return fail("shipping DTB must keep the verified single-panel layout")
if 'status = "okay";' not in node(text, "spidev@1 {"):
return fail("shipping DTB lost the spidev@1 diagnostic fallback")
print("[ok] shipping DTB keeps the verified single-panel layout")
# Stock boot identifiers and memory fallback must survive the DT change.
for token in ('qcom,msm-id = <0x14b 0x00>;',
'qcom,board-id = <0x1000b 0x100>;',
'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;',
'reg = <0x80000000 0x20000000>;'):
if token not in text:
return fail("shipping DTB lost %s" % token)
print("[ok] stock Qualcomm IDs and 512 MiB memory fallback preserved")
optin = root / "optin.dtb"
optin_dec = root / "optin.dts"
build = subprocess.run(["dtc", "-I", "dts", "-O", "dtb", "-o", str(optin),
str(OPTIN_DTS)], capture_output=True, text=True)
if build.returncode:
return fail("opt-in cover DTS does not compile: %s" % build.stderr.strip())
opt = decompile(optin, optin_dec)
if opt is None:
return fail("cannot decompile the opt-in cover DTB")
mux = node(opt, "spi-mux@0 {")
internal = node(mux, "display@0 {")
external = node(mux, "display@1 {")
if 'compatible = "spi-mux";' not in mux or \
'compatible = "gpio-mux";' not in node(opt, "spi-panel-mux {") or \
not internal or not external:
return fail("opt-in DT lost the two-panel spi-mux wiring")
if 'nokia,beatles-gc9305-panel' not in internal or \
"spi-max-frequency = <0x17d7840>;" not in internal or \
"dc-gpios = <0x27 0x6e 0x00>;" not in internal:
return fail("opt-in DT changed the verified main panel path")
if 'nokia,beatles-gc9305-ext-panel' not in external or \
"spi-max-frequency = <0x17d7840>;" not in external or \
"dc-gpios = <0x27 0x15 0x00>;" not in external or \
"reset-gpios = <0x27 0x17 0x00>;" not in external or \
"write-only;" not in external or "vactive = <0xf0>;" not in external:
return fail("opt-in external panel node lost its 8-bit/240x240 wiring")
cover_pins = node(opt, "cover-panel-gpios-default-state {")
mux_pins = node(opt, "cover-mux-gpio-default-state {")
if "gpio13" in cover_pins or 'pins = "gpio21", "gpio23";' not in cover_pins:
return fail("opt-in external panel pinctrl still steals gpio13")
if 'pins = "gpio13";' not in mux_pins or "bias-pull-down;" not in mux_pins:
return fail("opt-in gpio13 has no dedicated pull-down pinctrl state")
if 'status = "disabled";' not in node(opt, "spidev@1 {"):
return fail("opt-in spidev@1 still owns chip select 1")
print("[ok] opt-in two-panel DT validated (hardware sign-off still required)")
mux = node(text, "spi-mux@0 {")
if not mux or 'compatible = "spi-mux";' not in mux or \
"mux-controls = <0x96>;" not in mux or \
"spi-max-frequency = <0x17d7840>;" not in mux:
return fail("spi-mux node is missing or has the wrong clock/control")
internal = node(mux, "display@0 {")
external = node(mux, "display@1 {")
if not internal or not external:
return fail("both panels must be children of spi-mux@0")
if 'compatible = "nokia,beatles-gc9305-panel"' not in internal or \
"spi-max-frequency = <0x17d7840>;" not in internal or \
"dc-gpios = <0x27 0x6e 0x00>;" not in internal or \
"pinctrl-0 = <0x6e>;" not in internal:
return fail("the verified main panel path changed")
if 'compatible = "nokia,beatles-gc9305-ext-panel"' not in external or \
"panel-mipi-dbi-spi" not in external or \
"spi-max-frequency = <0x17d7840>;" not in external or \
"dc-gpios = <0x27 0x15 0x00>;" not in external or \
"reset-gpios = <0x27 0x17 0x00>;" not in external or \
"write-only;" not in external or \
"vactive = <0xf0>;" not in external:
return fail("external panel node is missing its 8-bit/240x240 wiring")
print("[ok] two 25 MHz panel-mipi-dbi-spi displays behind spi-mux")
gpio_mux = node(text, "spi-panel-mux {")
if 'compatible = "gpio-mux";' not in gpio_mux or \
"mux-gpios = <0x27 0x0d 0x00>;" not in gpio_mux or \
"idle-state = <0x00>;" not in gpio_mux or \
"pinctrl-0 = <0x93>;" not in gpio_mux:
return fail("gpio13 mux controller is missing its idle/internal state")
cover_pins = node(text, "cover-panel-gpios-default-state {")
mux_pins = node(text, "cover-mux-gpio-default-state {")
if "gpio13" in cover_pins or 'pins = "gpio21", "gpio23";' not in cover_pins:
return fail("the external panel pinctrl state still steals gpio13")
if 'pins = "gpio13";' not in mux_pins or "bias-pull-down;" not in mux_pins:
return fail("gpio13 has no dedicated pull-down pinctrl state")
print("[ok] gpio13 mux select is isolated from the external panel pinctrl")
spidev = node(text, "spidev@1 {")
if 'status = "disabled";' not in spidev:
return fail("spidev@1 still owns chip select 1")
if 'Option "kmsdev" "/dev/dri/card0"' not in XORG.read_text():
return fail("Xorg no longer pins the internal DRM card")
print("[ok] spidev disabled and Xorg keeps card0")
return fail("Xorg no longer pins the main DRM card")
if not FIRMWARE.read_bytes().startswith(b"MIPI DBI"):
return fail("external panel firmware is not a MIPI DBI command stream")
for lst in INITRAMFS_LISTS:
if FW_LIST not in lst.read_text().splitlines():
return fail("%s does not ship the cover firmware in the initramfs" %
lst.relative_to(BASE))
kconfig = KCONFIG.read_text().splitlines()
for opt in ("CONFIG_MULTIPLEXER=m", "CONFIG_MUX_GPIO=m", "CONFIG_SPI_MUX=m"):
if opt not in kconfig:
return fail("kernel config lost %s" % opt)
kernel_config = KCONFIG.read_text().splitlines()
for opt_name in ("CONFIG_MULTIPLEXER=m", "CONFIG_MUX_GPIO=m", "CONFIG_SPI_MUX=m"):
if opt_name not in kernel_config:
return fail("kernel config lost %s" % opt_name)
initfs_modules = (BASE / "devices/nokia-beatles/modules-initfs").read_text().splitlines()
for mod in ("mux-core", "mux-gpio", "spi-mux", "panel-mipi-dbi"):
if mod not in initfs_modules:
return fail("devices/nokia-beatles/modules-initfs lost %s" % mod)
for ko in ("overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/mux/mux-core.ko.zst",
"overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/mux/mux-gpio.ko.zst",
"overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/spi/spi-mux.ko.zst"):
if not (BASE / ko).is_file():
return fail("missing initramfs module artifact %s" % ko)
for script in (MODULES_LOAD, LOCAL_START):
body = script.read_text()
for mod in ("mux-core", "mux-gpio", "spi-mux"):
if mod not in body:
return fail("%s no longer loads %s" % (script.name, mod))
print("[ok] initramfs firmware and mux modules are provisioned")
print("2720 Flip /dev/fb1 DT wiring: all checks passed")
print("[ok] Xorg pin, initramfs firmware and mux modules are provisioned")
print("2720 Flip DT wiring: all checks passed")
return 0