223. Read a card and say whether its kernel and archive match, before the power cycle
Built. It follows milestone 218 (every boot of the VisionFive 2 needs a human typing four commands into U-Boot) and milestone 217 (the card carries a kernel and an archive from different builds).
It reads a mounted filesystem and needed no board, which is why every proof below is on the host.
In brief. On 2026-09-01 radon halted with MEASURED BOOT REFUSED because its card held a
kernel from one build and a userspace archive from another, six days apart. The measured-boot gate
caught it, which is the gate working. It caught it after a power cycle, a serial capture and
a person watching.
Milestone 217 narrowed who can hit this. script/board-image --card now copies the three files as an
indivisible set, so a card written by the script is consistent by construction. It did not remove
the need, and 217's own BUGS says so. A card can be written by hand, written by an older script,
half-copied, or carried between machines.
What it compares, and why that is what decides a refusal
The board's decision is one line of kernel::trust::require:
measured_boot::verify_digest(TRUST_ROOT, name, sha256(bytes)), for each archive entry the kernel
is about to hand over. TRUST_ROOT is generated by kernel/build.rs out of
target/init-measure-<arch>.txt and compiled into the kernel's own .rodata, so the deciding fact
is whether the SHA-256 of each such entry is in the kernel image, and nothing else about either
file matters. The entries are the boot programs the kernel may enter (progenitor, hello) plus the
measurement table the progenitor loads everything else against (milestone 104 (the measurement continues past
init)).
crates/sealed_pair (provisional) asks exactly that on the host: it parses the archive with the
tree's one archive reader, hashes each entry with the tree's one SHA-256, and looks for the digest's
32 raw bytes in the kernel image. That is what the trust root compiles to, and a chance 256-bit match
elsewhere is not a case worth a sentence. Needing no knowledge of where the array landed is what
lets one function read a flat booti image, an ELF, and a UEFI boot file with the pair inside it.
It checks milestone 104's half too, and reports it separately. An archive whose own measurement table disagrees with its contents boots past the kernel and then loses its console, because the progenitor treats what it cannot vouch for as what is not there. That is a different program's refusal, so it gets a different sentence.
What this built
| Piece | Where | Proved by |
|---|---|---|
sealed_pair (provisional), the comparison |
crates/sealed_pair |
8 host tests and 2 doc examples, matched and mismatched pairs built in memory |
cargo xtask card-check and script/card-check (provisional) |
xtask/src/card_check.rs, script/card-check |
run against a real radon payload, a real BOOTX64.EFI, and a hand-assembled mismatched card |
| The one seal check, no longer two copies | uefi_loader/build.rs now calls sealed_pair |
cargo xtask uefi-image builds green through it |
| One list of measured entries, no longer three | sealed_pair::BOOT_PROGRAMS, used by xtask::measure and the loader's build |
script/board-image regenerates the manifest from it |
| It runs where the payload is made | script/board-image checks target/board after building and the card after copying |
a full script/board-image run |
The two proofs, on real artifacts rather than fixtures. A pair script/board-image had just
built was sealed (3 measured entries, exit 0). A card assembled by hand out of that run's riscv64
kernel and a different build's archive was refused, exit 1, naming all three entries with the digest
each one has, and adding the half to copy:
NOT SEALED: .../nife-vf2.img does not vouch for .../nife-initrd.img. They are from different
builds, and this pair halts at MEASURED BOOT REFUSED after the power cycle.
entry `progenitor` hashes to a8b5f538b0e41914..., which is not in the kernel image's trust root
...
The kernel is the one this tree last built and the archive is not, so the ARCHIVE is stale.
Copy the set (never one file):
script/board-image --card <the card>
Where a person meets it, and whether it is a gate
The command before a radon evening is script/card-check /Volumes/NIFE. Exit 0 means it boots,
1 means the board would refuse it and the output says which half to copy. 2 means there is no payload
at that path. It reads; it never writes, and it is pointed at a mounted filesystem rather than a
device node.
It is a gate in one place and a person's tool everywhere else, and the line between them is where the pair is made rather than copied:
- In
script/board-image, yes. What makes the pair match there is the ORDER of two build steps, which is rung two at best and has already failed once with the ordering comment in place (radon, 2026-08-15). The check costs a fraction of a second against a four-minute build and turns the comment's claim into a fact the run read off the bytes. It runs twice: ontarget/boardbefore anything is copied, and on the card afterwards, which is a different claim (a copy that ran out of space is caught there and nowhere else). - In CI, no. No CI job builds a board payload, so a gate there would have nothing to read. The
place a mismatch can be built rather than copied in an ordinary run is
uefi_loader's build, and that is already rung one. Milestone 441 (the program that makes the stick) made it a build failure, and this milestone did not add a check there, it deleted the second copy of one.
Follow-on
- Recorded. It cannot say what the kernel expected, only that the archive is not it; the
limitation is in
script/card-check's ownBUGSand incrates/sealed_pair/src/lib.rs's, where a reader meets the feature. What would promote it is a reader that locates the trust root without a digest as its needle, which means depending on the array's layout, and that trade is not worth making for a message. - Recorded. It says nothing about the boot script or an
extlinux.conf, beside the same twoBUGSsections. - Done. The check is wired into
script/board-imageand intouefi_loader/build.rs, which are the two places this tree makes a pair, so there is no gate left owing. - Recorded. That this check and a real board agree is reasoned from the code and not observed,
and it is in
crates/sealed_pair/src/lib.rs'sBUGSbeside the claim. radon's next evening observes it for free: runscript/card-checkon that card before the walk. Nothing is blocked on it.
BUGS
- It duplicates a check the kernel already does, and that is deliberate rather than an oversight. The kernel's is the authority and this one is an early warning. If they ever disagree, the kernel is right and this milestone is wrong. Every refusal prints that sentence.
- It cannot say what the kernel expected. A digest the kernel does not carry is not a digest
anything can find in the image, and locating the trust root without one as the needle would mean
depending on the struct's layout and the image's load address. Which half is stale is therefore
answered a different way, by comparing both files against
target/board, and "one of these two" is the honest answer on a machine that has not built a payload. - It says nothing about the boot script or the extlinux config, which are the other two ways a card can be wrong, and milestone 218 has just changed which of those a card should carry.
- Nothing forces anyone to run it. It is rung two at best. A card written by hand by somebody
who did not read this block is exactly the case it cannot reach.
script/board-imagerunning it on every payload and every card it writes is as far as a mechanism reaches here. - No board has booted a card this passed. Every proof was on the host, which is the whole point of the milestone, and it also means the agreement between this check and a real refusal is reasoned from the code rather than observed. radon's next evening observes it for free.
- Names are provisional:
sealed_pair,cargo xtask card-check,script/card-check.
Index row
script/card-check <mounted card> answers the board's own question on the host. It hashes every
archive entry the kernel may enter and looks for that digest in the kernel image's compiled-in trust
root. A kernel and an archive from different builds are caught before the walk to the board rather
than by MEASURED BOOT REFUSED after it. It reads a microSD card, a UEFI stick, a single boot file
or the payload the build just produced; a refusal names the entry, the digest it has, and which of
the two files to copy. The comparison is one crate (sealed_pair) that the UEFI loader's build now
shares, which deleted the second copy of the measured-entry list rather than adding a third.