From a01d22f6ef3ec936573d7e73766877d8ed1efb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Tue, 12 Nov 2019 15:00:47 +0100 Subject: [PATCH] Enable booting the VM as UEFI and provide record for a UEFI machine. This commit adds support for boot options, that can be passed from `hdds.json` to control the creation of the virtual machines, such as enabling of EFI based machines, boot order control, etc. It also adds EFI based machine to `hdds.json` and adds a kickstart file for such machine. --- createhdds.py | 15 ++++++++++----- hdds.json | 12 ++++++++++++ minimal-uefi.ks | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 minimal-uefi.ks diff --git a/createhdds.py b/createhdds.py index 2c87e1d..3d858d9 100755 --- a/createhdds.py +++ b/createhdds.py @@ -198,9 +198,10 @@ class VirtInstallImage(object): included in the image file name if specified. 'maxage' is the maximum age of the image file (in days) - if the image is older than this, 'check' will report it as 'outdated' and 'all' will - rebuild it. + rebuild it. 'bootopts' are used to pass boot options to the + virtual image to provide better control of the VM. """ - def __init__(self, name, release, arch, size, variant=None, imgver='', maxage=14): + def __init__(self, name, release, arch, size, variant=None, imgver='', maxage=14, bootopts=None): self.name = name self.size = size self.filename = "disk_f{0}_{1}".format(str(release), name) @@ -218,6 +219,7 @@ class VirtInstallImage(object): self.variant = "Server" else: self.variant = "Everything" + self.bootopts = bootopts def create(self, textinst, retries=3): """Create the image.""" @@ -272,7 +274,7 @@ class VirtInstallImage(object): # build Workstation images out of Everything if variant == 'Workstation' and str(self.release).isdigit() and int(self.release) > 30: variant = 'Everything' - + try: # this is almost complex enough to need fedfind but not # quite, I think. also fedfind can't find the 'transient' @@ -289,7 +291,9 @@ class VirtInstallImage(object): "--os-variant", shortid, "-x", xargs, "--initrd-inject", "{0}/{1}.ks".format(SCRIPTDIR, self.name), "--location", loctmp.format(fedoradir, str(self.release), variant, arch), "--name", "createhdds", - "--memory", memsize , "--noreboot", "--wait", "-1"] + "--memory", memsize, "--noreboot", "--wait", "-1"] + if self.bootopts: + args.extend(("--boot", self.bootopts)) if textinst: args.extend(("--graphics", "none", "--extra-args", "console=ttyS0")) else: @@ -459,6 +463,7 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None): releases = imggrp['releases'] size = imggrp.get('size', 0) imgver = imggrp.get('imgver') + bootopts = imggrp.get('bootopts') # add an image for each release/arch combination for (release, arches) in releases.items(): if release.lower() == 'branched': @@ -493,7 +498,7 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None): continue imgs.append( VirtInstallImage(name, rel, arch, variant=variant, size=size, imgver=imgver, - maxage=maxage)) + maxage=maxage, bootopts=bootopts)) return imgs def get_all_images(hdds, nextrel=None): diff --git a/hdds.json b/hdds.json index f6d3a2e..5ee8606 100644 --- a/hdds.json +++ b/hdds.json @@ -135,6 +135,18 @@ "size" : "20", "imgver": "3" }, + { + "name" : "minimal-uefi", + "releases" : { + "-1" : ["x86_64"], + "-2" : ["x86_64"], + "stable": ["x86_64"], + "branched": ["x86_64"] + }, + "size" : "20", + "imgver": "3", + "bootopts": "uefi" + }, { "name" : "desktop", "releases" : { diff --git a/minimal-uefi.ks b/minimal-uefi.ks new file mode 100644 index 0000000..e83ced9 --- /dev/null +++ b/minimal-uefi.ks @@ -0,0 +1,19 @@ +install +bootloader --location=mbr +network --bootproto=dhcp +url --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch +repo --name=updates --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch +lang en_US.UTF-8 +keyboard us +timezone --utc America/New_York +clearpart --all +part /boot/efi --fstype=efi --grow --maxsize=200 --size=20 +part /boot --fstype=ext4 --size=1024 +part / --fstype=ext4 --size=17000 +part swap --size=2000 +rootpw weakpassword +poweroff + +%packages +@core +%end