Skip to content

Commit

Permalink
Add EFISYSTEMD class and enable aarch64
Browse files Browse the repository at this point in the history
Now that we have a systemd bootloader class lets add
an efi class that can call it to install the bootloader.

Then create Aarch64EFISystemBoot class that can utilize it.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
  • Loading branch information
jlintonarm authored and poncovka committed Mar 9, 2023
1 parent e069f2a commit d8f0384
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions pyanaconda/modules/storage/bootloader/efi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@

from pyanaconda.modules.storage.bootloader.base import BootLoaderError
from pyanaconda.modules.storage.bootloader.grub2 import GRUB2
from pyanaconda.modules.storage.bootloader.systemd import SystemdBoot
from pyanaconda.core import util
from pyanaconda.core.kernel import kernel_arguments
from pyanaconda.core.i18n import _
from pyanaconda.core.configuration.anaconda import conf
from pyanaconda.core.kernel import kernel_arguments
from pyanaconda.core.path import join_paths
from pyanaconda.product import productName

from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)

__all__ = ["EFIBase", "EFIGRUB", "Aarch64EFIGRUB", "ArmEFIGRUB", "MacEFIGRUB"]
__all__ = ["EFIBase", "EFIGRUB", "Aarch64EFIGRUB", "ArmEFIGRUB", "MacEFIGRUB", "Aarch64EFISystemdBoot"]


class EFIBase(object):
Expand Down Expand Up @@ -200,6 +203,46 @@ def write_config(self):
super().write_config()


class EFISystemdBoot(EFIBase, SystemdBoot):
"""EFI Systemd-boot"""
_packages_common = ["efibootmgr", "systemd-udev", "systemd-boot", "sdubby"]
_packages64 = []

def __init__(self):
super().__init__()

if self.get_fw_platform_size() == '32':
# not supported try a different bootloader
log.error("efi.py: systemd-boot is not supported on 32-bit platforms")
raise BootLoaderError(_("Systemd-boot is not supported on this platform"))

@property
def packages(self):
return self._packages64 + self._packages_common

@property
def efi_config_file(self):
""" Full path to EFI configuration file. """
return join_paths(self.efi_config_dir, self._config_file)

def write_config(self):
""" Write the config settings to config file (ex: grub.cfg) not needed for systemd. """
config_path = join_paths(conf.target.system_root, self.efi_config_file)

log.info("efi.py: (systemd) write_config systemd : %s ", config_path)

super().write_config()

def install(self, args=None):
log.info("efi.py: (systemd) install")
# force the resolution order, we don't want to:
# efibootmgr remove old "fedora"
# or use efiboot mgr to install a new one
# lets just use `bootctl install` directly.
# which will fix the efi boot variables too.
SystemdBoot.install(self)


class Aarch64EFIGRUB(EFIGRUB):
_serial_consoles = ["ttyAMA", "ttyS"]
_efi_binary = "\\shimaa64.efi"
Expand All @@ -209,6 +252,15 @@ def __init__(self):
self._packages64 = ["grub2-efi-aa64", "shim-aa64"]


class Aarch64EFISystemdBoot(EFISystemdBoot):
_serial_consoles = ["ttyAMA", "ttyS"]
_efi_binary = "\\systemd-bootaa64.efi"

def __init__(self):
super().__init__()
self._packages64 = []


class ArmEFIGRUB(EFIGRUB):
_serial_consoles = ["ttyAMA", "ttyS"]
_efi_binary = "\\grubarm.efi"
Expand Down

0 comments on commit d8f0384

Please sign in to comment.