Add desktop and device test entrypoints
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env bash
|
||||
# Launch the Phase 4 Wayland path in QEMU using the repo's Wayland profile.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
find_uefi_firmware() {
|
||||
local candidates=(
|
||||
"/usr/share/ovmf/x64/OVMF.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF.4m.fd"
|
||||
"/usr/share/ovmf/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/ovmf/OVMF.fd"
|
||||
"/usr/share/OVMF/OVMF_CODE.fd"
|
||||
"/usr/share/qemu/edk2-x86_64-code.fd"
|
||||
)
|
||||
local path
|
||||
for path in "${candidates[@]}"; do
|
||||
if [[ -f "$path" ]]; then
|
||||
printf '%s\n' "$path"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<'USAGE'
|
||||
Usage: test-phase4-wayland-qemu.sh [--check] [extra qemu args...]
|
||||
|
||||
Boot the repo's Wayland profile in QEMU with a VirtIO NIC using UEFI firmware.
|
||||
|
||||
Examples:
|
||||
./local/scripts/test-phase4-wayland-qemu.sh
|
||||
./local/scripts/test-phase4-wayland-qemu.sh --check
|
||||
./local/scripts/test-phase4-wayland-qemu.sh -m 4G
|
||||
|
||||
Expected runtime path:
|
||||
orbital -> orbital-wayland -> smallvil -> wayland-session
|
||||
USAGE
|
||||
}
|
||||
|
||||
check_mode=0
|
||||
filtered_args=()
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--help|-h|help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--check)
|
||||
check_mode=1
|
||||
;;
|
||||
*)
|
||||
filtered_args+=("$arg")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
firmware="$(find_uefi_firmware)" || {
|
||||
echo "ERROR: no usable x86_64 UEFI firmware found" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
extra_qemu_args="${filtered_args[*]:-}"
|
||||
if [[ -n "${QEMUFLAGS:-}" ]]; then
|
||||
QEMUFLAGS="${QEMUFLAGS} ${extra_qemu_args}"
|
||||
else
|
||||
QEMUFLAGS="${extra_qemu_args}"
|
||||
fi
|
||||
|
||||
arch="${ARCH:-$(uname -m)}"
|
||||
image="build/$arch/redbear-wayland/harddrive.img"
|
||||
extra="build/$arch/redbear-wayland/extra.img"
|
||||
|
||||
if [[ ! -f "$image" ]]; then
|
||||
echo "ERROR: missing image $image" >&2
|
||||
echo "Build it first with: ./local/scripts/build-redbear.sh redbear-wayland" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$extra" ]]; then
|
||||
truncate -s 1g "$extra"
|
||||
fi
|
||||
|
||||
echo "=== Red Bear OS Phase 4 Wayland QEMU Launch ==="
|
||||
echo "Config: redbear-wayland"
|
||||
echo "Image: $image"
|
||||
echo "UEFI: $firmware"
|
||||
echo
|
||||
echo "Suggested in-guest checks:"
|
||||
echo " redbear-info --json"
|
||||
echo " netctl status"
|
||||
echo " redbear-phase4-wayland-check"
|
||||
echo " smallvil should be the primary compositor path"
|
||||
echo
|
||||
|
||||
if [[ "$check_mode" -eq 1 ]]; then
|
||||
expect <<EOF
|
||||
log_user 1
|
||||
set timeout 240
|
||||
spawn qemu-system-x86_64 -name {Red Bear OS x86_64} -device qemu-xhci -smp 4 -m 2048 -bios $firmware -chardev stdio,id=debug,signal=off,mux=on -serial chardev:debug -mon chardev=debug -machine q35 -device ich9-intel-hda -device hda-output -device virtio-net,netdev=net0 -netdev user,id=net0 -object filter-dump,id=f1,netdev=net0,file=build/$arch/redbear-wayland/network.pcap -vga std -drive file=$image,format=raw,if=none,id=drv0 -device nvme,drive=drv0,serial=NVME_SERIAL -drive file=$extra,format=raw,if=none,id=drv1 -device nvme,drive=drv1,serial=NVME_EXTRA -enable-kvm -cpu host $QEMUFLAGS
|
||||
expect "login:"
|
||||
send "root\r"
|
||||
expect "assword:"
|
||||
send "password\r"
|
||||
expect "Type 'help' for available commands."
|
||||
send "redbear-phase4-wayland-check\r"
|
||||
expect "Red Bear OS Phase 4 Wayland Runtime Check"
|
||||
expect "orbital-wayland"
|
||||
expect "wayland-session"
|
||||
expect "smallvil"
|
||||
expect "virtio_net_present"
|
||||
send "shutdown\r"
|
||||
expect eof
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec qemu-system-x86_64 \
|
||||
-name "Red Bear OS x86_64" \
|
||||
-device qemu-xhci \
|
||||
-smp 4 \
|
||||
-m 2048 \
|
||||
-bios "$firmware" \
|
||||
-chardev stdio,id=debug,signal=off,mux=on \
|
||||
-serial chardev:debug \
|
||||
-mon chardev=debug \
|
||||
-machine q35 \
|
||||
-device ich9-intel-hda -device hda-output \
|
||||
-device virtio-net,netdev=net0 \
|
||||
-netdev user,id=net0 \
|
||||
-object filter-dump,id=f1,netdev=net0,file="build/$arch/redbear-wayland/network.pcap" \
|
||||
-vga std \
|
||||
-drive file="$image",format=raw,if=none,id=drv0 \
|
||||
-device nvme,drive=drv0,serial=NVME_SERIAL \
|
||||
-drive file="$extra",format=raw,if=none,id=drv1 \
|
||||
-device nvme,drive=drv1,serial=NVME_EXTRA \
|
||||
-enable-kvm -cpu host \
|
||||
$QEMUFLAGS
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
# Reference host-side copy of the guest-side Phase 4 Wayland runtime check.
|
||||
# The actual in-guest command installed by the profile is `redbear-phase4-wayland-check`.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "=== Red Bear OS Phase 4 Wayland Runtime Test ==="
|
||||
echo
|
||||
|
||||
require_command() {
|
||||
local cmd="$1"
|
||||
local message="$2"
|
||||
if command -v "$cmd" >/dev/null 2>&1; then
|
||||
echo "✅ $message"
|
||||
else
|
||||
echo "❌ $message"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
require_command orbital-wayland "orbital-wayland launcher is installed"
|
||||
require_command wayland-session "wayland-session launcher is installed"
|
||||
require_command smallvil "smallvil compositor is installed"
|
||||
require_command redbear-info "redbear-info is installed"
|
||||
|
||||
echo
|
||||
echo "=== redbear-info --json ==="
|
||||
redbear-info --json
|
||||
echo
|
||||
|
||||
echo "=== Phase 4 launch surface ==="
|
||||
echo "orbital-wayland and smallvil are present on the wayland profile."
|
||||
echo "Run 'orbital-wayland' from a graphical VT to start the compositor path."
|
||||
echo
|
||||
echo "=== Test Complete ==="
|
||||
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env bash
|
||||
# Launch or validate the Phase 5 desktop/network plumbing path in QEMU.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
find_uefi_firmware() {
|
||||
local candidates=(
|
||||
"/usr/share/ovmf/x64/OVMF.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF.4m.fd"
|
||||
"/usr/share/ovmf/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/ovmf/OVMF.fd"
|
||||
"/usr/share/OVMF/OVMF_CODE.fd"
|
||||
"/usr/share/qemu/edk2-x86_64-code.fd"
|
||||
)
|
||||
local path
|
||||
for path in "${candidates[@]}"; do
|
||||
if [[ -f "$path" ]]; then
|
||||
printf '%s\n' "$path"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<'USAGE'
|
||||
Usage: test-phase5-network-qemu.sh [--check] [extra qemu args...]
|
||||
|
||||
Boot or validate the Red Bear OS Phase 5 desktop/network plumbing path on redbear-full.
|
||||
USAGE
|
||||
}
|
||||
|
||||
check_mode=0
|
||||
filtered_args=()
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--help|-h|help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--check)
|
||||
check_mode=1
|
||||
;;
|
||||
*)
|
||||
filtered_args+=("$arg")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
firmware="$(find_uefi_firmware)" || {
|
||||
echo "ERROR: no usable x86_64 UEFI firmware found" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
arch="${ARCH:-$(uname -m)}"
|
||||
image="build/$arch/redbear-full/harddrive.img"
|
||||
extra="build/$arch/redbear-full/extra.img"
|
||||
extra_qemu_args="${filtered_args[*]:-}"
|
||||
|
||||
if [[ ! -f "$image" ]]; then
|
||||
echo "ERROR: missing image $image" >&2
|
||||
echo "Build it first with: ./local/scripts/build-redbear.sh redbear-full" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$extra" ]]; then
|
||||
truncate -s 1g "$extra"
|
||||
fi
|
||||
|
||||
if [[ "$check_mode" -eq 1 ]]; then
|
||||
expect <<EOF
|
||||
log_user 1
|
||||
set timeout 240
|
||||
spawn qemu-system-x86_64 -name {Red Bear OS x86_64} -device qemu-xhci -smp 4 -m 2048 -bios $firmware -chardev stdio,id=debug,signal=off,mux=on -serial chardev:debug -mon chardev=debug -machine q35 -device ich9-intel-hda -device hda-output -device virtio-net,netdev=net0 -netdev user,id=net0 -object filter-dump,id=f1,netdev=net0,file=build/$arch/redbear-full/network.pcap -vga std -drive file=$image,format=raw,if=none,id=drv0 -device nvme,drive=drv0,serial=NVME_SERIAL -drive file=$extra,format=raw,if=none,id=drv1 -device nvme,drive=drv1,serial=NVME_EXTRA -enable-kvm -cpu host $extra_qemu_args
|
||||
expect "login:"
|
||||
send "root\r"
|
||||
expect "assword:"
|
||||
send "password\r"
|
||||
expect "Type 'help' for available commands."
|
||||
send "redbear-phase5-network-check\r"
|
||||
expect "Red Bear OS Phase 5 Networking Check"
|
||||
expect "dbus-daemon"
|
||||
expect "virtio_net_present"
|
||||
expect "DBUS_SYSTEM_BUS="
|
||||
send "shutdown\r"
|
||||
expect eof
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec qemu-system-x86_64 \
|
||||
-name "Red Bear OS x86_64" \
|
||||
-device qemu-xhci \
|
||||
-smp 4 \
|
||||
-m 2048 \
|
||||
-bios "$firmware" \
|
||||
-chardev stdio,id=debug,signal=off,mux=on \
|
||||
-serial chardev:debug \
|
||||
-mon chardev=debug \
|
||||
-machine q35 \
|
||||
-device ich9-intel-hda -device hda-output \
|
||||
-device virtio-net,netdev=net0 \
|
||||
-netdev user,id=net0 \
|
||||
-object filter-dump,id=f1,netdev=net0,file="build/$arch/redbear-full/network.pcap" \
|
||||
-vga std \
|
||||
-drive file="$image",format=raw,if=none,id=drv0 \
|
||||
-device nvme,drive=drv0,serial=NVME_SERIAL \
|
||||
-drive file="$extra",format=raw,if=none,id=drv1 \
|
||||
-device nvme,drive=drv1,serial=NVME_EXTRA \
|
||||
-enable-kvm -cpu host \
|
||||
$extra_qemu_args
|
||||
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env bash
|
||||
# Launch or validate the Phase 6 KDE runtime surface in QEMU.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
find_uefi_firmware() {
|
||||
local candidates=(
|
||||
"/usr/share/ovmf/x64/OVMF.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF.4m.fd"
|
||||
"/usr/share/ovmf/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/ovmf/OVMF.fd"
|
||||
"/usr/share/OVMF/OVMF_CODE.fd"
|
||||
"/usr/share/qemu/edk2-x86_64-code.fd"
|
||||
)
|
||||
local path
|
||||
for path in "${candidates[@]}"; do
|
||||
if [[ -f "$path" ]]; then
|
||||
printf '%s\n' "$path"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<'USAGE'
|
||||
Usage: test-phase6-kde-qemu.sh [--check] [extra qemu args...]
|
||||
|
||||
Boot or validate the Red Bear OS Phase 6 KDE session surface on redbear-kde.
|
||||
USAGE
|
||||
}
|
||||
|
||||
check_mode=0
|
||||
filtered_args=()
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--help|-h|help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--check)
|
||||
check_mode=1
|
||||
;;
|
||||
*)
|
||||
filtered_args+=("$arg")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
firmware="$(find_uefi_firmware)" || {
|
||||
echo "ERROR: no usable x86_64 UEFI firmware found" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
arch="${ARCH:-$(uname -m)}"
|
||||
image="build/$arch/redbear-kde/harddrive.img"
|
||||
extra="build/$arch/redbear-kde/extra.img"
|
||||
extra_qemu_args="${filtered_args[*]:-}"
|
||||
|
||||
if [[ ! -f "$image" ]]; then
|
||||
echo "ERROR: missing image $image" >&2
|
||||
echo "Build it first with: ./local/scripts/build-redbear.sh redbear-kde" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$extra" ]]; then
|
||||
truncate -s 1g "$extra"
|
||||
fi
|
||||
|
||||
if [[ "$check_mode" -eq 1 ]]; then
|
||||
expect <<EOF
|
||||
log_user 1
|
||||
set timeout 240
|
||||
spawn qemu-system-x86_64 -name {Red Bear OS x86_64} -device qemu-xhci -smp 4 -m 2048 -bios $firmware -chardev stdio,id=debug,signal=off,mux=on -serial chardev:debug -mon chardev=debug -machine q35 -device ich9-intel-hda -device hda-output -device virtio-net,netdev=net0 -netdev user,id=net0 -object filter-dump,id=f1,netdev=net0,file=build/$arch/redbear-kde/network.pcap -vga std -drive file=$image,format=raw,if=none,id=drv0 -device nvme,drive=drv0,serial=NVME_SERIAL -drive file=$extra,format=raw,if=none,id=drv1 -device nvme,drive=drv1,serial=NVME_EXTRA -enable-kvm -cpu host $extra_qemu_args
|
||||
expect "login:"
|
||||
send "root\r"
|
||||
expect "assword:"
|
||||
send "password\r"
|
||||
expect "Type 'help' for available commands."
|
||||
send "redbear-phase6-kde-check\r"
|
||||
expect "Red Bear OS Phase 6 KDE Runtime Check"
|
||||
expect "orbital-kde"
|
||||
expect "kwin_wayland"
|
||||
expect "virtio_net_present"
|
||||
send "shutdown\r"
|
||||
expect eof
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec qemu-system-x86_64 \
|
||||
-name "Red Bear OS x86_64" \
|
||||
-device qemu-xhci \
|
||||
-smp 4 \
|
||||
-m 2048 \
|
||||
-bios "$firmware" \
|
||||
-chardev stdio,id=debug,signal=off,mux=on \
|
||||
-serial chardev:debug \
|
||||
-mon chardev=debug \
|
||||
-machine q35 \
|
||||
-device ich9-intel-hda -device hda-output \
|
||||
-device virtio-net,netdev=net0 \
|
||||
-netdev user,id=net0 \
|
||||
-object filter-dump,id=f1,netdev=net0,file="build/$arch/redbear-kde/network.pcap" \
|
||||
-vga std \
|
||||
-drive file="$image",format=raw,if=none,id=drv0 \
|
||||
-device nvme,drive=drv0,serial=NVME_SERIAL \
|
||||
-drive file="$extra",format=raw,if=none,id=drv1 \
|
||||
-device nvme,drive=drv1,serial=NVME_EXTRA \
|
||||
-enable-kvm -cpu host \
|
||||
$extra_qemu_args
|
||||
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env bash
|
||||
# Validate USB mass-storage autospawn via xHCI in QEMU.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
find_uefi_firmware() {
|
||||
local candidates=(
|
||||
"/usr/share/ovmf/x64/OVMF.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF.4m.fd"
|
||||
"/usr/share/ovmf/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/ovmf/OVMF.fd"
|
||||
"/usr/share/OVMF/OVMF_CODE.fd"
|
||||
"/usr/share/qemu/edk2-x86_64-code.fd"
|
||||
)
|
||||
local path
|
||||
for path in "${candidates[@]}"; do
|
||||
if [[ -f "$path" ]]; then
|
||||
printf '%s\n' "$path"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<'USAGE'
|
||||
Usage: test-usb-storage-qemu.sh [config]
|
||||
|
||||
Boot a Red Bear image with a USB storage device attached and verify usbscsid autospawn.
|
||||
Defaults to redbear-desktop.
|
||||
USAGE
|
||||
}
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--help|-h|help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
config="${1:-redbear-desktop}"
|
||||
arch="${ARCH:-$(uname -m)}"
|
||||
image="build/$arch/$config/harddrive.img"
|
||||
extra="build/$arch/$config/extra.img"
|
||||
usb_img="build/$arch/$config/usb-storage.img"
|
||||
log_file="build/$arch/$config/usb-storage-check.log"
|
||||
firmware="$(find_uefi_firmware)" || {
|
||||
echo "ERROR: no usable x86_64 UEFI firmware found" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ ! -f "$image" ]]; then
|
||||
echo "ERROR: missing image $image" >&2
|
||||
echo "Build it first with: ./local/scripts/build-redbear.sh $config" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$extra" ]]; then
|
||||
truncate -s 1g "$extra"
|
||||
fi
|
||||
|
||||
if [[ ! -f "$usb_img" ]]; then
|
||||
truncate -s 64M "$usb_img"
|
||||
fi
|
||||
|
||||
pkill -f "qemu-system-x86_64.*$image" 2>/dev/null || true
|
||||
sleep 1
|
||||
|
||||
rm -f "$log_file"
|
||||
set +e
|
||||
timeout 120s qemu-system-x86_64 \
|
||||
-name "Red Bear OS x86_64" \
|
||||
-device qemu-xhci,id=xhci \
|
||||
-smp 4 \
|
||||
-m 2048 \
|
||||
-bios "$firmware" \
|
||||
-chardev stdio,id=debug,signal=off,mux=on \
|
||||
-serial chardev:debug \
|
||||
-mon chardev=debug \
|
||||
-machine q35 \
|
||||
-device ich9-intel-hda -device hda-output \
|
||||
-device virtio-net,netdev=net0 \
|
||||
-netdev user,id=net0 \
|
||||
-object filter-dump,id=f1,netdev=net0,file="build/$arch/$config/network.pcap" \
|
||||
-nographic -vga none \
|
||||
-drive file="$image",format=raw,if=none,id=drv0 \
|
||||
-device nvme,drive=drv0,serial=NVME_SERIAL \
|
||||
-drive file="$extra",format=raw,if=none,id=drv1 \
|
||||
-device nvme,drive=drv1,serial=NVME_EXTRA \
|
||||
-drive file="$usb_img",format=raw,if=none,id=usbdisk \
|
||||
-device usb-storage,bus=xhci.0,drive=usbdisk \
|
||||
-enable-kvm -cpu host \
|
||||
> "$log_file" 2>&1
|
||||
set -e
|
||||
|
||||
if ! grep -q "USB SCSI driver spawned" "$log_file"; then
|
||||
echo "ERROR: usbscsid did not autospawn; see $log_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -q "panic\|usbscsid: .*IO ERROR\|usbscsid: startup failed\|usbscsid: event queue error\|usbscsid: scheme tick failed\|bulk .* endpoint stalled" "$log_file"; then
|
||||
echo "ERROR: USB storage path hit a crash/error; see $log_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "USB mass-storage autospawn detected in $log_file"
|
||||
@@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env bash
|
||||
# Launch or validate xHCI interrupt-mode bring-up in QEMU.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
find_uefi_firmware() {
|
||||
local candidates=(
|
||||
"/usr/share/ovmf/x64/OVMF.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF.4m.fd"
|
||||
"/usr/share/ovmf/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/OVMF/x64/OVMF_CODE.4m.fd"
|
||||
"/usr/share/ovmf/OVMF.fd"
|
||||
"/usr/share/OVMF/OVMF_CODE.fd"
|
||||
"/usr/share/qemu/edk2-x86_64-code.fd"
|
||||
)
|
||||
local path
|
||||
for path in "${candidates[@]}"; do
|
||||
if [[ -f "$path" ]]; then
|
||||
printf '%s\n' "$path"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<'USAGE'
|
||||
Usage: test-xhci-irq-qemu.sh [--check] [config]
|
||||
|
||||
Boot or validate xHCI interrupt-mode bring-up on a Red Bear image in QEMU.
|
||||
USAGE
|
||||
}
|
||||
|
||||
check_mode=0
|
||||
config="redbear-desktop"
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--help|-h|help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--check)
|
||||
check_mode=1
|
||||
;;
|
||||
redbear-*)
|
||||
config="$arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
firmware="$(find_uefi_firmware)" || {
|
||||
echo "ERROR: no usable x86_64 UEFI firmware found" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
arch="${ARCH:-$(uname -m)}"
|
||||
image="build/$arch/$config/harddrive.img"
|
||||
extra="build/$arch/$config/extra.img"
|
||||
|
||||
if [[ ! -f "$image" ]]; then
|
||||
echo "ERROR: missing image $image" >&2
|
||||
echo "Build it first with: ./local/scripts/build-redbear.sh $config" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$extra" ]]; then
|
||||
truncate -s 1g "$extra"
|
||||
fi
|
||||
|
||||
pkill -f "qemu-system-x86_64.*$image" 2>/dev/null || true
|
||||
sleep 1
|
||||
|
||||
if [[ "$check_mode" -eq 1 ]]; then
|
||||
log_file="build/$arch/$config/xhci-irq-check.log"
|
||||
rm -f "$log_file"
|
||||
set +e
|
||||
timeout 90s qemu-system-x86_64 \
|
||||
-name "Red Bear OS x86_64" \
|
||||
-device qemu-xhci \
|
||||
-smp 4 \
|
||||
-m 2048 \
|
||||
-bios "$firmware" \
|
||||
-chardev stdio,id=debug,signal=off,mux=on \
|
||||
-serial chardev:debug \
|
||||
-mon chardev=debug \
|
||||
-machine q35 \
|
||||
-device ich9-intel-hda -device hda-output \
|
||||
-device virtio-net,netdev=net0 \
|
||||
-netdev user,id=net0 \
|
||||
-object filter-dump,id=f1,netdev=net0,file="build/$arch/$config/network.pcap" \
|
||||
-nographic -vga none \
|
||||
-drive file="$image",format=raw,if=none,id=drv0 \
|
||||
-device nvme,drive=drv0,serial=NVME_SERIAL \
|
||||
-drive file="$extra",format=raw,if=none,id=drv1 \
|
||||
-device nvme,drive=drv1,serial=NVME_EXTRA \
|
||||
-enable-kvm -cpu host \
|
||||
> "$log_file" 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
if ! grep -q "xhcid: using MSI/MSI-X interrupt delivery\|xhcid: using legacy INTx interrupt delivery" "$log_file"; then
|
||||
echo "ERROR: xhcid did not report an interrupt-driven mode; see $log_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "xHCI interrupt mode detected in $log_file"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec qemu-system-x86_64 \
|
||||
-name "Red Bear OS x86_64" \
|
||||
-device qemu-xhci \
|
||||
-smp 4 \
|
||||
-m 2048 \
|
||||
-bios "$firmware" \
|
||||
-chardev stdio,id=debug,signal=off,mux=on \
|
||||
-serial chardev:debug \
|
||||
-mon chardev=debug \
|
||||
-machine q35 \
|
||||
-device ich9-intel-hda -device hda-output \
|
||||
-device virtio-net,netdev=net0 \
|
||||
-netdev user,id=net0 \
|
||||
-object filter-dump,id=f1,netdev=net0,file="build/$arch/$config/network.pcap" \
|
||||
-vga std \
|
||||
-drive file="$image",format=raw,if=none,id=drv0 \
|
||||
-device nvme,drive=drv0,serial=NVME_SERIAL \
|
||||
-drive file="$extra",format=raw,if=none,id=drv1 \
|
||||
-device nvme,drive=drv1,serial=NVME_EXTRA \
|
||||
-enable-kvm -cpu host
|
||||
Reference in New Issue
Block a user