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 <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier 2015-11-21 08:48:59 +01:00 committed by Dietmar Maurer
parent 8a0ebc1460
commit a783c78e0d

View File

@ -30,6 +30,7 @@ use PVE::ProcFSTools;
use PVE::QMPClient; use PVE::QMPClient;
use PVE::RPCEnvironment; use PVE::RPCEnvironment;
use Time::HiRes qw(gettimeofday); use Time::HiRes qw(gettimeofday);
use File::Copy qw(copy);
my $qemu_snap_storage = {rbd => 1, sheepdog => 1}; 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.", description => "Sets the protection flag of the VM. This will prevent the remove operation.",
default => 0, default => 0,
}, },
ovmf => {
optional => 1,
type => 'boolean',
description => "Enable ovmf uefi roms.",
default => 0,
},
}; };
# what about other qemu settings ? # what about other qemu settings ?
@ -2686,6 +2693,15 @@ sub config_to_command {
push @$cmd, '-smbios', "type=1,$conf->{smbios1}"; 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) { if ($q35) {
# the q35 chipset support native usb2, so we enable usb controller # the q35 chipset support native usb2, so we enable usb controller
# by default for this machine type # by default for this machine type