- build-kernel.sh fragment assertion: survives a missing trailing newline (the read footgun, reproduced) and treats an absent symbol on a disable line as FATAL, symmetric with the enable arm. - fetch-kernel-tarball.sh checks the pin before downloading; both fetchers add --retry-connrefused. - mkimage rejects '.'/'..' state keys. - ui-shot: VM liveness checked before every QMP call, console.log preserved as evidence on every failure path, repaint deadline widened to 90s with the contended-runner rationale documented. - rs485-bridge: overflow discards back off one gap and rate-limit their log line, mirroring the accept-loop fix; clippy nit fixed. - .gitignore ignores *.elf/*.map so the untracked artifacts cannot silently return; CI shellcheck glob now covers build/ and the rootfs boot scripts (directives added for the deliberate in-guest source paths). - Docs: NPU parity row matches its sibling verification docs; line-pinned audit cross-references unpinned; CROSS_COMPILE documented in the build header; payload README lists warden-ui; ci-cd tense settled. Verified: guards negative-tested (bad state keys, no-newline fragment); boot smoke, portal scenario, ui-shot all PASS; 53 tests green; shellcheck clean across the widened glob; clippy zero. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HUayid7W5w7jBdb9Rrj1K
43 lines
1.4 KiB
Plaintext
Executable File
43 lines
1.4 KiB
Plaintext
Executable File
#!/bin/busybox sh
|
|
# Stage-1 rc: sourced by /init (still PID 1, initramfs root) when a virtio
|
|
# disk is present. Emulates U-Boot's slot choice — mount the validated slot's
|
|
# rootfs and switch_root into it. This is an EMULATION of the A/B selection
|
|
# outcome, not the BCB/bootcount mechanism itself.
|
|
#
|
|
# Every guarded failure path `return`s to /init (valid in a sourced script;
|
|
# /init then falls through to shell/poweroff). The final exec is the one
|
|
# unguardable step: if switch_root itself fails to launch, the shell — PID 1 —
|
|
# exits and the kernel panics; the applet-existence check below catches the
|
|
# only preventable variant of that.
|
|
|
|
# shellcheck source=qemu/rootfs/etc/warden-lib.sh disable=SC1091
|
|
. /etc/warden-lib.sh
|
|
|
|
warden_populate_by_name
|
|
slot="$(warden_slot)"
|
|
|
|
root="/dev/block/by-name/rootfs${slot}"
|
|
if [ ! -e "$root" ]; then
|
|
echo "rc: $root missing — staying in initramfs"
|
|
return 0
|
|
fi
|
|
|
|
mkdir -p /mnt
|
|
if ! mount -t ext4 "$root" /mnt; then
|
|
echo "rc: mount of $root failed — staying in initramfs"
|
|
return 0
|
|
fi
|
|
if [ ! -x /mnt/sbin/init ]; then
|
|
echo "rc: $root has no /sbin/init — staying in initramfs"
|
|
umount /mnt
|
|
return 0
|
|
fi
|
|
if ! command -v switch_root >/dev/null; then
|
|
echo "rc: busybox lacks switch_root — staying in initramfs"
|
|
umount /mnt
|
|
return 0
|
|
fi
|
|
|
|
echo "rc: switching root to rootfs${slot} ($root)"
|
|
exec switch_root /mnt /sbin/init
|