Update lmc UEFI support to use the edk2-ovmf package

Fedora now has a edk2 package so use the OVMF code from there. This also
adds using a copy of OVMF_VARS for each boot instead of reusing the one
provided by the package.
This commit is contained in:
Brian C. Lane 2016-05-23 16:14:33 -07:00
parent 6989afb5fd
commit 2a025e8360
2 changed files with 11 additions and 3 deletions

View File

@ -90,6 +90,7 @@ Summary: livemedia-creator libvirt dependencies
Requires: lorax = %{version}-%{release}
Requires: libvirt-python3
Requires: virt-install
Requires: edk2-ovmf
%description lmc-virt
Additional dependencies required by livemedia-creator when using it with virt-install.

View File

@ -71,7 +71,6 @@ DRACUT_DEFAULT = ["--xz", "--add", "livenet dmsquash-live convertfs pollcdrom qe
ROOT_PATH = "/mnt/sysimage/"
RUNTIME = "images/install.img"
UEFI_FIRMWARE="loader={0}/OVMF_CODE.fd,loader_ro=yes,loader_type=pflash,nvram_template={0}/OVMF_VARS.fd"
class InstallError(Exception):
@ -186,13 +185,21 @@ class VirtualInstall(object):
if boot_uefi and ovmf_path:
args.append("--boot")
args.append(UEFI_FIRMWARE.format(ovmf_path))
# Make a copy of the OVMF_VARS.fd for this run
ovmf_vars = tempfile.mktemp(prefix="lmc-OVMF_VARS-", suffix=".fd")
shutil.copy2(joinpaths(ovmf_path, "/OVMF_VARS.fd"), ovmf_vars)
args.append("loader=%s/OVMF_CODE.fd,loader_ro=yes,loader_type=pflash,nvram_template=%s" % (ovmf_path, ovmf_vars))
log.info("Running virt-install.")
try:
execWithRedirect("virt-install", args, raise_err=True)
except subprocess.CalledProcessError as e:
raise InstallError("Problem starting virtual install: %s" % e)
finally:
if boot_uefi and ovmf_path:
os.unlink(ovmf_vars)
conn = libvirt.openReadOnly(None)
dom = conn.lookupByName(self.virt_name)
@ -1191,7 +1198,7 @@ def main():
help="Passed to --arch command")
virt_group.add_argument("--kernel-args",
help="Additional argument to pass to the installation kernel")
virt_group.add_argument("--ovmf-path", default="/usr/share/OVMF/",
virt_group.add_argument("--ovmf-path", default="/usr/share/edk2/ovmf/",
help="Path to OVMF firmware")
virt_group.add_argument("--virt-uefi", action="store_true", default=False,
help="Use OVMF firmware to boot the VM in UEFI mode")