From 44ca3689d8ae8055843e8797987bb41fc9c668b5 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Fri, 20 Mar 2020 13:50:01 +0000 Subject: [PATCH] Setup EFI vars device when EFI booting. This also allows Virgil 3D to work when EFI booting --- README.md | 3 ++- quickemu.sh | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cda4bf2..e65eba0 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Usage You can also pass optional parameters --delete : Delete the disk image. - --efi : Enable EFI BIOS (experimental). + --efi : Enable EFI BIOS. --restore : Restore the snapshot. --snapshot : Create a disk snapshot. ``` @@ -95,4 +95,5 @@ You can also pass optional parameters - [x] Make disk image optionally size configurable - [ ] Improve snapshot management - [ ] Create desktop launcher for a VM + - [x] Fix Virgil 3D on EFI boot - [x] Get QEMU `-audiodev` working for audio input, something like: \ No newline at end of file diff --git a/quickemu.sh b/quickemu.sh index f9d0673..395a67e 100755 --- a/quickemu.sh +++ b/quickemu.sh @@ -44,6 +44,7 @@ function get_port() { function vm_boot() { local VMNAME=$(basename ${VM} .conf) + local VMDIR=$(dirname ${disk_img}) local BIOS="" local GL="on" local VIRGL="on" @@ -66,8 +67,10 @@ function vm_boot() { if [ ${ENABLE_EFI} -eq 1 ]; then if [ -e /snap/qemu-virgil/current/usr/share/qemu/edk2-x86_64-code.fd ] ; then - BIOS="-drive if=pflash,format=raw,readonly,file=/snap/qemu-virgil/current/usr/share/qemu/edk2-x86_64-code.fd" - VIRGL="off" + if [ ! -e ${VMDIR}/${VMNAME}-vars.fd ]; then + cp /snap/qemu-virgil/current/usr/share/qemu/edk2-i386-vars.fd ${VMDIR}/${VMNAME}-vars.fd + fi + BIOS="-drive if=pflash,format=raw,readonly,file=/snap/qemu-virgil/current/usr/share/qemu/edk2-x86_64-code.fd -drive if=pflash,format=raw,file=${VMDIR}/${VMNAME}-vars.fd" else echo " - EFI: Booting requested but no EFI firmware found." echo " Booting from Legacy BIOS." @@ -201,7 +204,7 @@ function usage() { echo echo "You can also pass optional parameters" echo " --delete : Delete the disk image." - echo " --efi : Enable EFI BIOS (experimental)." + echo " --efi : Enable EFI BIOS." echo " --restore : Restore the snapshot." echo " --snapshot : Create a disk snapshot." exit 1