⬢ DragonFlyBSD Kernel Audit
DF-4064 / vm_fxp.sh
← back to finding ↓ download raw
#!/bin/sh
# vm_fxp.sh -- TEMPORARY launcher for DF-4064 (fxp callout AB-BA live test).
# Identical to vm.sh's `up` invocation, plus a QEMU e100 (i82557b) on a second
# user netdev so the in-kernel fxp(4) driver (device fxp in X86_64_GENERIC)
# attaches fxp0 for real. vm.sh itself is untouched; PIDFILE/BOOTLOG names are
# kept so vm.sh down/reset/log keep managing this instance.
#
#   romfile=  disables the NIC's PXE option ROM so SeaBIOS boots the virtio
#   disk (the only bootable device) -- no bootindex shuffle needed.
set -eu
cd "$(dirname "$0")"

qemu-system-x86_64 \
    -enable-kvm -m 4096 -smp 6 \
    -drive file="disk.qcow2",if=virtio,format=qcow2 \
    -netdev user,id=n0,hostfwd=tcp:127.0.0.1:5522-:22 \
    -device virtio-net-pci,netdev=n0 \
    -netdev user,id=n1 \
    -device i82557b,netdev=n1,romfile= \
    -display none -monitor unix:"boot-mon.sock",server,nowait \
    -serial file:"boot-fxp.log" \
    -daemonize -pidfile "vm.pid"
echo "fxp launcher: qemu started (pid $(cat vm.pid)); polling ssh..."
i=0
while [ "$i" -lt 150 ]; do
    if ssh -F config -o ConnectTimeout=8 -o BatchMode=yes dfbsd-maxx true >/dev/null 2>&1; then
        echo "up"
        exit 0
    fi
    sleep 3; i=$((i+3))
done
echo "TIMEOUT waiting for ssh" >&2
exit 1