diff --git a/data/anaconda.conf b/data/anaconda.conf index d42758b90976..ca3037caec09 100644 --- a/data/anaconda.conf +++ b/data/anaconda.conf @@ -138,6 +138,7 @@ selinux = -1 # # DEFAULT Choose the type by platform. # EXTLINUX Use extlinux as the bootloader. +# SDBOOT Use systemd-boot as the bootloader. # type = DEFAULT diff --git a/data/anaconda_options.txt b/data/anaconda_options.txt index 2e61f4b4a7d9..b7cd7650d2de 100644 --- a/data/anaconda_options.txt +++ b/data/anaconda_options.txt @@ -231,6 +231,11 @@ Use extlinux as the bootloader. Note that there's no attempt to validate that this will work for your platform or anything; it assumes that if you ask for it, you want to try. +sdboot +Use systemd-boot as the bootloader. Note that there's no attempt to validate +that this will work for your platform or anything; it assumes that if you +ask for it, you want to try. + nombr If nombr is specified the grub2 bootloader will be installed but the diff --git a/docs/boot-options.rst b/docs/boot-options.rst index 48f165581d4e..f0b4adb712ef 100644 --- a/docs/boot-options.rst +++ b/docs/boot-options.rst @@ -669,6 +669,15 @@ Use extlinux as the bootloader. Note that there's no attempt to validate that this will work for your platform or anything; it assumes that if you ask for it, you want to try. +.. inst.sdboot: + +inst.sdboot +^^^^^^^^^^^^^ + +Use systemd-boot as the bootloader. Note that there's no attempt to validate that +this will work for your platform or anything; it assumes that if you ask for it, +you want to try. + .. inst.leavebootorder: inst.leavebootorder diff --git a/pyanaconda/argument_parsing.py b/pyanaconda/argument_parsing.py index fc23edd2f371..6ff3fd53602f 100644 --- a/pyanaconda/argument_parsing.py +++ b/pyanaconda/argument_parsing.py @@ -597,6 +597,8 @@ def __call__(self, parser, namespace, values, option_string=None): help=help_parser.help_text("noeject")) ap.add_argument("--extlinux", action="store_true", default=False, help=help_parser.help_text("extlinux")) + ap.add_argument("--sdboot", action="store_true", default=False, + help=help_parser.help_text("sdboot")) ap.add_argument("--nombr", action="store_true", default=False, help=help_parser.help_text("nombr")) ap.add_argument("--mpathfriendlynames", dest="multipath_friendly_names", action="store_true", diff --git a/pyanaconda/core/configuration/anaconda.py b/pyanaconda/core/configuration/anaconda.py index 9aa4246cda57..680201e364b5 100644 --- a/pyanaconda/core/configuration/anaconda.py +++ b/pyanaconda/core/configuration/anaconda.py @@ -375,6 +375,8 @@ def set_from_opts(self, opts): # Set the bootloader type. if opts.extlinux: self.bootloader._set_option("type", BootloaderType.EXTLINUX.value) + if opts.sdboot: + self.bootloader._set_option("type", BootloaderType.SDBOOT.value) # Set the boot loader flags. self.bootloader._set_option("nonibft_iscsi_boot", opts.nonibftiscsiboot) diff --git a/pyanaconda/core/configuration/bootloader.py b/pyanaconda/core/configuration/bootloader.py index 6746e4503eef..18b956bbe478 100644 --- a/pyanaconda/core/configuration/bootloader.py +++ b/pyanaconda/core/configuration/bootloader.py @@ -23,8 +23,9 @@ class BootloaderType(Enum): """Type of the bootloader.""" - DEFAULT = "DEFAULT" + DEFAULT = "DEFAULT" EXTLINUX = "EXTLINUX" + SDBOOT = "SDBOOT" class BootloaderSection(Section): @@ -38,6 +39,7 @@ def type(self): DEFAULT Choose the type by platform. EXTLINUX Use extlinux as the bootloader. + SDBOOT Use systemd-boot as the bootloader. :return: an instance of BootloaderType """ diff --git a/pyanaconda/modules/storage/bootloader/bootloader.py b/pyanaconda/modules/storage/bootloader/bootloader.py index c805c0d7853d..e2ded646abc0 100644 --- a/pyanaconda/modules/storage/bootloader/bootloader.py +++ b/pyanaconda/modules/storage/bootloader/bootloader.py @@ -129,6 +129,9 @@ def _set_module_from_kickstart(self, data): if data.bootloader.extlinux: self.set_default_type(BootloaderType.EXTLINUX) + if data.bootloader.systemd: + self.set_default_type(BootloaderType.SDBOOT) + if data.bootloader.bootDrive: self.set_drive(data.bootloader.bootDrive) @@ -184,6 +187,9 @@ def setup_kickstart(self, data): if self.get_default_type() == BootloaderType.EXTLINUX: data.bootloader.extlinux = True + if self.get_default_type() == BootloaderType.SDBOOT: + data.bootloader.systemd = True + if self.bootloader_mode == BootloaderMode.DISABLED: data.bootloader.disabled = True data.bootloader.location = "none" diff --git a/pyanaconda/modules/storage/bootloader/factory.py b/pyanaconda/modules/storage/bootloader/factory.py index 8aa3afb53fed..37dbad376a42 100644 --- a/pyanaconda/modules/storage/bootloader/factory.py +++ b/pyanaconda/modules/storage/bootloader/factory.py @@ -90,6 +90,15 @@ def get_class_by_name(cls, name): from pyanaconda.modules.storage.bootloader.extlinux import EXTLINUX return EXTLINUX + if name == "SDBOOT": + platform_class = platform.platform.__class__ + if platform_class is platform.Aarch64EFI: + from pyanaconda.modules.storage.bootloader.efi import Aarch64EFISystemdBoot + return Aarch64EFISystemdBoot + if platform_class is platform.EFI: + from pyanaconda.modules.storage.bootloader.efi import x64EFISystemdBoot + return x64EFISystemdBoot + return None @classmethod diff --git a/pyanaconda/modules/storage/bootloader/installation.py b/pyanaconda/modules/storage/bootloader/installation.py index 47f445abb3cf..e32014b223c2 100644 --- a/pyanaconda/modules/storage/bootloader/installation.py +++ b/pyanaconda/modules/storage/bootloader/installation.py @@ -21,7 +21,8 @@ from blivet.devices import BTRFSDevice from pyanaconda.core.constants import PAYLOAD_TYPE_RPM_OSTREE, PAYLOAD_LIVE_TYPES from pyanaconda.modules.storage.bootloader import BootLoaderError - +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.configuration.bootloader import BootloaderType from pyanaconda.core.util import execWithRedirect from pyanaconda.modules.common.errors.installation import BootloaderInstallationError from pyanaconda.modules.storage.constants import BootloaderMode @@ -192,6 +193,9 @@ def run(self): if self._payload_type == PAYLOAD_TYPE_RPM_OSTREE: log.debug("Don't regenerate initramfs on rpm-ostree systems.") return + if conf.bootloader.type == BootloaderType.SDBOOT: + log.debug("Don't regenerate initramfs on systemd-boot systems.") + return recreate_initrds( sysroot=self._sysroot,