Skip to content

initramfs, omamobile-boot-update 0.2.0, omamobile-omarchy 0.1.48, phone-smoke: the storage guard and updates follow the running slot (ACTIVE-SLOT-PLAN §7 steps 2-4) - #847

Merged
derekross merged 10 commits into
mainfrom
active-slot-phone
Nov 16, 2026
Merged

derekross merged 10 commits into
mainfrom
active-slot-phone

Conversation

@derekross

@derekross derekross commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Steps 2-4 of ACTIVE-SLOT-PLAN §7: the phone-side half of "a release installs on the running slot". No descriptor sets INSTALL_SLOT yet and no manifest is format 2, so no install changes. Nothing here was run on a phone.

This changes what release phones boot. initramfs/init is in device-cheetah's boot files. Per AGENTS, the maintainer sets the device-cheetah version only after an image built from this has booted on the 7 Pro, so device-cheetah is not bumped here. The short slot-B runbook for that boot is in the plan as §6.1 (G0-G3, read-only steps first).

Step 5 (omamobile-modem) moved to its own draft, #850, after review. It changed every phone running today (modem_b instead of modem_a), and it only gates accepting b.

What changes

  1. Storage guard (initramfs/init, bin/omamobile, tests/storage-guard). The packed UFS_RW stays in slot form (X_b). ufs_rw_load reads androidboot.slot_suffix from /proc/bootconfig, and from /proc/cmdline only when bootconfig doesn't carry the key; an empty or unquoted value in bootconfig counts as unknown. It maps each X_b to X_<running>, keeps userdata, and leaves the other slot read-only. If no suffix can be read (none, two that disagree, or anything other than _a/_b), every boot partition stays read-only and only userdata is writable. bin/omamobile initramfs now packs /etc/omamobile-ufs-rw-slot = running, and any other content in that file closes the guard. On slot B, the list, the allowlist: log line and the writable partitions are exactly what they were. Changed behaviour: a boot that names no slot (for example a fastboot boot RAM boot whose bootloader passes no suffix) now leaves the boot images read-only. Before, _b was writable.
  2. omamobile-boot-update 0.2.0. boot-update.conf gains SLOT=a|b. When the line is absent the slot is b, so every existing phone works as before. The tool refuses unless every suffix it finds is _$SLOT. It finds, checks and writes only <image>_$SLOT, and the allowlist check stays in slot form. When SLOT is not b, it also refuses a device-package initramfs that lacks the running-slot marker, because an older init opens slot B whatever slot boots. previous/ and current/ record their slot; when they don't, the slot is b. A rollback refuses a set saved from the other slot, and the next save moves such a set aside to previous.slot-<x>-<time> instead of deleting it. A second SLOT= line is refused, and phone-smoke and omamobile-update give the same verdict. Messages name the slot. The descriptor.sh comments, the example conf, the README, pkgdesc and the hook text are updated.
    • omamobile-omarchy 0.1.48. omamobile-update read every boot-update.conf line other than AUTO_WRITE/AVB_KEY as "unreadable", which would have blocked kernel updates on a SLOT= phone. It now accepts SLOT=a|b.
    • Dependencies. No device package depends on omamobile-boot-update with a version: device-cheetah only has an optdepends, and linux-omamobile has a plain depends. A versioned depends isn't needed, because 0.1.0 refuses a SLOT= line, so it fails closed.
  3. Phone-side checks.
    • In tools/phone-smoke, the boot row expects the slot that boot-update.conf names (b when absent). The guard row allows userdata plus the running slot's five images, or only userdata when no slot is named. A test-only --slot-from DIR runs both rows on a fake root.
    • bin/omamobile push reads the slot first, before anything else including modules-push. It requires _b, refuses slot A with "this phone runs a release from slot A; push writes slot B, development only", and also refuses a phone that names no slot or whose slot can't be read.
    • bin/omamobile flash reads getvar current-slot and refuses a, unless --from-slot-a is given (see the note below).
    • device/dodge: the chainload forwards androidboot.slot_suffix to stage 2 only when it is _b. Anything else is logged and dropped, so stage 2's guard keeps the boot partitions read-only.

flash on slot A (the maintainer to confirm the flag)

From fastboot, a release on slot A and stock Android on slot A look the same. A development phone that falls back to stock (or that bin/omamobile fastboot crashes into slot A) is normally re-flashed from that state. So a plain refusal would break the documented development recovery. flash therefore refuses slot A by default, and bin/omamobile flash --from-slot-a covers that case: it prints a loud warning and waits 10 s before writing. CONTRIBUTING §3.4 step 5, KERNEL-UPDATE-PLAN's fastboot recovery and the plan's §6.1 rollbacks name the flag. The plan's risks also note that a RAM boot with stock active on A now opens stock's _a images.

Tests (all offline)

  • tests/storage-guard:

    • slot A and B from bootconfig and from the command line, with bootconfig winning;
    • no suffix, an empty or unquoted value in bootconfig, two values that disagree, _c;
    • _? with a file _a in the current directory, in bootconfig and on the command line (this fails if set -f is removed);
    • the marker absent or malformed, the hand-over check on A, and a second LUN on A.

    It passes under the host's sh and under busybox ash (GUARD_SH=<busybox sh>, Alpine 3's busybox and musl). The reviewer's adversarial harness gives the expected results too.

  • packages/omamobile-boot-update/test/all: a full SLOT=a write, save, status and rollback; a mismatch both ways; an initramfs without the marker; bad and repeated SLOT= lines; per-slot previous/ and current/, with the other slot's set moved aside; legacy sets counting as slot B.

  • tests/phone-smoke (nine cases, including a repeated SLOT= line), tests/images-layout (push on A, with no slot, or when the read fails; flash on A with and without --from-slot-a), tests/boot-method (dodge's _b-only forwarding), and packages/omamobile-omarchy/test/update.sh.

  • Results: tests/packages passed all 33 suites, and tools/pr-check origin/main passed. Also passing: storage-guard (sh and busybox), images-layout, phone-smoke, boot-update-parity, install-phone, install-phone-initramfs, make-bundle, stage-boot-files, initramfs-steps, initramfs-reproducible, boot-method, rootfs-placeholders, tools-help, pr-check, install-guided, nv-backup, phone-provision.

🤖 Generated with Claude Code

derekross and others added 4 commits November 16, 2026 10:14
The guard's allowlist named slot B's images literally, so a release
booted from slot A would have left its own boot images read-only and
slot B writable: the wrong way round (docs/ACTIVE-SLOT-PLAN.md §0, §4).

The packed list stays in slot form (X_b). ufs_rw_load now reads the
running slot from androidboot.slot_suffix in /proc/bootconfig, else
/proc/cmdline, and maps each X_b to X of that slot, keeping userdata;
the other slot stays read-only. With no readable suffix (none, two that
disagree, anything but _a or _b) every boot partition stays read-only
and userdata alone is writable. On slot B the list, the log line and
the partitions left writable are exactly what they were.

bin/omamobile initramfs packs /etc/omamobile-ufs-rw-slot ("running"),
the marker a format-2 bundle is checked for; any other content in it
closes the guard. tests/storage-guard covers slot A and B from
bootconfig and the command line, bootconfig winning, no suffix, two
that disagree, a bad value, the marker absent or malformed, the
hand-over check on A and a second LUN on A.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m it

A release installed on the slot it ran from (docs/ACTIVE-SLOT-PLAN.md
§2) updates its kernel in place on that slot. boot-update.conf gains
SLOT=a|b; absent means b, so every phone installed before this keeps
writing slot B exactly as before.

The tool refuses unless every androidboot.slot_suffix it finds in
/proc/bootconfig and /proc/cmdline is _$SLOT (a release on A that fell
back to a development system on B never writes B; two values that
disagree, or none, are refused), finds, checks and writes only
<image>_$SLOT, while the descriptor's allowlist stays in slot form
(<image>_b) as the storage guard reads it. For a SLOT other than b it
also refuses a device package whose initramfs lacks the running-slot
marker: an init from before it opens slot B's images whatever slot
boots. previous/ and current/ record their slot (none: b); a rollback
refuses a set saved from the other slot. Messages name the slot.

An older tool refuses a SLOT= line ("anything else is an error"), so a
format-2 phone with an old package fails closed. No device package
depends on this one with a version: the kernel package's plain depends
is enough, as an old tool on a SLOT=a phone refuses rather than writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…LOT= line

omamobile-update reads boot-update.conf as omamobile-boot-update does,
and took any line but AUTO_WRITE and AVB_KEY as unreadable, blocking
the kernel update. omamobile-boot-update 0.2.0 adds SLOT=a|b (the slot a
release installed on slot A updates in place, ACTIVE-SLOT-PLAN §2); this
accepts it, and the test covers a SLOT=a config read with AUTO_WRITE=yes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ws; push and flash refuse slot A

A release installed on the slot it ran from runs from slot A
(docs/ACTIVE-SLOT-PLAN.md §2, §4), so the phone-side checks learn the
slot instead of assuming B.

tools/phone-smoke's boot row wants the slot boot-update.conf names
(SLOT=, b when the file or the line is absent: development phones and
every install so far), and its storage guard row allows userdata and
the running slot's five boot images, userdata alone when no slot is
named. --slot-from DIR (tests only) runs those two rows on a fake root;
tests/phone-smoke covers B as before, A with SLOT=a, A without it, a
SLOT=a phone that fell back to B, the other slot's images writable
either way, and no slot named.

bin/omamobile push reads the slot first (read only, the matched suffix
alone) and refuses a phone on slot A: "this phone runs a release from
slot A; push writes slot B, development only". flash reads fastboot's
current-slot and refuses slot A too, since it writes slot B and makes
it active. Fastboot can't tell a release on A from stock Android on A,
and a development phone that fell back to stock (or that
`omamobile fastboot` crashed into it) is flashed from there, so
OMAMOBILE_FLASH_FROM_SLOT_A=yes names that case; the message says so.
A phone on B, or one that names no slot, is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derekross added a commit that referenced this pull request Nov 16, 2026
The install link's patch checks that boot-update.conf ends with
"AUTO_WRITE=yes\n" (found by the phone-side branch, #847), so a format 2
install writes SLOT=<target> on its own line before it. Format 1's file is
unchanged; the test checks the order and the file's last line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derekross and others added 3 commits November 16, 2026 10:52
…lopment phone

§7 step 2 asks for its own short runbook, since the init is in every
image and in device-cheetah's boot files: a slot-B boot of the new guard
with the partitions' ro values compared before and after, read-only
steps first, before the device-cheetah version moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge-guard under busybox ash

Review of #847: when /proc/bootconfig carries androidboot.slot_suffix at
all, the guard now reads only it, so an empty or unquoted value there is
unknown (boot partitions read-only) rather than a reason to fall back to
the command line. tests/storage-guard gains those two cases and a "_?"
suffix with a file _a in the current directory, in bootconfig and on the
command line, which fails if set -f is removed; GUARD_SH runs the guard
under another shell (busybox ash, as on the phone).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #847: stage 2's storage guard now opens the boot images of the
slot androidboot.slot_suffix names, and the chain forwards that suffix
from bootconfig, chosen/bootargs or the packed OMAMOBILE_SLOT fallback.
This chain boots slot B only, so any other value (slot A, a stray packed
string) is logged and not forwarded, and stage 2 keeps every boot
partition read-only. tests/boot-method runs the filter on _b, _a, a stray
value and none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derekross and others added 2 commits November 16, 2026 10:55
…es the environment override

Review of #847. push now requires the phone to name slot B before
anything else, modules-push included: slot A, no slot named, or a failed
read is refused. flash's override for a development phone that fell back
to stock on slot A is an explicit flag, --from-slot-a, which prints a
loud warning and waits 10 s before writing slot B and making it active;
the OMAMOBILE_FLASH_FROM_SLOT_A variable is gone. CONTRIBUTING §3.4 step
5, KERNEL-UPDATE-PLAN's fastboot recovery and ACTIVE-SLOT-PLAN §6.1's
rollbacks name the flag. The plan's risks gain one: a RAM boot with
stock active on slot A now opens stock's _a boot images.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… other slot's previous/ moved aside

Review of #847. A boot-update.conf that names SLOT twice is refused by
omamobile-boot-update, fails phone-smoke's boot row and is unreadable to
omamobile-update, the same verdict everywhere. A previous/ saved from
the other slot is no longer deleted before the next save: it is moved
to previous.slot-<x>-<time>, intact. Tests for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross derekross changed the title Active slot, phone side: the guard, omamobile-boot-update SLOT=, phone-smoke and push/flash, the modem's slot (ACTIVE-SLOT-PLAN §7 steps 2-5) initramfs, omamobile-boot-update 0.2.0, omamobile-omarchy 0.1.48, phone-smoke: the storage guard and updates follow the running slot (ACTIVE-SLOT-PLAN §7 steps 2-4) Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross
derekross merged commit 98e2434 into main Nov 16, 2026
2 checks passed
@derekross
derekross deleted the active-slot-phone branch November 16, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant