Files
bfe-core1106-sdk/qemu/rootfs/init
T
BFE EngineeringandClaude Fable 5 abbc690277 ci: silence SC2187 on the busybox-sh shebangs (shellcheck 0.9 vs 0.10)
ubuntu-latest ships shellcheck 0.9.0, which warns that ash scripts are
checked as dash; 0.10 (local) does not. shell=dash is the accurate dialect
for busybox ash. Verified clean under BOTH versions; boot smoke re-run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018HUayid7W5w7jBdb9Rrj1K
2026-08-30 09:02:33 -06:00

35 lines
1.1 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"
# 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)"
setsid cttyhack sh
fi
poweroff -f