From a783c78e0d61d9408d5c8ae7ce3db71d321c5357 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Sat, 21 Nov 2015 08:48:59 +0100 Subject: [PATCH] add ovmf uefi roms support V2 changelog: use OVMF-pure-efi.fd instead OVMF_CODE-pure-efi.fd to have virtio drivers support Signed-off-by: Alexandre Derumier --- PVE/QemuServer.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 2361e83..eabbd14 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -30,6 +30,7 @@ use PVE::ProcFSTools; use PVE::QMPClient; use PVE::RPCEnvironment; use Time::HiRes qw(gettimeofday); +use File::Copy qw(copy); my $qemu_snap_storage = {rbd => 1, sheepdog => 1}; @@ -390,6 +391,12 @@ EODESCR description => "Sets the protection flag of the VM. This will prevent the remove operation.", default => 0, }, + ovmf => { + optional => 1, + type => 'boolean', + description => "Enable ovmf uefi roms.", + default => 0, + }, }; # what about other qemu settings ? @@ -2686,6 +2693,15 @@ sub config_to_command { push @$cmd, '-smbios', "type=1,$conf->{smbios1}"; } + if ($conf->{ovmf}) { + my $ovmfvar = "OVMF_VARS-pure-efi.fd"; + my $ovmfvar_src = "/usr/share/kvm/$ovmfvar"; + my $ovmfvar_dst = "/tmp/$vmid-$ovmfvar"; + copy $ovmfvar_src,$ovmfvar_dst if !(-e $ovmfvar_dst); + push @$cmd, '-drive', "if=pflash,format=raw,readonly,file=/usr/share/kvm/OVMF-pure-efi.fd"; + push @$cmd, '-drive', "if=pflash,format=raw,file=$ovmfvar_dst"; + } + if ($q35) { # the q35 chipset support native usb2, so we enable usb controller # by default for this machine type -- 2.39.2