100 lines
3.6 KiB
Diff
100 lines
3.6 KiB
Diff
From 71d07ee8db5f48baad5d1f9cee46bfc194683f43 Mon Sep 17 00:00:00 2001
|
|
From: yueyuankun <yueyuankun@kylinoscn>
|
|
Date: Thu, 27 Feb 2025 06:20:17 +0000
|
|
Subject: [PATCH] add support for sw_64 architecture
|
|
|
|
---
|
|
pyanaconda/modules/storage/bootloader/efi.py | 25 ++++++++++++++++++-
|
|
.../modules/storage/bootloader/factory.py | 4 +++
|
|
pyanaconda/modules/storage/platform.py | 9 +++++++
|
|
3 files changed, 37 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/pyanaconda/modules/storage/bootloader/efi.py b/pyanaconda/modules/storage/bootloader/efi.py
|
|
index 919bb1a..324e2db 100644
|
|
--- a/pyanaconda/modules/storage/bootloader/efi.py
|
|
+++ b/pyanaconda/modules/storage/bootloader/efi.py
|
|
@@ -28,7 +28,7 @@ from pyanaconda.product import productName
|
|
from pyanaconda.anaconda_loggers import get_module_logger
|
|
log = get_module_logger(__name__)
|
|
|
|
-__all__ = ["EFIBase", "EFIGRUB", "Aarch64EFIGRUB", "ArmEFIGRUB", "MacEFIGRUB", "LOONGARCHEFIGRUB"]
|
|
+__all__ = ["EFIBase", "EFIGRUB", "Aarch64EFIGRUB", "ArmEFIGRUB", "MacEFIGRUB", "LOONGARCHEFIGRUB", "SW64EFIGRUB"]
|
|
|
|
|
|
class EFIBase(object):
|
|
@@ -194,6 +194,29 @@ class LOONGARCHEFIGRUB(EFIGRUB):
|
|
self._add_single_efi_boot_target(parent)
|
|
|
|
|
|
+class SW64EFIGRUB(EFIGRUB):
|
|
+ _efi_binary = "grubsw64.efi"
|
|
+ stage2_is_valid_stage1 = False
|
|
+ stage2_bootable = False
|
|
+
|
|
+ def __init__(self):
|
|
+ super().__init__()
|
|
+ self._packages64 = ["grub2-efi-sw64"]
|
|
+
|
|
+ def remove_efi_boot_target(self):
|
|
+ return
|
|
+
|
|
+ def _add_single_efi_boot_target(self, partition):
|
|
+ boot_disk = partition.disk
|
|
+ boot_part_num = str(partition.parted_partition.number)
|
|
+
|
|
+ def add_efi_boot_target(self):
|
|
+ if self.stage1_device.type == "partition": # pylint: disable=no-member
|
|
+ self._add_single_efi_boot_target(self.stage1_device) # pylint: disable=no-member
|
|
+ elif self.stage1_device.type == "mdarray": # pylint: disable=no-member
|
|
+ for parent in self.stage1_device.parents: # pylint: disable=no-member
|
|
+ self._add_single_efi_boot_target(parent)
|
|
+
|
|
class ArmEFIGRUB(EFIGRUB):
|
|
_serial_consoles = ["ttyAMA", "ttyS"]
|
|
_efi_binary = "\\grubarm.efi"
|
|
diff --git a/pyanaconda/modules/storage/bootloader/factory.py b/pyanaconda/modules/storage/bootloader/factory.py
|
|
index 643f633..be92494 100644
|
|
--- a/pyanaconda/modules/storage/bootloader/factory.py
|
|
+++ b/pyanaconda/modules/storage/bootloader/factory.py
|
|
@@ -118,6 +118,10 @@ class BootLoaderFactory(object):
|
|
from pyanaconda.modules.storage.bootloader.efi import LOONGARCHEFIGRUB
|
|
return LOONGARCHEFIGRUB
|
|
|
|
+ if platform_class is platform.SW64EFI:
|
|
+ from pyanaconda.modules.storage.bootloader.efi import SW64EFIGRUB
|
|
+ return SW64EFIGRUB
|
|
+
|
|
if platform_class is platform.MacEFI:
|
|
from pyanaconda.modules.storage.bootloader.efi import MacEFIGRUB
|
|
return MacEFIGRUB
|
|
diff --git a/pyanaconda/modules/storage/platform.py b/pyanaconda/modules/storage/platform.py
|
|
index 2bb8e41..0b433f8 100644
|
|
--- a/pyanaconda/modules/storage/platform.py
|
|
+++ b/pyanaconda/modules/storage/platform.py
|
|
@@ -295,6 +295,13 @@ class LOONGARCHEFI(EFI):
|
|
return ["vfat", "ntfs"]
|
|
|
|
|
|
+class SW64EFI(EFI):
|
|
+
|
|
+ @property
|
|
+ def non_linux_format_types(self):
|
|
+ """Format types of devices with non-linux operating systems."""
|
|
+ return ["vfat", "ntfs"]
|
|
+
|
|
class ArmEFI(EFI):
|
|
|
|
@property
|
|
@@ -532,6 +539,8 @@ def get_platform():
|
|
return RISCV64EFI()
|
|
elif arch.is_loongarch():
|
|
return LOONGARCHEFI()
|
|
+ elif arch.is_sw_64():
|
|
+ return SW64EFI()
|
|
else:
|
|
return EFI()
|
|
elif arch.is_x86():
|
|
--
|
|
2.43.0
|
|
|