From 75d9033de707057c798719eca919430d310b292f Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sat, 31 Oct 2026 16:59:16 +0100 Subject: [PATCH 1/4] omamobile: refuse fastboot on qcom-abl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Derek's #111 merge follow-up: omamobile fastboot falls through to sysrq c when reboot-to bootloader is ignored, and panic on this ABL is still uncharacterized. Refuse BOOT_METHOD=qcom-abl before any phone I/O (same class as flash/push). Prefer the buttons. BRINGUP §2/§5 updated; test added in tests/boot-method. Signed-off-by: Martin Lund Assisted-by: Grok Bot --- bin/omamobile | 6 ++++++ device/dodge/BRINGUP-M1.md | 13 ++++++++----- tests/boot-method | 7 +++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/bin/omamobile b/bin/omamobile index 97cb3c100..f3e089b34 100755 --- a/bin/omamobile +++ b/bin/omamobile @@ -831,6 +831,12 @@ fastboot_serial() { cmd_fastboot() { local ssh="$ROOT/tools/phone-ssh" i + load_device + # Qualcomm ABL panic path is uncharacterized on dodge (sysrq-c fallthrough + # when reboot-to bootloader is ignored). Refuse before any phone I/O; use + # the buttons instead (see device/$DEVICE/BRINGUP-M1.md). + [[ $DEV_BOOT_METHOD != qcom-abl ]] || + die "fastboot refuses BOOT_METHOD=qcom-abl (panic path uncharacterized on this ABL; use the buttons — see device/$DEVICE/BRINGUP-M1.md)" in_fastboot && { say "Already in fastboot"; return 0; } for i in $(seq 1 12); do if adb get-state 2>/dev/null | grep -q device; then diff --git a/device/dodge/BRINGUP-M1.md b/device/dodge/BRINGUP-M1.md index 6448228ac..458da2695 100644 --- a/device/dodge/BRINGUP-M1.md +++ b/device/dodge/BRINGUP-M1.md @@ -71,7 +71,9 @@ the shared storage guard. may clear the successful bit and refill retries, undoing the GPT bit-54 mark that has no §3.1 entry yet, and `push` cannot see `boot_b` on sde with today's sda-only lookup. **There is no in-tree day-2 update path for -dodge yet.** The installer PR can reopen those paths with the rest. +dodge yet.** `bin/omamobile fastboot` also refuses: its sysrq-c fallthrough +is uncharacterized on this ABL (see §5). The installer PR can reopen the +flash/push paths with the rest; fastboot stays refused until panic is gated. ## 3. How this phone was installed (record) @@ -121,10 +123,11 @@ each session. Those backups are never in git. rather than falling back to A, but whether this ABL enters a dump mode first has not been confirmed with a deliberate `sysrq c` on a booted B. Do not treat "returns to fastboot" as verified until that test is run. -- **Do not use `omamobile fastboot` on this phone yet.** That tool falls - through to `sysrq c` when `reboot-to bootloader` is ignored, and we have - not characterised what a panic does on this ABL. Prefer the buttons - instead of `omamobile fastboot` / sysrq-c. Button behaviour on this phone +- **`omamobile fastboot` refuses on this phone.** The tool would fall + through to `sysrq c` when `reboot-to bootloader` is ignored, and panic + behaviour on this ABL is still uncharacterized, so `bin/omamobile` now + refuses `BOOT_METHOD=qcom-abl` before any phone I/O (same class as + `flash` / `push`). Prefer the buttons. Button behaviour on this phone (Omarchy Mobile on slot B; confirmed 2026-10-31): - **Forced restart (working):** holding **Power** alone does **not** force a restart under Omarchy Mobile — it opens the Omarchy power menu diff --git a/tests/boot-method b/tests/boot-method index c57a97984..85147f573 100755 --- a/tests/boot-method +++ b/tests/boot-method @@ -94,6 +94,13 @@ grep -q 'push refuses BOOT_METHOD=qcom-abl' "$t/log" || fail "push did not refus [[ ! -e $t/calls ]] || fail "qcom-abl push accessed the phone" echo 'ok - BOOT_METHOD=qcom-abl refused by push before phone access' +# Same class: fastboot refuses qcom-abl before any phone I/O (no sysrq-c). +rm -f "$t/calls" +if DEVICE=abldev "$t/repo/bin/omamobile" fastboot > "$t/log" 2>&1; then fail "fastboot unexpectedly accepted qcom-abl"; fi +grep -q 'fastboot refuses BOOT_METHOD=qcom-abl' "$t/log" || fail "fastboot did not refuse qcom-abl" +[[ ! -e $t/calls ]] || fail "qcom-abl fastboot accessed the phone" +echo 'ok - BOOT_METHOD=qcom-abl refused by fastboot before phone access' + # dodge-chain must refuse a stage-1 Image as STAGE2_IMAGE (nested pack → ~87MiB hang). cp tools/dodge-chain "$t/repo/tools/" # Fake "Image" carrying the stage-1 cmdline marker (strings fallback when no ikconfig). From 8202df32bf8bc9b7c259829a6df5956751815e9e Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sat, 31 Oct 2026 16:59:27 +0100 Subject: [PATCH 2/4] dodge: undo private bind of / in install traps Derek's #111 merge follow-up: audio and modem install privately bind / to write through the kmod-overlay, but a mid-install failure left that bind up. Trap umount/rmdir on EXIT (same idea as bluetooth/install). tests/boot-method checks the trap is present and that a forced failure after mount --bind / still umounts. Signed-off-by: Martin Lund Assisted-by: Grok Bot --- device/dodge/audio/install | 3 +++ device/dodge/modem/install | 3 +++ tests/boot-method | 48 +++++++++++++++++++++++++++++++------- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/device/dodge/audio/install b/device/dodge/audio/install index 1c940ba9f..84690c51f 100755 --- a/device/dodge/audio/install +++ b/device/dodge/audio/install @@ -9,6 +9,8 @@ install -Dm755 audio-bringup.sh /usr/local/lib/omamobile/audio-bringup.sh install -Dm644 omamobile-dodge-audio.service /etc/systemd/system/omamobile-dodge-audio.service if mountpoint -q /usr/local/lib/omamobile 2>/dev/null; then tmp=$(mktemp -d) + # Undo the private bind of / on any exit or error (install may fail mid-loop). + trap 'umount "$tmp" 2>/dev/null; rmdir "$tmp" 2>/dev/null' EXIT mount --bind / "$tmp" install -Dm755 audio-bringup.sh "$tmp/usr/local/lib/omamobile/audio-bringup.sh" for d in "$tmp"/usr/local/lib/omamobile.*; do @@ -17,6 +19,7 @@ if mountpoint -q /usr/local/lib/omamobile 2>/dev/null; then done umount "$tmp" rmdir "$tmp" + trap - EXIT fi systemctl daemon-reload systemctl enable omamobile-dodge-audio.service || true diff --git a/device/dodge/modem/install b/device/dodge/modem/install index d5901e676..e2913d609 100755 --- a/device/dodge/modem/install +++ b/device/dodge/modem/install @@ -18,6 +18,8 @@ install_adsp_battery() { install -Dm755 adsp-battery.sh /usr/local/lib/omamobile/adsp-battery.sh mountpoint -q /usr/local/lib/omamobile 2>/dev/null || return 0 tmp=$(mktemp -d) + # Undo the private bind of / on any exit or error (install may fail mid-loop). + trap 'umount "$tmp" 2>/dev/null; rmdir "$tmp" 2>/dev/null' EXIT mount --bind / "$tmp" install -Dm755 adsp-battery.sh "$tmp/usr/local/lib/omamobile/adsp-battery.sh" for d in "$tmp"/usr/local/lib/omamobile.*; do @@ -26,6 +28,7 @@ install_adsp_battery() { done umount "$tmp" rmdir "$tmp" + trap - EXIT } install_adsp_battery diff --git a/tests/boot-method b/tests/boot-method index 85147f573..6eae12397 100755 --- a/tests/boot-method +++ b/tests/boot-method @@ -440,14 +440,46 @@ grep -q 'mount -t tmpfs' "$tip" \ || fail "tip-modules-overlay must mount tmpfs for RAM-only extract" echo "ok - kmod-overlay tip path + tip-modules-overlay present" -# Dual-write installs must use a private bind of / (not only omamobile.*). -grep -q 'mount --bind /' device/dodge/modem/install \ - || fail "modem/install must private-bind / to write through kmod-overlay" -grep -q 'mount --bind /' device/dodge/audio/install \ - || fail "audio/install must private-bind / to write through kmod-overlay" -grep -q 'omamobile-tip-sddm.bounced' device/dodge/kernel/omamobile-tip-modules-overlay \ - || fail "tip-modules-overlay must stamp sddm bounce" -echo "ok - dual-write private-bind + sddm bounce stamp" +# Dual-write installs must use a private bind of / (not only omamobile.*), +# and undo that bind in an EXIT trap so a mid-install failure cannot leave / +# bound under a leftover tmpdir. +for inst in device/dodge/modem/install device/dodge/audio/install; do + grep -q 'mount --bind /' "$inst" || fail "$inst must private-bind / to write through kmod-overlay" + grep -q "trap 'umount" "$inst" || fail "$inst must trap-umount the private bind of / on exit/error" +done +grep -q 'omamobile-tip-sddm.bounced' device/dodge/kernel/omamobile-tip-modules-overlay || fail "tip-modules-overlay must stamp sddm bounce" +echo "ok - dual-write private-bind + cleanup trap + sddm bounce stamp" + +# Runtime: audio/install's private bind must be umounted when install fails +# after mount --bind /. Fake mountpoint/mktemp/mount/install/systemctl. +tbind=$t/bind-trap +rm -rf "$tbind" +mkdir -p "$tbind/bin" "$tbind/src" +: > "$tbind/log" +printf '%s\n' '#!/bin/sh' 'exit 0' > "$tbind/bin/mountpoint" +printf '%s\n' '#!/bin/sh' "d=$tbind/tmpbind; mkdir -p \"\$d\"; echo \"\$d\"" > "$tbind/bin/mktemp" +printf '%s\n' '#!/bin/sh' "echo mount:\"\$*\" >> \"$tbind/log\"" "mkdir -p \"$tbind/tmpbind/usr/local/lib/omamobile\" \"$tbind/tmpbind/usr/local/lib/omamobile.fake\"" 'exit 0' > "$tbind/bin/mount" +printf '%s\n' '#!/bin/sh' "echo umount:\"\$*\" >> \"$tbind/log\"" 'exit 0' > "$tbind/bin/umount" +printf '%s\n' '#!/bin/sh' "echo rmdir:\"\$*\" >> \"$tbind/log\"" 'exit 0' > "$tbind/bin/rmdir" +# First install (live path) succeeds; any install into the bind tmp fails. +printf '%s\n' '#!/bin/sh' "echo install:\"\$*\" >> \"$tbind/log\"" "case \"\$*\" in *$tbind/tmpbind*) echo forced-fail >&2; exit 1 ;; esac" 'exit 0' > "$tbind/bin/install" +printf '%s\n' '#!/bin/sh' "echo systemctl:\"\$*\" >> \"$tbind/log\"" 'exit 0' > "$tbind/bin/systemctl" +chmod +x "$tbind/bin"/* +cp device/dodge/audio/install "$tbind/src/install" +cp device/dodge/audio/audio-bringup.sh "$tbind/src/" 2>/dev/null || printf '#!/bin/sh\n' > "$tbind/src/audio-bringup.sh" +cp device/dodge/audio/omamobile-dodge-audio.service "$tbind/src/" 2>/dev/null || : > "$tbind/src/omamobile-dodge-audio.service" +chmod +x "$tbind/src/install" +# Fake id as root so any root check passes (audio/install has none; keep for modem reuse). +printf '%s\n' '#!/bin/sh' 'echo 0' > "$tbind/bin/id" +chmod +x "$tbind/bin/id" +set +e +PATH="$tbind/bin:/usr/bin:/bin" "$tbind/src/install" >"$tbind/out" 2>&1 +rc=$? +set -e +[[ $rc -ne 0 ]] || { cat "$tbind/out" "$tbind/log"; fail "audio/install should fail when bind-path install fails"; } +grep -q 'mount:--bind /' "$tbind/log" || { cat "$tbind/log" "$tbind/out"; fail "audio/install should mount --bind /"; } +grep -q 'umount:' "$tbind/log" || { cat "$tbind/log" "$tbind/out"; fail "audio/install trap must umount on failure after bind"; } +echo "ok - audio/install undoes private bind of / on failure" # Runtime: adsp-battery prefers modprobe when it succeeds. From 26cc15d423fe8aa547b41a29e3fe12afced3233c Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sat, 31 Oct 2026 16:59:37 +0100 Subject: [PATCH 3/4] dodge: park deliberate panic until gated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Derek's #111 merge follow-up: the deliberate sysrq-c / panic step listed under BRINGUP §3.1 was actionable without a gate, stop condition, or way back. Move it out of Still open into Parked until gated (off by default; do not run). Soften the §5 invitation that pointed at running it. Prefer the minimal honest option over inventing a gate in this follow-up. Signed-off-by: Martin Lund Assisted-by: Grok Bot --- device/dodge/BRINGUP-M1.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/device/dodge/BRINGUP-M1.md b/device/dodge/BRINGUP-M1.md index 458da2695..495c5287c 100644 --- a/device/dodge/BRINGUP-M1.md +++ b/device/dodge/BRINGUP-M1.md @@ -122,7 +122,8 @@ each session. Those backups are never in git. `slot-successful:b=yes` the expected path is a reboot back into slot B rather than falling back to A, but whether this ABL enters a dump mode first has not been confirmed with a deliberate `sysrq c` on a booted B. - Do not treat "returns to fastboot" as verified until that test is run. + Do not treat "returns to fastboot" as verified. That deliberate test is + parked until gated (see below); do not run it. - **`omamobile fastboot` refuses on this phone.** The tool would fall through to `sysrq c` when `reboot-to bootloader` is ignored, and panic behaviour on this ABL is still uncharacterized, so `bin/omamobile` now @@ -207,7 +208,14 @@ never in the repo. ### Still open for §3.1 -1. Deliberate panic / `sysrq c` on a booted slot B, then re-read fastboot - slot-successful / unbootable / retry-count for both slots. -2. Concrete GPT restore path that avoids EDL if both copies on sde are bad +1. Concrete GPT restore path that avoids EDL if both copies on sde are bad (whether `fastboot flash partition:` works on this ABL). + +### Parked until gated + +- **Deliberate panic / `sysrq c` on a booted slot B** (then re-read fastboot + slot-successful / unbootable / retry-count for both slots). Not an + actionable step today. Do not run it. It stays parked until there is an + explicit gate (off by default), a documented stop condition, and a + documented way back. Until then, treat panic behaviour on this ABL as + unknown and keep using the buttons instead of any sysrq-c path. From 709d5532dcfb20d29d277bbe85cde93425a997fb Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sat, 31 Oct 2026 17:41:26 +0100 Subject: [PATCH 4/4] tests: assert android-v4 gets past fastboot qcom-abl refuse Claude round7: cmd_fastboot now load_device's before the refuse; cover a non-qcom descriptor so Pixel paths stay past the gate. Signed-off-by: Martin Lund Assisted-by: Grok Bot --- tests/boot-method | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/boot-method b/tests/boot-method index 6eae12397..e1c3184dc 100755 --- a/tests/boot-method +++ b/tests/boot-method @@ -101,6 +101,25 @@ grep -q 'fastboot refuses BOOT_METHOD=qcom-abl' "$t/log" || fail "fastboot did n [[ ! -e $t/calls ]] || fail "qcom-abl fastboot accessed the phone" echo 'ok - BOOT_METHOD=qcom-abl refused by fastboot before phone access' +# Non-qcom descriptor must get past the refuse. Make fastboot report a +# phone already in fastboot so cmd_fastboot returns before the reboot loop. +rm -f "$t/calls" +mkdir -p "$t/repo/device/cheetah" +cp device/cheetah/device.conf "$t/repo/device/cheetah/" +printf '#!/bin/sh\necho "SERIAL\tfastboot"\n' > "$t/bin/fastboot" +chmod +x "$t/bin/fastboot" +if ! DEVICE=cheetah "$t/repo/bin/omamobile" fastboot > "$t/log" 2>&1; then + fail "android-v4 fastboot should succeed when already in fastboot: $(cat "$t/log")" +fi +grep -q 'fastboot refuses BOOT_METHOD=qcom-abl' "$t/log" \ + && fail "android-v4 cheetah was refused as qcom-abl" +grep -q 'Already in fastboot' "$t/log" \ + || fail "android-v4 fastboot did not take the already-in path: $(cat "$t/log")" +# Restore the "any phone command is a failure" stub for later checks. +printf '#!/bin/sh\necho called >> "$CALLS"\nexit 97\n' > "$t/bin/fastboot" +chmod +x "$t/bin/fastboot" +echo 'ok - BOOT_METHOD=android-v4 (cheetah) gets past fastboot qcom-abl refuse' + # dodge-chain must refuse a stage-1 Image as STAGE2_IMAGE (nested pack → ~87MiB hang). cp tools/dodge-chain "$t/repo/tools/" # Fake "Image" carrying the stage-1 cmdline marker (strings fallback when no ikconfig).