Use target hostnames and restore lk2nd bootloader reboot

This commit is contained in:
Luxferre committed 2026-11-09 23:44:44 +02:00
1 parent 1c011b360a
commit 3b96b8f242
22 files changed
+203 -70

No files matched your search

+5 -3
View File
@@ -27,7 +27,7 @@ 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.
@@ -95,8 +95,10 @@ network-up events, and keep `var/lib/chrony` owned by the `chrony` user. Network
## 5. Final 2720 Flip image method
- `images/bananarchy-nokia-beatles.img`, `images/boot-bananarchy-nokia-beatles.img`, and `images/boot-lk2nd-nokia-beatles-display.img` are the physically verified known-good release artifacts. Their hashes are pinned by `scripts/check-rebuild.sh`, and `images/bananarchy-nokia-argon.img` is pinned as the matching 8110 4G release image.
- The known-good display lk2nd binary predates the low-bit reboot cookie. `scripts/check-lk2nd-beatles.py` accepts that one image with `--allow-missing-cookie`; `scripts/build-lk2nd-beatles.sh`, `scripts/test-lk2nd-beatles-port.py`, and `scripts/check-rebuild.sh` pass the flag only for the display variant. The source patch still contains the cookie for future source-built images.
- `images/bananarchy-nokia-beatles.img`, `images/boot-bananarchy-nokia-beatles.img`, and `images/boot-lk2nd-nokia-beatles-display.img` are the current verified release artifacts. Their hashes are pinned by `scripts/check-rebuild.sh`, and `images/bananarchy-nokia-argon.img` is pinned as the matching 8110 4G release image. These files are local build outputs, not tracked in git; clean clones rebuild them from source.
- The shipping display lk2nd image is rebuilt from the pinned source patch and must contain the low-bit reboot cookie. `scripts/check-lk2nd-beatles.py`, `scripts/build-lk2nd-beatles.sh`, `scripts/test-lk2nd-beatles-port.py`, and `scripts/check-rebuild.sh` reject a display image without it; `prepare-release.sh` rebuilds stale or missing lk2nd images before packaging.
- `scripts/set-bananarchy-hostname.sh` writes `/etc/hostname`, `/etc/hosts` and the OpenRC hostname runlevel link from the canonical target name. Both bootstrap and overlay application call it, and `check-rebuild.sh` verifies all five target codenames.
- The Power menu item is **Reboot to bootloader** and calls `sxmo_power.sh bootloader`. The torch module uses the low-bit cookie on `nokia,beatles` and both low/high lanes on other targets, preserving generic lk2nd compatibility. The default `147147` unlock passcode provisioning is guarded, and the locker/passcode path is unchanged.
- `src/sxmo-dwm/dwm.c` uses the known-good 350 ms wake guard. Do not reintroduce the 120 ms `WAKE_KEY_DEBOUNCE_MS` experiment: it allowed a cold-boot key to open a resident `dmenu` window that held the keyboard grab.
- `overlay/rootfs/usr/bin/bananarchy-x11-session.sh` performs one startup `dwm-plugin dmenu close`, trusted locker `CLOSE`, and `Escape` key to release stale startup keyboard grabs. It does not leave a background poller running.
- `prepare-release.sh` packages the verified images by default and copies `bootloader/lk2nd-msm8909.img` for non-beatles targets. Set `BA_REBUILD=1` only when intentionally regenerating images from source.
+11 -3
View File
@@ -9,6 +9,14 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
---
## Unreleased — target hostnames and verified bootloader reboot
- **Target-specific hostname**: added `scripts/set-bananarchy-hostname.sh` as the single source for `/etc/hostname`, `/etc/hosts` and the OpenRC hostname runlevel link. Both the clean bootstrap and the overlay application call it, so `nokia-argon`, `nokia-beatles`, `nokia-tough`, `nokia-sparkler` and `nokia-leo` images no longer inherit the `nokia-argon` default. `check-rebuild.sh` executes the helper for all five canonical targets and guards the default `147147` unlock passcode hash generation; the locker/passcode path was left unchanged after the user confirmed it works.
- **Reboot to bootloader**: the Power menu item is now **Reboot to bootloader** and calls `sxmo_power.sh bootloader` (the `loader` alias remains). The torch module writes the low-only `FASTBOOT_MODE` cookie on the beatles stock chain and the dual low/high cookie on other targets, so both the patched beatles lk2nd and generic lk2nd can read the reboot reason. The rebuilt module keeps the `6.12.1-msm8916 SMP preempt mod_unload ARMv7 p2v8` vermagic.
- **Cookie-enabled display lk2nd**: rebuilt `images/boot-lk2nd-nokia-beatles-display.img` from the pinned upstream commit and patch. Its hash is `b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d`, the same source-built image whose visible Fastboot menu was previously live-verified. The temporary `--allow-missing-cookie` validator escape was removed; `prepare-release.sh` now rebuilds stale or missing lk2nd images before packaging.
- **Minimal image update**: patched only hostname/hosts, the dmenu label, the power/context menu text, `sxmo_power.sh` and the torch module inside both local raw images; `locker.so`, `dwm`, the X session and the known-good main-panel stack are unchanged. New local raw image hashes are `69a44f60eb123ebddf600be927155dc4a599ec35b7a0cf80060f4ba01f599f08` for `nokia-argon` and `f4e9b8b2b36d4ffa9ba4f74de293b14f16b5ed45bbd5ab1d62bc2023242b73b2` for `nokia-beatles`; both standalone and raw boot filesystems are unchanged.
- **Validation**: `check-rebuild.sh` passes with and without local `images/`, `sync-prebuilt-overlay.sh --check` reports zero drift, `test-lk2nd-beatles-port.py` requires the reboot cookie, `check-beatles-bootimg.py` and `sync-beatles-bootfs.py --check` pass, and `e2fsck -fn` is clean on both patched root filesystems. Both `nokia-argon` and `nokia-beatles` were rebuilt into scratch `IMAGES_DIR` outputs with `--mkinitfs`; each image has the correct hostname, menu label and rebuilt torch module, and both source-built boot images pass the boot-image validator. The exact `b554…` lk2nd image was live-verified earlier; no additional EDL/fastboot reboot loop was performed.
## Unreleased — decisive known-good 2720 Flip recovery
- **Live regression**: after the final `a1108` image set, X started and SSH worked, but the user saw a garbled main panel and reported that input was unresponsive. X inspection found a viewable `dmenu` window holding the keyboard path; `xdotool key Escape` unmapped it. The fullscreen `Phone Lock` window was already unmapped.
@@ -21,7 +29,7 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
- **Flash result**: `boot` and `recovery` read-back matched, `userdata` wrote successfully, the stock `system` superblock was cleared, and reset returned `18d1:d001` Linux USB with root SSH, user network, Xorg and dwm running.
- **Post-boot state**: `state=unlock`, no lock flag, backlight 14, `xset` OK, `keypad`, `gpio-keys` and `pm8941_pwrkey` enumerated by X, `fb0=240,320` at 32 bpp, `/dev/fb1` absent, no `spi_mux`/`mux_gpio`/`mux_core` loaded, and both `dmenu` and `Phone Lock` windows unmapped. The X screenshot is a normal 240x320 desktop with 12118 colors rather than a garbled or blank frame.
- **Release note**: the verified `images/` artifacts are local build outputs and are not tracked in git. `scripts/check-rebuild.sh` pins their hashes when present; `prepare-release.sh` rebuilds missing artifacts from source and copies `bootloader/lk2nd-msm8909.img` for non-beatles targets. `BA_REBUILD=1` remains the explicit forced-rebuild path.
- **Final source guard**: `dwm` is back on the known-good 350 ms wake guard, and the X session performs one startup `dmenu` close plus `Escape` to release stale keyboard grabs. The known-good display lk2nd binary predates the low-bit reboot cookie, so `scripts/check-lk2nd-beatles.py` accepts that one image with `--allow-missing-cookie` while the source patch retains the cookie.
- **Final source guard**: `dwm` is back on the known-good 350 ms wake guard, and the X session performs one startup `dmenu` close plus `Escape` to release stale keyboard grabs. The later release image is rebuilt from source and now requires the low-bit reboot cookie; `--allow-missing-cookie` was removed.
- **Cleanup**: EDL backup dumps, local lk2nd build caches, Python bytecode, stale diagnostic boot images and scratch logs were removed from the release tree. Image blobs were removed from git tracking while the local verified copies remain available for immediate packaging and flashing. Both `nokia-argon` and `nokia-beatles` images were rebuilt into scratch output directories and validated for flashability without overwriting the verified release images.
## Unreleased — cover overlay rollback after live regression
@@ -30,7 +38,7 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
- **Rollback**: restored the known-good single-panel beatles DTB (`8a14f7bc...`), removed the folded `spi-mux`/`gpio-mux`/external-panel nodes from `qcom-msm8905-nokia-beatles.dts`, restored `spidev@1` and kept `cover-panel.dtsi` as a compile-checked but unapplied hardware-gated reference. `check-rebuild.sh` now rejects a shipping DTB that contains the cover overlay.
- **Live state after rollback**: forced sysrq reboot with the base DTB, `/dev/fb0` is again 240x320 internal, `/dev/fb1` is absent, `bananarchy-coverctl STATUS` reports `backend=none`, `state=unlock`, backlight 14, no lock flag, and no kernel oops or RCU stall.
- **Kept fixes**: OpenRC parallel startup with the patched `local` service, bounded `udevadm settle`, independent USB fallback sshd, event-driven 80 ms lid debounce, boot-open unlock guard, compiled C daemons and 32-bpp cover renderer code remain; the 120 ms keypad wake experiment was reverted to the physically verified 350 ms guard, and the X session now releases stale `dmenu`/xlocker keyboard grabs once at startup. The cover renderer is idle until hardware exposes `/dev/fb1`.
- **Finalized release method**: the physically verified known-good raw image, standalone boot image and display lk2nd image hashes are pinned by `scripts/check-rebuild.sh`. The display lk2nd binary predates the low-bit reboot cookie, so `scripts/check-lk2nd-beatles.py` accepts that one image with `--allow-missing-cookie` while the source patch retains the cookie for future builds. `prepare-release.sh` packages the verified images by default; set `BA_REBUILD=1` to regenerate them from source.
- **Finalized release method**: the physically verified known-good raw image, standalone boot image and display lk2nd image hashes are pinned by `scripts/check-rebuild.sh`. The later release image is rebuilt from source and now requires the low-bit reboot cookie; `--allow-missing-cookie` was removed. `prepare-release.sh` packages the verified images by default; set `BA_REBUILD=1` to regenerate them from source.
- **Cleanup**: removed EDL backup dumps, local lk2nd build caches and Python bytecode from the release tree. Temporary diagnostic images and scratch logs are no longer part of the shipped release set.
- **Release state**: the raw image, standalone boot image and validators are rebuilt against the rolled-back DTB. Physical main-panel/keypad verification after this rollback is required before any further cover-panel work.
@@ -62,7 +70,7 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
## Unreleased — lk2nd menu and release hygiene
- **lk2nd Fastboot menu restored**: the Power menu's `sxmo_power.sh loader` writes `FASTBOOT_MODE` into `PON_SOFT_RB_SPARE[1:0]`, but the stock boot chain scrubs bits `[7:2]` before chain-loading lk2nd while upstream lk2nd only reads those high bits. `platform/msm_shared/reboot.c` now prefers the low-bit cookie and writes low-bit cookies for all small reboot reasons, while still accepting the high-bit `fastboot reboot-bootloader` cookie. The display-enabled image is the default for `flash-edl.py`, `check-rebuild.sh` validates it, and `prepare-release.sh` packages it. Live verification: the Power-menu cookie reaches lk2nd fastboot in 6 s, `fastboot oem screenshot` stages a 240x320 frame with the menu text, `fastboot getvar lk2nd:version` reports `bananarchy-beatles-a1109-display-r3`, and `fastboot reboot-bootloader` returns to the same lk2nd menu. Use `fastboot reboot` to return to Linux.
- **lk2nd Fastboot menu restored**: the Power menu's `sxmo_power.sh bootloader` writes `FASTBOOT_MODE` into `PON_SOFT_RB_SPARE[1:0]`, but the stock boot chain scrubs bits `[7:2]` before chain-loading lk2nd while upstream lk2nd only reads those high bits. `platform/msm_shared/reboot.c` now prefers the low-bit cookie and writes low-bit cookies for all small reboot reasons, while still accepting the high-bit `fastboot reboot-bootloader` cookie. The display-enabled image is the default for `flash-edl.py`, `check-rebuild.sh` validates it, and `prepare-release.sh` packages it. Live verification: the Power-menu cookie reaches lk2nd fastboot in 6 s, `fastboot oem screenshot` stages a 240x320 frame with the menu text, `fastboot getvar lk2nd:version` reports `bananarchy-beatles-a1109-display-r3`, and `fastboot reboot-bootloader` returns to the same lk2nd menu. Use `fastboot reboot` to return to Linux.
- **Abandoned pstore_blk diagnostics removed**: `CONFIG_PSTORE_BLK`, `CONFIG_PSTORE_ZONE` and the scratch `cache` PARTUUID settings are gone from the kernel config copies; `vmlinuz`, `System.map`, config, modules and DTBs were rebuilt from the clean config. `pstore_blk_get_config` no longer appears in either shipped `System.map`, and the stale `-debug`/`-ramoops` standalone boot images were removed.
- **Cover kernel modules built**: `scripts/build-kernel-audio.sh` now builds and exports `mux-core.ko.zst`, `mux-gpio.ko.zst` and `spi-mux.ko.zst`; `modules-load.d/bananarchy-hardware.conf` and `local.d/10-bananarchy-hardware.start` load them, and `check-rebuild.sh` guards the modules, config and release hygiene. `devices/nokia-beatles/cover-panel.dtsi` remains opt-in: gpio13 polarity and external reset/DC routing still require physical validation before it is applied to the shipping DTB.
- **Full clean rebuild**: `./rebuild-image.sh nokia-beatles --mkinitfs` was rerun against an empty scratch rootfs with the pinned `a1108` / `dejavu` release. It regenerated `images/bananarchy-nokia-beatles.img` and `images/boot-bananarchy-nokia-beatles.img`; `check-rebuild.sh`, `check-beatles-bootimg.py`, `sync-beatles-bootfs.py --check`, `build-lk2nd-beatles.sh --check`, `test-lk2nd-beatles-port.py`, Python/shell syntax checks and `e2fsck -fn` all pass. A dangling `/bin/linux32` BusyBox symlink from the fresh package set initially aborted the overlay; `apply-bananarchy-overlay.sh` now removes dangling symlinks before recreating them and `check-rebuild.sh` guards that path.
+4 -4
View File
@@ -53,7 +53,7 @@ The script performs the following steps automatically:
2. Waits for the phone in Qualcomm EDL/Sahara mode. The flasher auto-detects
`05c6:9008` (QDLoader), `05c6:900e` (QHSUSB_BULK, common after a failed
boot) and `05c6:9006` (DLOAD); pass `--pid` to force one:
- **From Bananarchy Linux**: open the **Power** menu (`End / Power` key or `System menu -> Power`), select **Reboot to loader** (`sxmo_power.sh loader`) to enter the visible `lk2nd` Fastboot menu, then select **EDL** (or let `flash-edl.sh` automatically send `fastboot oem reboot-edl`). The low-bit reboot cookie now survives the stock boot chain and keeps the menu available.
- **From Bananarchy Linux**: open the **Power** menu (`End / Power` key or `System menu -> Power`), select **Reboot to bootloader** (`sxmo_power.sh bootloader`) to enter the visible `lk2nd` Fastboot menu, then select **EDL** (or let `flash-edl.sh` automatically send `fastboot oem reboot-edl`). The low-bit reboot cookie now survives the stock boot chain and keeps the menu available.
- **Button combo**: power off the phone, hold **D-Pad up + D-Pad down**, and plug in the USB cable.
- **EDL cable**: hold the EDL cable button while plugging in USB.
- **From ADB or Fastboot**: the script automatically sends `adb reboot edl` or `fastboot oem reboot-edl` if detected.
@@ -69,7 +69,7 @@ The script performs the following steps automatically:
### Method B: Fastboot flashing (once `lk2nd` is installed)
1. Enter the `lk2nd` Fastboot menu either by selecting **Reboot to loader** from the **Power** menu (`sxmo_power.sh loader`) or by holding **D-Pad down** while powering on the phone.
1. Enter the `lk2nd` Fastboot menu either by selecting **Reboot to bootloader** from the **Power** menu (`sxmo_power.sh bootloader`) or by holding **D-Pad down** while powering on the phone.
2. Flash the system image to `userdata`:
```bash
fastboot flash userdata ./images/bananarchy-nokia-argon.img
@@ -136,7 +136,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
1. **System and context menus (`dmenu.so` / `dmenu` / `xdmenu`)**:
- **Open / close**: press **Left softkey (`Menu`)** for the **System menu** or **Right softkey (`Back`)** inside an application for its **Context menu**; press the same softkey or `Escape` to close.
- **Built-in submenus and instant toggles**: renders `sys`, `applications`, `scripts`, `modem`, `config`, `sdcard`, `power` (including **Lock**, **Lock (Screen off)**, **Logout**, **Reboot**, **Reboot to loader**, and **Poweroff**; use the lk2nd Fastboot menu for **EDL**), `audio` (with linear volume steps and **Output: Speaker**, **Output: Earpiece**, and **Output: Headphones** routing), `notifications`, `wm`, `timezone`, `games`, `st`, and `nano` menus in place in `< 0.5 ms` without spawning external processes.
- **Built-in submenus and instant toggles**: renders `sys`, `applications`, `scripts`, `modem`, `config`, `sdcard`, `power` (including **Lock**, **Lock (Screen off)**, **Logout**, **Reboot**, **Reboot to bootloader**, and **Poweroff**; use the lk2nd Fastboot menu for **EDL**), `audio` (with linear volume steps and **Output: Speaker**, **Output: Earpiece**, and **Output: Headphones** routing), `notifications`, `wm`, `timezone`, `games`, `st`, and `nano` menus in place in `< 0.5 ms` without spawning external processes.
- **Script compatibility**: any script piping items into `/usr/bin/dmenu` or `sxmo_dmenu.sh` communicates with the resident daemon over `/tmp/dwm_plugin_dmenu.sock`.
2. **Global phone controls (`xdrawer.so` / `xdrawer`)**:
@@ -654,4 +654,4 @@ The bootstrap is idempotent: an up-to-date rootfs is left untouched. `prebuilt/`
## Verified 2720 Flip image set
For the `a1108` / `dejavu` release, use the verified known-good `nokia-beatles` raw image, standalone boot image, and display-enabled lk2nd image generated in `images/`. These files are local build outputs and are not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present. The X session performs a one-shot startup cleanup of stale `dmenu` and xlocker keyboard grabs, while `dwm` keeps the known-good 350 ms wake guard. `prepare-release.sh` rebuilds missing images from source and packages them; use `BA_REBUILD=1` for a forced source rebuild.
For the `a1108` / `dejavu` release, use the verified `nokia-beatles` raw image, standalone boot image, and display-enabled lk2nd image generated in `images/`. These files are local build outputs and are not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present. `scripts/set-bananarchy-hostname.sh` gives every image its target codename as the default hostname, and the display lk2nd image now requires the low-bit reboot cookie so **Reboot to bootloader** reaches the visible Fastboot menu. The default `147147` unlock passcode remains provisioned with the locker path unchanged. The X session performs a one-shot startup cleanup of stale `dmenu` and xlocker keyboard grabs, while `dwm` keeps the known-good 350 ms wake guard. `prepare-release.sh` rebuilds missing images from source and packages them; use `BA_REBUILD=1` for a forced source rebuild.
+2 -2
View File
@@ -195,7 +195,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 loader** 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 overlay remains compile-tested but hardware-gated; the compiled idle renderer is ready for a future `/dev/fb1`. 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 overlay remains compile-tested but hardware-gated; the compiled idle renderer is ready for a future `/dev/fb1`. 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.
@@ -208,4 +208,4 @@ Alpine Linux, postmarketOS/Nura, and other third-party components are guided by
## Verified 2720 Flip release images
The `a1108` / `dejavu` release packages the physically verified known-good 2720 Flip image set: the raw `userdata` image, standalone mainline `boot.img`, and display-enabled lk2nd image. These are local build outputs, not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present, and `prepare-release.sh` rebuilds missing artifacts from source. `dwm` uses the known-good 350 ms wake guard, the X session releases stale startup keyboard grabs once, and `BA_REBUILD=1` forces an explicit rebuild.
The `a1108` / `dejavu` release packages the verified 2720 Flip image set: the raw `userdata` image, standalone mainline `boot.img`, and display-enabled lk2nd image. These are local build outputs, not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present, and `prepare-release.sh` rebuilds missing artifacts from source. The default hostname is the target codename, the Power menu's **Reboot to bootloader** uses the cookie-enabled lk2nd image, and the default `147147` unlock passcode remains provisioned with the locker path unchanged. `dwm` uses the known-good 350 ms wake guard, the X session releases stale startup keyboard grabs once, and `BA_REBUILD=1` forces an explicit rebuild.
+7 -4
View File
@@ -200,10 +200,13 @@ reappear.
## Power-menu Fastboot menu
`sxmo_power.sh loader` writes `0x02` into `PON_SOFT_RB_SPARE[1:0]`. The stock
boot chain scrubs the upstream high-bit cookie before chain-loading lk2nd, so
this port's `check_hard_reboot_mode()` prefers bits `[1:0]` and its
`reboot_device()` writes the same low-bit cookie for `FASTBOOT_MODE`. That
`sxmo_power.sh bootloader` writes the low-bit `FASTBOOT_MODE` cookie into
`PON_SOFT_RB_SPARE[1:0]` on the 2720 Flip. On other targets the torch module
sets both the low-bit and upstream high-bit lanes so generic lk2nd can see the
reason. The stock beatles boot chain scrubs the upstream high-bit cookie before
chain-loading lk2nd, so this port's `check_hard_reboot_mode()` prefers bits
`[1:0]` and its `reboot_device()` writes the same low-bit cookie for
`FASTBOOT_MODE`. That
keeps **Bootloader**, **EDL**, **Reboot**, **Recovery** and **Shutdown**
visible on the display-enabled image. Live verification: the menu appears
within 6 s, `fastboot oem screenshot` stages the 240x320 menu frame, and
+1 -1
View File
@@ -210,7 +210,7 @@ getprogchoices() {
$icon_lck Lock (Screen off)^0^sxmo_state.sh set screenoff
$icon_out Logout^0^confirm Logout && sxmo_power.sh logout
$icon_rld Reboot^0^confirm Reboot && sxmo_power.sh reboot
$icon_rld Reboot to loader^0^confirm Loader && sxmo_power.sh loader
$icon_rld Reboot to bootloader^0^confirm Bootloader && sxmo_power.sh bootloader
$icon_pwr Poweroff^0^confirm Poweroff && sxmo_power.sh poweroff"
;;
modem)
+5 -5
View File
@@ -8,7 +8,7 @@ export PATH="/sbin:/usr/sbin:$PATH"
. sxmo_common.sh
usage() {
printf "usage: %s [reboot|loader|poweroff|logout|togglewm]\n" "$(basename "$0")"
printf "usage: %s [reboot|bootloader|loader|fastboot|edl|poweroff|logout|togglewm]\n" "$(basename "$0")"
}
run_polkit_login1() {
@@ -75,13 +75,13 @@ case "$1" in
fi
sxmo_jobs.sh stop all >/dev/null 2>&1 || true
;;
loader|fastboot|bootloader)
bootloader|loader|fastboot)
sync
set_kernel_reboot_mode "loader"
set_kernel_reboot_mode "bootloader"
sxmo_hook_power.sh reboot || true
(sleep 4; force_reboot_cmd "loader") &
(sleep 4; force_reboot_cmd "bootloader") &
if ! run_priv_power reboot; then
force_reboot_cmd "loader"
force_reboot_cmd "bootloader"
fi
sxmo_jobs.sh stop all >/dev/null 2>&1 || true
;;
Binary file not shown.
@@ -93,7 +93,7 @@ case "$WMCLASS" in
$icon_lck Lock (Screen off) ^ 0 ^ sxmo_state.sh set screenoff
$icon_out Logout ^ 0 ^ confirm Logout && sxmo_power.sh logout
$icon_rld Reboot ^ 0 ^ confirm Reboot && sxmo_power.sh reboot
$icon_rld Reboot to loader ^ 0 ^ confirm Loader && sxmo_power.sh loader
$icon_rld Reboot to bootloader ^ 0 ^ confirm Bootloader && sxmo_power.sh bootloader
$icon_pwr Poweroff ^ 0 ^ confirm Poweroff && sxmo_power.sh poweroff
"
WINNAME=Power
Binary file not shown.
+17 -7
View File
@@ -7,31 +7,41 @@ BA_REBUILD="${BA_REBUILD:-0}"
BA_VER="$(./scripts/version.sh --print)"
BA_CODENAME="$(./scripts/version.sh --print-codename)"
RELDIR="bananarchy-${BA_TARGET}-${BA_VER}-${BA_CODENAME}"
DISPLAY_IMAGE="images/boot-lk2nd-nokia-beatles-display.img"
display_lk2nd_is_current() {
python3 scripts/check-lk2nd-beatles.py \
--image "$DISPLAY_IMAGE" \
--patch bootloader/lk2nd/nokia-beatles.patch \
--expect-fastboot 0 --expect-display 1 >/dev/null 2>&1
}
NEED_REBUILD=0
if [ ! -f "images/bananarchy-${BA_TARGET}.img" ]; then
NEED_REBUILD=1
fi
if [ "$BA_TARGET" = "nokia-beatles" ]; then
for f in images/boot-bananarchy-nokia-beatles.img \
images/boot-lk2nd-nokia-beatles-display.img; do
for f in images/boot-bananarchy-nokia-beatles.img "$DISPLAY_IMAGE"; do
[ -f "$f" ] || NEED_REBUILD=1
done
fi
if [ "$BA_REBUILD" = "1" ] || [ "$NEED_REBUILD" = "1" ]; then
./rebuild-image.sh "$BA_TARGET" --mkinitfs
if [ "$BA_TARGET" = "nokia-beatles" ] && \
[ ! -f images/boot-lk2nd-nokia-beatles-display.img ]; then
./scripts/build-lk2nd-beatles.sh --only display
fi
fi
# The default 2720 lk2nd image must contain the low-bit reboot cookie, or
# "Reboot to bootloader" cannot return to the visible Fastboot menu.
if [ "$BA_TARGET" = "nokia-beatles" ] && \
{ [ "$BA_REBUILD" = "1" ] || ! display_lk2nd_is_current; }; then
./scripts/build-lk2nd-beatles.sh
fi
mkdir -p "$RELDIR"
cp "images/bananarchy-${BA_TARGET}.img" "$RELDIR/"
if [ "$BA_TARGET" = "nokia-beatles" ]; then
cp images/boot-bananarchy-nokia-beatles.img "$RELDIR/"
cp images/boot-lk2nd-nokia-beatles-display.img "$RELDIR/"
cp "$DISPLAY_IMAGE" "$RELDIR/"
else
cp bootloader/lk2nd-msm8909.img "$RELDIR/"
fi
+1
View File
@@ -151,6 +151,7 @@ fi
if [ -x "$BASE_DIR/scripts/version.sh" ]; then
"$BASE_DIR/scripts/version.sh" "$TARGET_ROOTFS"
fi
"$BASE_DIR/scripts/set-bananarchy-hostname.sh" "$TARGET_ROOTFS" "$DEVICE"
# Pre-create the user's modem/SMS log and blocklist directories so that the
# root-run dual-SIM daemon never creates them root-owned on a fresh image.
mkdir -p "$TARGET_ROOTFS/home/user/.local/share/sxmo/modem" \
+3 -11
View File
@@ -160,16 +160,7 @@ chown 0:0 "$ROOTFS/etc/bananarchy"
chmod 0700 "$ROOTFS/etc/bananarchy"
echo "[5/8] Writing base system configuration..."
printf '%s\n' "nokia-argon" > "$ROOTFS/etc/hostname"
cat > "$ROOTFS/etc/hosts" <<EOF
127.0.0.1 nokia-argon localhost.localdomain localhost
::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
EOF
"$REPO/scripts/set-bananarchy-hostname.sh" "$ROOTFS" "$DEVICE"
printf '%s\n' "LANG=C.UTF-8" > "$ROOTFS/etc/locale.conf"
if [ -f "$ROOTFS/usr/share/zoneinfo/UTC" ]; then
cp "$ROOTFS/usr/share/zoneinfo/UTC" "$ROOTFS/etc/localtime"
@@ -189,7 +180,8 @@ fi
printf '\n' >> "$ROOTFS/etc/machine-id"
fi
mkdir -p "$ROOTFS/etc/sysctl.d"
cat > "$ROOTFS/etc/sysctl.d/90-nokia-argon-lowram.conf" <<EOF
rm -f "$ROOTFS/etc/sysctl.d/90-nokia-argon-lowram.conf"
cat > "$ROOTFS/etc/sysctl.d/90-bananarchy-lowram.conf" <<EOF
vm.swappiness = 180
vm.page-cluster = 0
vm.vfs_cache_pressure = 150
+1 -1
View File
@@ -59,7 +59,7 @@ check_images() {
--image "$DIAG_IMAGE" --patch "$PATCH" --expect-fastboot 1
python3 "$BASE_DIR/scripts/check-lk2nd-beatles.py" \
--image "$DISPLAY_IMAGE" --patch "$PATCH" --expect-fastboot 0 \
--expect-display 1 --allow-missing-cookie
--expect-display 1
}
if [ "$CHECK_ONLY" = 1 ]; then
+1 -4
View File
@@ -250,8 +250,6 @@ def main():
help="require (1) or forbid (0) the forced-fastboot diagnostic build")
ap.add_argument("--expect-display", type=int, choices=(0, 1), default=0,
help="require (1) or forbid (0) the boot-time SPI display build")
ap.add_argument("--allow-missing-cookie", action="store_true",
help="allow the known-good display image built before the low-bit reboot cookie")
args = ap.parse_args()
problems = []
@@ -304,8 +302,7 @@ def main():
b"aligned read exceeds partition"):
if marker not in data:
problems.append("binary is missing %r" % marker.decode("ascii", "replace"))
if not args.allow_missing_cookie and \
b"beatles low-bit reboot cookie" not in data:
if b"beatles low-bit reboot cookie" not in data:
problems.append("binary is missing b'beatles low-bit reboot cookie'")
if not data.endswith(b"SEANDROIDENFORCE"):
problems.append("missing SEANDROIDENFORCE trailer")
+72 -7
View File
@@ -17,6 +17,41 @@ for script in "$BASE_DIR"/*.sh "$BASE_DIR"/scripts/*.sh; do
fi
done
echo "[check] Target-specific hostname..."
HOSTNAME_HELPER="$BASE_DIR/scripts/set-bananarchy-hostname.sh"
if [ ! -x "$HOSTNAME_HELPER" ]; then
fail "missing or non-executable scripts/set-bananarchy-hostname.sh"
fi
if ! grep -qF 'set-bananarchy-hostname.sh' "$BASE_DIR/scripts/bootstrap-rootfs-container.sh" || \
! grep -qF 'set-bananarchy-hostname.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
grep -qF '"nokia-argon" > "$ROOTFS/etc/hostname"' \
"$BASE_DIR/scripts/bootstrap-rootfs-container.sh"; then
fail "target rootfs bootstrap no longer uses the target-specific hostname helper"
fi
if [ -x "$HOSTNAME_HELPER" ]; then
HOSTNAME_TMP="$(mktemp -d)"
for dev in nokia-argon nokia-beatles nokia-tough nokia-sparkler nokia-leo; do
if ! "$HOSTNAME_HELPER" "$HOSTNAME_TMP" "$dev"; then
fail "hostname helper failed for $dev"
continue
fi
if [ "$(cat "$HOSTNAME_TMP/etc/hostname" 2>/dev/null)" != "$dev" ] || \
! grep -qF "127.0.0.1 $dev localhost.localdomain localhost" \
"$HOSTNAME_TMP/etc/hosts" 2>/dev/null || \
[ "$(readlink "$HOSTNAME_TMP/etc/runlevels/boot/hostname" 2>/dev/null)" != \
"/etc/init.d/hostname" ]; then
fail "hostname helper produced the wrong identity for $dev"
fi
done
rm -rf "$HOSTNAME_TMP"
fi
if ! grep -qF 'BANANARCHY_USER_PASSWORD="${BANANARCHY_USER_PASSWORD:-147147}"' \
"$BASE_DIR/scripts/bootstrap-rootfs.sh" || \
! grep -qF 'openssl passwd -6 -salt bananarchy "$PASSWORD"' \
"$BASE_DIR/scripts/bootstrap-rootfs-container.sh"; then
fail "the default 147147 unlock passcode is no longer provisioned"
fi
echo "[check] Python syntax..."
python3 - "$BASE_DIR" <<'PYEOF' || exit 1
import ast
@@ -207,8 +242,8 @@ for variant in normal diagnostic display; do
;;
display)
image="$BASE_DIR/images/boot-lk2nd-nokia-beatles-display.img"
opts="--expect-fastboot 0 --expect-display 1 --allow-missing-cookie"
label="nokia-beatles known-good display lk2nd image"
opts="--expect-fastboot 0 --expect-display 1"
label="nokia-beatles display lk2nd image with Fastboot reboot cookie"
;;
esac
if [ ! -f "$image" ]; then
@@ -317,10 +352,10 @@ fi
echo "[check] Known-good flashable image set..."
for pair in \
"b4d0555f17dd1e224069641603ff3d120fd3ea5c219a34de227caf240a077558 images/bananarchy-nokia-argon.img" \
"e2267187c58920b5c5b822d940b81e0df8f59e7788fed00e3d31dfbdb290c7fc images/bananarchy-nokia-beatles.img" \
"69a44f60eb123ebddf600be927155dc4a599ec35b7a0cf80060f4ba01f599f08 images/bananarchy-nokia-argon.img" \
"f4e9b8b2b36d4ffa9ba4f74de293b14f16b5ed45bbd5ab1d62bc2023242b73b2 images/bananarchy-nokia-beatles.img" \
"6715abd414fd02fd21ca8c2cd621a8a21e78f46d079b2d185b38a1f7a4a3e659 images/boot-bananarchy-nokia-beatles.img" \
"e1fdd8551b6393184a465638881b63ca58c04e1e8f655f092260a18379e1cbe6 images/boot-lk2nd-nokia-beatles-display.img"; do
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do
set -- $pair
want=$1
path="$BASE_DIR/$2"
@@ -649,8 +684,38 @@ for mod in mux-core mux-gpio spi-mux; do
fail "modules-load.d is missing $mod"
fi
done
if ! grep -q 'PON_SOFT_RB_SPARE.*0x02U' "$BASE_DIR/src/leds-msm8905-torch/leds-msm8905-torch.c"; then
fail "the torch reboot cookie no longer selects the lk2nd Fastboot menu"
echo "[check] Reboot-to-bootloader Fastboot cookie..."
TORCH_SRC="$BASE_DIR/src/leds-msm8905-torch/leds-msm8905-torch.c"
for token in '#define FASTBOOT_COOKIE_LOW 0x02U' \
'#define FASTBOOT_COOKIE_DUAL 0x0aU' \
'of_machine_is_compatible("nokia,beatles")' \
'regmap_write(pon_regmap, QPNP_PON_SOFT_RB_SPARE, cookie)'; do
if ! grep -qF "$token" "$TORCH_SRC"; then
fail "the torch reboot cookie lost the target-aware lk2nd Fastboot path ($token)"
fi
done
for f in scripts/check-lk2nd-beatles.py scripts/build-lk2nd-beatles.sh \
scripts/test-lk2nd-beatles-port.py; do
if grep -qF -- '--allow-missing-cookie' "$BASE_DIR/$f" || \
grep -qF 'allow_missing_cookie' "$BASE_DIR/$f"; then
fail "$f still permits a display lk2nd image without the reboot cookie"
fi
done
if ! grep -qF 'opts="--expect-fastboot 0 --expect-display 1"' "$BASE_DIR/scripts/check-rebuild.sh"; then
fail "check-rebuild.sh no longer requires the display lk2nd reboot cookie"
fi
for f in src/sxmo-dmenu/dmenu.c \
overlay/rootfs/usr/bin/sxmo_appmenu.sh \
overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh; do
if ! grep -qF 'Reboot to bootloader' "$BASE_DIR/$f"; then
fail "$f lost the Reboot to bootloader menu item"
fi
done
if ! grep -qF 'set_kernel_reboot_mode "bootloader"' \
"$BASE_DIR/overlay/rootfs/usr/bin/sxmo_power.sh" || \
! grep -qF 'force_reboot_cmd "bootloader"' \
"$BASE_DIR/overlay/rootfs/usr/bin/sxmo_power.sh"; then
fail "sxmo_power.sh no longer reboots through the canonical bootloader mode"
fi
for stale in images/boot-bananarchy-nokia-beatles-debug.img \
images/boot-bananarchy-nokia-beatles-ramoops.img; do
+47
View File
@@ -0,0 +1,47 @@
#!/bin/sh
# Install the target-specific hostname, hosts file and hostname service link.
set -eu
ROOTFS="${1:-}"
DEVICE="${2:-nokia-argon}"
if [ -z "$ROOTFS" ] || [ ! -d "$ROOTFS" ]; then
echo "Usage: $0 <rootfs-dir> <device>" >&2
exit 1
fi
case "$DEVICE" in
nokia-argon|argon)
DEVICE="nokia-argon"
;;
nokia-beatles|beatles)
DEVICE="nokia-beatles"
;;
nokia-tough|nokia-coconut|tough|coconut)
DEVICE="nokia-tough"
;;
nokia-sparkler|sparkler)
DEVICE="nokia-sparkler"
;;
nokia-leo|leo)
DEVICE="nokia-leo"
;;
*)
echo "Error: Unsupported device '$DEVICE'." >&2
echo "Supported devices: nokia-argon, nokia-beatles, nokia-tough, nokia-sparkler, nokia-leo" >&2
exit 1
;;
esac
mkdir -p "$ROOTFS/etc" "$ROOTFS/etc/runlevels/boot"
printf '%s\n' "$DEVICE" > "$ROOTFS/etc/hostname"
cat > "$ROOTFS/etc/hosts" <<EOF
127.0.0.1 $DEVICE localhost.localdomain localhost
::1 $DEVICE localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
EOF
ln -sfn /etc/init.d/hostname "$ROOTFS/etc/runlevels/boot/hostname"
+4 -6
View File
@@ -37,19 +37,17 @@ def main():
test_c = os.path.join(BASE, "bootloader", "lk2nd", "test_spi_panel_init.c")
variants = (
("images/boot-lk2nd-nokia-beatles.img", 0, 0, False),
("images/boot-lk2nd-nokia-beatles-diagnostic.img", 1, 0, False),
("images/boot-lk2nd-nokia-beatles-display.img", 0, 1, True),
("images/boot-lk2nd-nokia-beatles.img", 0, 0),
("images/boot-lk2nd-nokia-beatles-diagnostic.img", 1, 0),
("images/boot-lk2nd-nokia-beatles-display.img", 0, 1),
)
for image, fastboot, display, allow_missing_cookie in variants:
for image, fastboot, display in variants:
ok &= check(os.path.isfile(os.path.join(BASE, image)), "%s exists" % image)
if not os.path.isfile(os.path.join(BASE, image)):
continue
cmd = [sys.executable, validator, "--image", image,
"--expect-fastboot", str(fastboot),
"--expect-display", str(display)]
if allow_missing_cookie:
cmd.append("--allow-missing-cookie")
r = subprocess.run(cmd, cwd=BASE, capture_output=True, text=True)
for line in r.stdout.strip().split("\n"):
if line:
+16 -6
View File
@@ -56,6 +56,11 @@
#define PON_POWER_OFF_SHUTDOWN 0x04U
#define PON_POWER_OFF_HARD_RESET 0x07U
/* FASTBOOT_MODE is 0x02. Low bits survive the beatles stock boot chain;
* the high-bit lane keeps generic lk2nd images working on other targets. */
#define FASTBOOT_COOKIE_LOW 0x02U
#define FASTBOOT_COOKIE_DUAL 0x0aU
/* MSM8905/MSM8909 TCSR Boot Misc Detect register for EDL (05c6:9008) */
#define MSM8905_TCSR_BOOT_MISC_DETECT 0x0193d100U
#define MSM8905_DLOAD_EDL 0x00000001U
@@ -210,14 +215,19 @@ static unsigned int msm8905_pon_prepare_restart_mode(const char *cmd)
strcmp(trimmed, "fastboot") == 0) {
if (pon_regmap) {
/*
* The stock boot chain scrubs PON_SOFT_RB_SPARE[7:2] and passes
* bits [1:0] through to the chain-loaded lk2nd image. The beatles
* lk2nd port reads those low bits as the reboot reason, so 0x02
* selects FASTBOOT_MODE and shows the menu instead of booting Linux.
* The stock beatles boot chain scrubs PON_SOFT_RB_SPARE[7:2] and
* passes bits [1:0] through to the chain-loaded lk2nd image. Its
* patched lk2nd port reads the low lane. Generic lk2nd still reads
* the upstream high lane, so set both lanes on non-beatles targets.
*/
regmap_write(pon_regmap, QPNP_PON_SOFT_RB_SPARE, 0x02U);
unsigned int cookie = of_machine_is_compatible("nokia,beatles")
? FASTBOOT_COOKIE_LOW : FASTBOOT_COOKIE_DUAL;
regmap_write(pon_regmap, QPNP_PON_SOFT_RB_SPARE, cookie);
pr_info("leds-msm8905-torch: armed PM8909 PON_SOFT_RB_SPARE (0x%02x) for lk2nd Fastboot menu\n",
cookie);
} else {
pr_info("leds-msm8905-torch: PM8909 PON_SOFT_RB_SPARE unavailable for lk2nd Fastboot menu\n");
}
pr_info("leds-msm8905-torch: armed PM8909 PON_SOFT_RB_SPARE (0x02) for lk2nd Fastboot menu\n");
return PON_POWER_OFF_HARD_RESET;
}
+5 -5
View File
@@ -3034,8 +3034,8 @@ open_builtin_menu(const char *menu_name, int keep_idx)
add_menu_item(label, "@menu:confirm_logout", 1);
snprintf(label, sizeof(label), "%s Reboot", ICON_RLD);
add_menu_item(label, "@menu:confirm_reboot", 1);
snprintf(label, sizeof(label), "%s Reboot to loader", ICON_RLD);
add_menu_item(label, "@menu:confirm_loader", 1);
snprintf(label, sizeof(label), "%s Reboot to bootloader", ICON_RLD);
add_menu_item(label, "@menu:confirm_bootloader", 1);
snprintf(label, sizeof(label), "%s Poweroff", ICON_PWR);
add_menu_item(label, "@menu:confirm_poweroff", 1);
snprintf(label, sizeof(label), "%s System Menu", ICON_MNU);
@@ -3050,9 +3050,9 @@ open_builtin_menu(const char *menu_name, int keep_idx)
reset_session_defaults(1, "Confirm Reboot");
add_menu_item("Yes", "sxmo_power.sh reboot", 0);
add_menu_item("No", "@menu:power", 1);
} else if (strcmp(menu_name, "confirm_loader") == 0) {
reset_session_defaults(1, "Confirm Loader");
add_menu_item("Yes", "sxmo_power.sh loader", 0);
} else if (strcmp(menu_name, "confirm_bootloader") == 0) {
reset_session_defaults(1, "Confirm Bootloader");
add_menu_item("Yes", "sxmo_power.sh bootloader", 0);
add_menu_item("No", "@menu:power", 1);
} else if (strcmp(menu_name, "confirm_poweroff") == 0) {
reset_session_defaults(1, "Confirm Poweroff");