summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kastner <ckk@kvr.at>2021-01-11 23:49:04 +0100
committerLars Wirzenius <liw@liw.fi>2021-01-16 09:11:02 +0200
commitc49594f240132d2d9a0eeef407d9219c21c86f85 (patch)
tree77bbe007d0945592931f33245d1ce2d2e604ac1f
parentf60bdf43c2364fe7ce8389b060bbdb3d822f4a1b (diff)
downloadvmdb2-c49594f240132d2d9a0eeef407d9219c21c86f85.tar.gz
feat: Add support for IEEE1275 booting
Adaptation of a solution provided by Ryutaroh.
-rw-r--r--vmdb/plugins/grub.mdwn20
-rw-r--r--vmdb/plugins/grub_plugin.py21
2 files changed, 36 insertions, 5 deletions
diff --git a/vmdb/plugins/grub.mdwn b/vmdb/plugins/grub.mdwn
index 037d4d3..75314f8 100644
--- a/vmdb/plugins/grub.mdwn
+++ b/vmdb/plugins/grub.mdwn
@@ -2,8 +2,9 @@ Step: grub
-----------------------------------------------------------------------------
Install the GRUB bootloader to the image. Works on a PC for
-traditional BIOS booting and both a PC and arm64 machines for modern
-UEFI booting. Does not (yet?) support Secure Boot.
+traditional BIOS booting, PC and ARM machines for modern
+UEFI booting, and PowerPC machines for IEEE1275 booting. Supports Secure Boot
+for amd64 UEFI.
Warning: This is the least robust part of vmdb2.
@@ -16,7 +17,10 @@ Step keys:
* `tag` &mdash; REQUIRED; value is the tag for the root filesystem.
* `efi` &mdash; REQUIRED for UEFI; value is the tag for the EFI
- filesystem.
+ partition.
+
+* `prep` &mdash; REQUIRED for IEEE1275; value is the tag for the
+ PReP partition.
* `console` &mdash; OPTIONAL; set to `serial` to configure the image
to use a serial console.
@@ -35,13 +39,21 @@ Example (in the .vmdb file):
- grub: bios
tag: root
-Same, but for UEFI:
+Same, but for UEFI, assuming that a FAT32 filesystem exists on the
+partition with tag `efi`:
- grub: uefi
tag: root
efi: efi
console: serial
+Or for IEEE1275, assuming that a partition with tag `prep` exists:
+
+ - grub: ieee1275
+ tag: root
+ prep: prep
+ console: serial
+
Install to a real hard disk (named with the `--image` option):
- grub: uefi
diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py
index 7905c97..b57ce72 100644
--- a/vmdb/plugins/grub_plugin.py
+++ b/vmdb/plugins/grub_plugin.py
@@ -88,6 +88,7 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
"root-fs": "",
"efi": "",
"efi-part": "",
+ "prep": "",
"console": "",
"tag": "",
"image-dev": "",
@@ -102,6 +103,8 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
self.install_uefi(values, settings, state)
elif flavor == "bios":
self.install_bios(values, settings, state)
+ elif flavor == "ieee1275":
+ self.install_ieee1275(values, settings, state)
else:
raise Exception("Unknown GRUB flavor {}".format(flavor))
@@ -135,6 +138,12 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
grub_target = "i386-pc"
self.install_grub(values, settings, state, grub_package, grub_target)
+ def install_ieee1275(self, values, settings, state):
+ vmdb.progress("Installing GRUB for IEEE1275")
+ grub_package = "grub-ieee1275"
+ grub_target = "powerpc-ieee1275"
+ self.install_grub(values, settings, state, grub_package, grub_target)
+
def install_grub(self, values, settings, state, grub_package, grub_target):
console = values["console"] or None
@@ -155,11 +164,21 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
else:
efi_dev = None
+ prep = values["prep"] or None
+ if prep:
+ prep_dev = state.tags.get_dev(prep)
+ else:
+ prep_dev = None
+
quiet = values["quiet"]
- self.bind_mount_many(chroot, ["/dev", "/sys"], state)
+ self.bind_mount_many(chroot, ["/dev", "/sys", "/proc"], state)
if efi_dev:
self.mount(chroot, efi_dev, "/boot/efi", state)
+ elif prep_dev:
+ pn = prep_dev[-1]
+ vmdb.runcmd(["parted", "-s", image_dev, "set", pn, "prep", "on" ])
+ image_dev = prep_dev
self.install_package(chroot, grub_package)
kernel_params = [