Add a no-cover DTB rollback for 2720 Flip hardware sign-off

This commit is contained in:
Luxferre committed 2026-11-10 14:14:47 +02:00
1 parent 90e6771700
commit 31db372779
8 files changed
+153 -11

No files matched your search

+1
View File
@@ -57,6 +57,7 @@ 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/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.
+1
View File
@@ -21,6 +21,7 @@ Work since `a1108` has focused on reliable 2720 Flip hardware support and a repr
- **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.
### 2720 Flip cover display behaviour
+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. "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 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).
- **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.
+1 -1
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.
- **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.
- **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.
+3 -2
View File
@@ -4,8 +4,9 @@
//
// 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. This file is
// kept for older/stock DTBs and for describing the wiring in one place.
// 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.
//
// 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
+115
View File
@@ -0,0 +1,115 @@
#!/usr/bin/env python3
"""Build a 2720 Flip DTB with the external panel disabled (hardware rollback).
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.
./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.
"""
import argparse
import pathlib
import subprocess
import sys
import tempfile
BASE = pathlib.Path(__file__).resolve().parent.parent
DTS = 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/")
parser.add_argument("--install", action="store_true",
help="also build a no-cover 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)],
["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>;'):
if token not in text:
sys.stderr.write("FAIL: rollback DTB lost %s\n" % token)
return 1
if args.check:
print("[ok] no-cover DTB transformation 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"
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)]
sync = ["python3", str(BASE / "scripts/sync-beatles-bootfs.py"),
"--raw-image", str(raw), "--boot-image", str(no_cover_boot),
"--dtb", str(OUTPUT)]
if not args.install:
print("install with: %s" % " ".join(repack))
print("then: %s" % " ".join(sync))
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("rollback installed into %s; restore the shipping DTB/boot.img with "
"sync-beatles-bootfs.py (no overrides) to undo." % raw.name)
return 0
if __name__ == "__main__":
sys.exit(main())
+14
View File
@@ -1343,6 +1343,20 @@ 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..."
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"
fi
if ! grep -qF 'parser.add_argument("--dtb"' \
"$BASE_DIR/scripts/sync-beatles-bootfs.py" || \
! grep -qF 'parser.add_argument("--boot-image"' \
"$BASE_DIR/scripts/sync-beatles-bootfs.py"; then
fail "sync-beatles-bootfs.py lost its DTB/boot-image overrides"
fi
if [ "$FAILURES" -ne 0 ]; then
echo "[check] $FAILURES check(s) failed."
exit 1
+17 -7
View File
@@ -118,7 +118,9 @@ def validate_cmdline(conf, allow_debug=False):
return append
def check(raw_path, dtb_path, boot_img_path, verbose=True, allow_debug=False):
def check(raw_path, dtb_path, boot_img_path, verbose=True, allow_debug=False,
files=None):
files = files if files is not None else BOOT_FS_FILES
raw = open(raw_path, "rb").read(1024 * 1024 + 4096)
offset, size = mbr_first_partition(raw)
if len(raw) < offset + 2048 or raw[offset + EXT2_MAGIC_OFFSET:offset + EXT2_MAGIC_OFFSET + 2] != EXT2_MAGIC:
@@ -140,7 +142,7 @@ def check(raw_path, dtb_path, boot_img_path, verbose=True, allow_debug=False):
if "fdt /qcom-msm8905-nokia-beatles.dtb" not in conf:
raise ValueError("extlinux.conf does not name the beatles DTB")
validate_cmdline(conf, allow_debug)
for name, expected in BOOT_FS_FILES.items():
for name, expected in files.items():
got = sha(cat(fs, "/" + name))
want = sha(open(expected, "rb").read())
if got != want:
@@ -166,10 +168,17 @@ def main():
parser.add_argument("--allow-debug", action="store_true",
help="With --check, accept a diagnostic cmdline")
parser.add_argument("--check", action="store_true")
parser.add_argument("--dtb", default=str(BOOT_FS_FILES["qcom-msm8905-nokia-beatles.dtb"]),
help="Override the DTB written to/checked in pmOS_boot")
parser.add_argument("--boot-image", default=str(BOOT_FS_FILES["boot.img"]),
help="Override the boot.img written to/checked in pmOS_boot")
args = parser.parse_args()
dtb = BOOT_FS_FILES["qcom-msm8905-nokia-beatles.dtb"]
boot_img = BOOT_FS_FILES["boot.img"]
dtb = Path(args.dtb)
boot_img = Path(args.boot_image)
boot_files = dict(BOOT_FS_FILES)
boot_files["qcom-msm8905-nokia-beatles.dtb"] = dtb
boot_files["boot.img"] = boot_img
for path in (args.raw_image, str(dtb), str(boot_img)):
if not os.path.isfile(path):
print("FAIL: missing %s" % path)
@@ -177,7 +186,8 @@ def main():
if args.check:
try:
check(args.raw_image, dtb, boot_img, allow_debug=args.allow_debug)
check(args.raw_image, dtb, boot_img, allow_debug=args.allow_debug,
files=boot_files)
return 0
except ValueError as exc:
print("FAIL: %s" % exc)
@@ -212,7 +222,7 @@ def main():
raise ValueError("source boot fs has no ext2 superblock")
commands = []
for name, host_path in BOOT_FS_FILES.items():
for name, host_path in boot_files.items():
commands += ["rm /%s" % name,
"write %s /%s" % (host_path, name)]
conf = cat(fs, "/extlinux/extlinux.conf").decode("utf-8", "replace")
@@ -251,7 +261,7 @@ def main():
os.unlink(fs)
try:
check(args.raw_image, dtb, boot_img)
check(args.raw_image, dtb, boot_img, files=boot_files)
except ValueError as exc:
print("FAIL: %s" % exc)
return 1