First version
This commit is contained in:
commit
243e92a9dd
84 files changed
+4012
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Boots the built image in a window, to try it as a team would. Changes made
|
||||
# in this window are discarded when it closes (snapshot mode).
|
||||
#
|
||||
# ./run_vm.sh # build/acpc2026.qcow2
|
||||
# ./run_vm.sh path/to/image.img # another image
|
||||
# DISPLAY_OPT="-display none -vnc 127.0.0.1:7" ./run_vm.sh # without a window
|
||||
cd "$(dirname "$0")"
|
||||
IMG=${1:-build/acpc2026.qcow2}
|
||||
[ -f "$IMG" ] || { echo "Image not found: $IMG (run ./build.sh first)" >&2; exit 1; }
|
||||
FORMAT=$(qemu-img info --output=json "$IMG" | python3 -I -c 'import json, sys; print(json.load(sys.stdin)["format"])')
|
||||
|
||||
for dir in /usr/share/edk2/x64 /usr/share/OVMF /usr/share/edk2/ovmf; do
|
||||
for code in OVMF_CODE.4m.fd OVMF_CODE_4M.fd OVMF_CODE.fd; do
|
||||
[ -f "$dir/$code" ] && { OVMF_CODE=$dir/$code; OVMF_VARS=$dir/${code/CODE/VARS}; break 2; }
|
||||
done
|
||||
done
|
||||
[ -n "${OVMF_CODE:-}" ] || { echo "UEFI firmware (OVMF) not found" >&2; exit 1; }
|
||||
VARS=$(mktemp)
|
||||
cp "$OVMF_VARS" "$VARS"
|
||||
trap 'rm -f "$VARS"' EXIT
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
qemu-system-x86_64 -name acpc2026-try -machine q35,accel=kvm -cpu host -m 4096 -smp 4 \
|
||||
-drive if=pflash,format=raw,readonly=on,file="$OVMF_CODE" \
|
||||
-drive if=pflash,format=raw,file="$VARS" \
|
||||
-drive file="$IMG",format="$FORMAT",if=virtio,snapshot=on \
|
||||
-netdev user,id=net0 -device virtio-net-pci,netdev=net0 \
|
||||
-vga virtio ${DISPLAY_OPT:--display gtk} ${QEMU_EXTRA:-}
|
||||
Reference in new issue
Block a user