Installer hardware gatesDraft
The installer is tested on hardware in gates. Every gate has an entry list, a
script or checklist, the lines that decide pass or fail, and a rollback. The
scripts live in tools/obinstall/gates/ and are tested on the host against
fake tools (tests/installer_host/test_gates.sh). None of them has been run
on hardware yet: this page describes what a run will do, not a recipe that
was re-run.
Rules for every gate: the debug link is up before the target boots, the host
that holds the link stays awake, one hardware run at a time, the rollback kit
is on the carrier with its checksum table, and a gate that changes the machine
runs only after the approval is written in the journal and exported as
OB_GATE_ACK=<gate id>.
The gates#
| Gate | Class | Where | Script | Changes |
|---|---|---|---|---|
| C9 | needs approval, reversible | the target's macOS | c9-accept.sh |
a 1 MiB partition in the stub's gap and one NVRAM value, both removed again |
| Live adopt | read-only | macOS (precheck), any host (s8, rollback) |
live-adopt.sh |
nothing outside its output directory |
| G4a | read-only | the target's macOS | g4a.sh |
nothing outside its output directory |
| G4b prep | needs approval | the target's Windows | checklist | a driver package (rolled back from WinPE) |
| G4b | owner at 1TR | recovery of the legacy group | g4b-preflight.sh before, gatelines.py after |
boot policy object of the legacy group |
| G4c1 evening | needs approval, then unattended | macOS | g4c1-evening.sh |
a stub container and an ESP in the free gaps |
| G4c1 | owner at 1TR | recovery of the stub | checklist, gatelines.py |
boot policy of the stub, boot-volume |
| G4d | needs approval | macOS | g4d.sh |
removes the G4c1 install |
| G4c2 | owner at 1TR, own session | see owner sessions | checklist | container resize, Windows Setup |
C9: accept rehearsal#
Before the stub exists, the accept path is rehearsed with the installed object:
a 1 MiB APFS-type partition is added in the gap the stub will use, so the legacy
install sees a changed Apple set and offers an accept (accept: offer). Run as
root in macOS with OB_GATE_ACK=C9. The anchor slice and GUID, the gap, the
expected range and the raw GPT head and tail md5 of the known state are
arguments, never constants; the script refuses when the disk differs from them.
| Phase | What it does |
|---|---|
add |
md5 of the raw GPT equals the baseline, the anchor GUID is on the given slice, the gap is free and maximal, partition.check_placement accepts the placement; then diskutil addPartition, then every baseline entry is byte-identical by GUID and exactly one new entry sits at the expected range |
accept |
the installed object is found by the coih of bputil -d -v <vgid> (never by listing), obinstall accept-apple --object <that path> runs (the typed word comes from stdin), the stored value is read back by name |
undo |
diskutil eraseVolume free free on the slice resolved from the new partition's GUID (it must be 1 MiB), the raw GPT md5 must equal the baseline (a difference fails loudly), the table must equal the baseline, nvram -d of the accept and a read back |
check |
read only: the hold log against a file of expected lines (!line must be absent); run after each hold |
The phases run in this order only, with the state kept in --state. The hold
checks between them (accept: offer, then accept: accepted with the window
open, then no accept line) are made by the person running the gate.
G4a: read-only dry runs#
Run on the target's macOS with a release signed by a throwaway root key.
sh tools/obinstall/gates/g4a.sh --out <new dir> --obinstall <entry> --legacy-vgid <uuid> \
[--bootstrap <bootstrap.sh built for a local HTTP directory>] \
[--gpt-file <raw GPT written by the backup> --expect-gpt <fixture>] \
[--log-dev <raw disk> --log-lba <n> --log-count <n>]
It snapshots diskutil list -plist and nvram -p, runs install --dry-run --legacy-vgid and install --dry-run --stub-only, reads the prediction table,
optionally compares the raw GPT with a fixture and reads the log partition, then
snapshots again. Pass means: both dry runs exit 0; every prediction: line is
window for the new install and window or apple-entries for an existing
one; the two snapshots are byte-identical. The output directory must be new.
On macOS 27.3 the nvram -p snapshot does not contain the ob-* variables of
the project GUID (they are only readable by name), so it cannot show a change
of them; this gap in the gate scripts is open.
G4b: first pure-slot release install, legacy group#
Prep, in this order: confirm which driver package is installed today and skip
the swap if it already is the release package; read the EL2 info page and stop
unless the write flag and the window are present; swap to the release package,
reboot once and check that writes work with Secure Boot on. The rollback is the
WinPE route that restores the previous package offline. Removing the package
with pnputil is not a rollback: a read-only disk bugchecks before a session
exists.
Before the visit, g4b-preflight.sh --out <dir> --kit <carrier>/obinstall --rollback-md5 <tag>=<md5> checks the kit on the carrier: every file against
MD5SUMS, the object's package header, filled install slot and size, the named
rollback objects by checksum, that the kit was made with --require-slot, and
that no placeholder is left. It prints the checksum table to compare in 1TR.
After the boot, gatelines.py --gate g4b judges the captured console: the
profile line with the lab hold, the key-set line equal to the lab set, the
obslot line with src=measured, the window line, mtfw: load ok src=slot,
wlan: fw ok src=esp pin=slot. Then obinstall verify must pass. On failure
run the carrier's rollback script in the same 1TR visit.
G4c1: a fresh stub next to the legacy group#
Entry: G4b passed; stage-1 partitioning, the prediction gate, accept-apple
and remove --stub-only are merged and host-tested; G4a re-run with the G4b
object installed shows the predicted verdicts; the stub recoveryOS offers the
owner as an admin user; the network answer for personalisation is on the
checklist.
Evening part (g4c1-evening.sh, needs OB_GATE_ACK=g4c1-evening):
install --stub-only --no-log --stop-before-handoff, then the prediction lines,
then a check that no ob-* NVRAM value changed, then accept-apple for the
legacy group. Any failure runs remove --stub-only at once and the legacy boot
is re-checked by hand. The last step by hand is a read-only boot of the legacy
install: its window opens and Windows writes.
Session part: see S2.
Expected after the stub boots: obslot line src=measured, the window is the
new ESP range, mtfw: load ok src=slot, wlan: fw ok src=esp pin=slot
(gatelines.py --gate g4c1). Then the legacy group is blessed back and booted:
its window opens and the accept value is still valid.
Live adopt: prechecks and stub boot gates#
live-adopt.sh serves the live-adopt session, where the stub adopts the existing
Windows area. It changes nothing. precheck runs in macOS and checks, by name,
the installed object (C2: one coih, its payload md5), the group, the
deleteVolumeGroup verb and the crypto users (C3), the Apple reference layout
(C4), NVRAM with no stored ob-apple-accept (C5) and the install --adopt --dry-run rehearsal (C6: legacy apple-entries, new window, exactly one
addPartition). The partition table and every ob-* variable must be unchanged
afterwards. s8 checks the stub's first boot text against its seal.json
(gatelines.py --gate g4c1 plus the profile and key-set lines). rollback does
the same for the rebound rollback object: the trackpad firmware may come from the
embedded copy and there is no Wi-Fi line (gatelines.py --gate rollback).
G4d: remove the G4c1 install#
g4d.sh (needs OB_GATE_ACK=g4d) runs remove, checks that the remaining
partition entries are unchanged, that the legacy system is the default boot
again, that verify reports the legacy Apple set equal to its sealed set
(verdict window without the accept value), and clears the stale accept value
with obnvram clear apple-accept.
G4c2#
G4c2 (container resize, a fresh install with a Windows area, stock Windows Setup from a stick) is its own session. Entry: G4c1 and G4d passed, the QEMU Setup tripwire evidence is clean, the resize image test passed, a verified backup exists, and the DFU rehearsal is done with the firmware image cached. Pass: Windows boots from its own ESP, the Apple set is unchanged except the resized container's last block, the legacy group is accepted again. No tag other than a release candidate ships before G4c2 passes.
Not verified#
- The command shapes of
bless --setBoot,diskutil apfs deleteContainerand thekmutilrefusal text are host-faked only; each gate is the first real use. Read-only on a real Mac (macOS 27.3) measured:bless --getBootreports the NVRAM default, not the running volume (that is/chosen apfs-preboot-uuid);nvram boot-volumeby name finds nothing, onlynvram -pshows it;bputil -dneeds-v;diskutil info -plisthas noAPFSVolumeUUID. The facts are intests/installer_mac/FACTS.md. - Whether the stub's recovery opens
Finish Installationby itself is a G4c1 question; the script runs by hand either way. - The subcommand names used by the scripts (
install --stub-only --no-log --stop-before-handoff,verify --seal,remove --stub-only) follow the plan; the installer's command line (Task 4.3) is not merged yet.