Files
bfe-core1106-sdk/qemu/rootfs/init
T
BFE EngineeringandClaude Opus 5.5 37037926df
ci / quality (push) Successful in 2m25s
ci / badges (push) Skipped
ci / mcdc (push) Successful in 29s
ci / prune-artifacts (push) Skipped
ci / test (push) Successful in 13s
ci / bench (push) Successful in 10s
ci / patches-apply (push) Successful in 24s
ci / kernel-build (push) Skipped
ci / mcdc (pull_request) Successful in 21s
ci / bench (pull_request) Successful in 17s
ci / test (pull_request) Successful in 14s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / qemu-tools (push) Successful in 4m32s
ci / kernel-symbols (push) Successful in 4m28s
ci / patches-apply (pull_request) Successful in 57s
ci / qemu-tools (pull_request) Successful in 3m8s
ci / kernel-symbols (pull_request) Successful in 6m42s
ci / quality (pull_request) Successful in 2m19s
ci / badges (pull_request) Skipped
qemu: build the panel's own BusyBox for the rig (flare-edge#2210)
The rig runs busybox.net's 1.31.0 multiarch binary, not the image's 1.37.0
with its applet config, so a script calling an applet or option the panel
lacks (#1903 setpriv --reuid, #2002 stat, #1349 flock -w) passes in the rig
and breaks on a panel.

- qemu/busybox/panel.config: the image's config, rebuilt from Buildroot
  2025.02.8 busybox.config plus 0001-busybox-applets.patch, resolved for
  1.37.0 as Buildroot does. patches/: Buildroot's 11 busybox patches.
  rig.fragment: static link and BusyBox's own passwd readers only.
  applets.txt and help.txt: the bench a capture (image 417a66b).
- qemu/build-busybox.sh: pinned 1.37.0 source, fails on any Kconfig rewrite
  of the config, an applet list other than the panel's, or a dynamic binary.
- qemu/lib.sh: RIG_BUSYBOX=panel selects it (default stays multiarch);
  the bounded verified download is now qemu_fetch_verified.
- warden.shell uses warden_console_shell: cttyhack where it exists, else
  setsid -c on the console tty (the panel's BusyBox has no cttyhack).
- CI: offline tests in qemu-tools, a build there checked against every
  applet's --help from the panel through qemu-user, and a second boot smoke
  with the panel initramfs in kernel-build.

Refs flare-edge#2210

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
2026-10-29 07:36:25 -06:00

84 lines
3.2 KiB
Plaintext
Executable File

#!/bin/busybox sh
# shellcheck shell=dash
# WardenOS QEMU device sim: initramfs /init (PID 1).
#
# Phase-1 duty: prove the kernel booted on -M virt; print the sentinel the
# smoke test greps for, then power off (PSCI SYSTEM_OFF, so qemu exits).
# `warden.shell` on the kernel cmdline drops to an interactive shell instead.
/bin/busybox mount -t devtmpfs devtmpfs /dev 2>/dev/null
# The cpio archive carries no device nodes (it is built unprivileged, no
# mknod); reopen stdio on the real console now that devtmpfs is mounted.
exec </dev/console >/dev/console 2>&1
/bin/busybox --install -s /bin
mount -t proc proc /proc
mount -t sysfs sysfs /sys
echo "WARDEN-QEMU-BOOT-OK"
# Kernel contract (rebuild M0): every symbol of build/required-symbols.txt (staged
# as /etc/required-symbols.txt by mkinitramfs.sh) is in the running kernel's
# /proc/config.gz, the cgroup v2 controllers the platform limits with are there,
# and pressure stall information is on. boot-smoke.sh greps these markers.
if [ -r /etc/required-symbols.txt ]; then
if [ -e /proc/config.gz ] && zcat /proc/config.gz > /config.run 2>/dev/null; then
miss=""; nsym=0
while read -r line; do
case "$line" in
CONFIG_*=*)
nsym=$((nsym + 1))
grep -qxF "$line" /config.run || miss="$miss $line" ;;
"# CONFIG_"*" is not set")
sym="${line#\# }"; sym="${sym% is not set}"; nsym=$((nsym + 1))
grep -q "^$sym=" /config.run && miss="$miss ${sym}(set)" ;;
esac
done < /etc/required-symbols.txt
if [ -z "$miss" ]; then echo "WARDEN-QEMU-SYMBOLS-OK $nsym"
else echo "WARDEN-QEMU-SYMBOLS-MISSING$miss"; fi
else
echo "WARDEN-QEMU-SYMBOLS-MISSING /proc/config.gz"
fi
mkdir -p /sys/fs/cgroup
mount -t cgroup2 none /sys/fs/cgroup 2>/dev/null
echo "WARDEN-QEMU-CGROUP-CONTROLLERS $(cat /sys/fs/cgroup/cgroup.controllers 2>/dev/null)"
psi_missing=""
for f in cpu memory io; do [ -r "/proc/pressure/$f" ] || psi_missing="$psi_missing $f"; done
if [ -z "$psi_missing" ]; then echo "WARDEN-QEMU-PSI-OK"; else echo "WARDEN-QEMU-PSI-MISSING$psi_missing"; fi
fi
# warden.run=<path>: run a script that mkinitramfs.sh staged from EXTRA_DIR, then
# power off. Used by the M0 limit tests (tools/m0/limits-test.sh in flare-edge).
read -r CMDLINE < /proc/cmdline
for w in $CMDLINE; do
case "$w" in warden.run=*) RUN_SCRIPT="${w#warden.run=}" ;; esac
done
if [ -n "${RUN_SCRIPT:-}" ]; then
if [ -x "$RUN_SCRIPT" ]; then
echo "WARDEN-QEMU-RUN-BEGIN $RUN_SCRIPT"
"$RUN_SCRIPT"
echo "WARDEN-QEMU-RUN-END rc=$?"
else
echo "WARDEN-QEMU-RUN-MISSING $RUN_SCRIPT"
fi
poweroff -f
fi
# With a virtio disk attached, hand over to the stage-1 rc (by-name symlinks,
# slot select, switch_root). It only returns on failure; then fall through to
# the diskless shell/poweroff behavior below.
if [ -b /dev/vda ]; then
# shellcheck source=qemu/rootfs/etc/rc disable=SC1091
. /etc/rc
fi
if grep -qw warden.shell /proc/cmdline; then
echo "warden.shell: interactive shell (exit to power off)"
# shellcheck source=qemu/rootfs/etc/warden-lib.sh disable=SC1091
. /etc/warden-lib.sh
warden_console_shell
fi
poweroff -f