[pve-devel] [PATCH] add ovmf uefi roms support V2

Alexandre Derumier aderumier at odiso.com
Sat Nov 21 08:48:59 CET 2015


changelog:

use OVMF-pure-efi.fd instead OVMF_CODE-pure-efi.fd to have virtio drivers support

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 81a1c84..8b4f447 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 ?
@@ -2683,6 +2690,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.1.4




More information about the pve-devel mailing list