Files
installer/run_vm_uefi.sh

45 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Configuration
ISO_PATH="${1:-/home/n0va/Downloads/Fedora-Workstation-Live-43-1.6.x86_64.iso}"
DISK_PATH="${2:-/home/n0va/.local/share/iridium-installer-vm/test-disk.qcow2}"
OVMF_CODE="/usr/share/edk2/x64/OVMF_CODE.4m.fd"
OVMF_VARS_TEMPLATE="/usr/share/edk2/x64/OVMF_VARS.4m.fd"
OVMF_VARS_LOCAL="/tmp/iridium_vm_vars.qcow2"
# Ensure OVMF vars exist in qcow2 format for snapshot support
if [ ! -f "$OVMF_VARS_LOCAL" ]; then
if [ -f "$OVMF_VARS_TEMPLATE" ]; then
echo "Creating UEFI vars file from template..."
qemu-img convert -f raw -O qcow2 "$OVMF_VARS_TEMPLATE" "$OVMF_VARS_LOCAL"
else
echo "Warning: OVMF VARS template not found at $OVMF_VARS_TEMPLATE"
# Fallback to creating an empty qcow2 if template is missing (not ideal but avoids crash)
qemu-img create -f qcow2 "$OVMF_VARS_LOCAL" 528K
fi
fi
echo "Starting Iridium VM with UEFI support..."
echo "ISO: $ISO_PATH"
echo "Disk: $DISK_PATH"
# QEMU Command with UEFI (OVMF) enabled
# We use format=qcow2 for pflash1 to allow snapshots (savevm)
qemu-system-x86_64 \
-enable-kvm \
-m 8G \
-smp 2 \
-cpu host \
-drive if=pflash,format=raw,readonly=on,file="$OVMF_CODE" \
-drive if=pflash,format=qcow2,file="$OVMF_VARS_LOCAL" \
-drive file="$DISK_PATH",format=qcow2,if=virtio \
# -cdrom "$ISO_PATH" \
-boot once=d \
-netdev user,id=net0 \
-device virtio-net-pci,netdev=net0 \
-vga virtio \
-display gtk,gl=on \
-monitor unix:$HOME/.local/share/iridium-installer-vm/monitor.sock,server,nowait \
-name "Iridium Installer Test VM (UEFI)" \
# -loadvm clean-state