From 26ef3b149f26ab94bcd59484a53b98f95144eacc Mon Sep 17 00:00:00 2001 From: "yan.yihao 10263201" Date: Sun, 15 Jun 2025 08:01:07 +0800 Subject: [PATCH] add riscv64 support --- ...scv64-enablement-patch-from-upstream.patch | 98 +++++++++++++++++++ anaconda.spec | 7 +- 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 1009-backport-a-riscv64-enablement-patch-from-upstream.patch diff --git a/1009-backport-a-riscv64-enablement-patch-from-upstream.patch b/1009-backport-a-riscv64-enablement-patch-from-upstream.patch new file mode 100644 index 0000000..18103af --- /dev/null +++ b/1009-backport-a-riscv64-enablement-patch-from-upstream.patch @@ -0,0 +1,98 @@ +diff -ruN a/pyanaconda/modules/storage/bootloader/efi.py b/pyanaconda/modules/storage/bootloader/efi.py +--- a/pyanaconda/modules/storage/bootloader/efi.py 2025-06-13 05:43:41.552108550 -0400 ++++ b/pyanaconda/modules/storage/bootloader/efi.py 2025-06-13 05:46:00.542756702 -0400 +@@ -243,6 +243,15 @@ + self._is_32bit_firmware = True + + ++class RISCV64EFIGRUB(EFIGRUB): ++ _serial_consoles = ["ttyS"] ++ _efi_binary = "\\grubriscv64.efi" ++ ++ def __init__(self): ++ super().__init__() ++ self._packages64 = ["grub2-efi-riscv64"] ++ ++ + class MacEFIGRUB(EFIGRUB): + def __init__(self): + super().__init__() +diff -ruN a/pyanaconda/modules/storage/bootloader/factory.py b/pyanaconda/modules/storage/bootloader/factory.py +--- a/pyanaconda/modules/storage/bootloader/factory.py 2025-06-13 05:43:41.552108550 -0400 ++++ b/pyanaconda/modules/storage/bootloader/factory.py 2025-06-13 05:46:52.783000312 -0400 +@@ -150,4 +150,12 @@ + from pyanaconda.modules.storage.bootloader.efi import ArmEFIGRUB + return ArmEFIGRUB + ++ if platform_class is platform.RISCV64: ++ from pyanaconda.modules.storage.bootloader.extlinux import EXTLINUX ++ return EXTLINUX ++ ++ if platform_class is platform.RISCV64EFI: ++ from pyanaconda.modules.storage.bootloader.efi import RISCV64EFIGRUB ++ return RISCV64EFIGRUB ++ + return None +diff -ruN a/pyanaconda/modules/storage/platform.py b/pyanaconda/modules/storage/platform.py +--- a/pyanaconda/modules/storage/platform.py 2025-06-13 05:43:41.552108550 -0400 ++++ b/pyanaconda/modules/storage/platform.py 2025-06-13 05:50:29.814012388 -0400 +@@ -468,6 +468,41 @@ + return dict(super().stage1_constraints, **constraints) + + ++class RISCV64(Platform): ++ ++ @property ++ def stage1_suggestion(self): ++ """The platform-specific suggestion about the stage1 device.""" ++ return _( ++ "You must include at least one MBR-formatted " ++ "disk as an install target." ++ ) ++ ++ @property ++ def stage1_descriptions(self): ++ """The platform-specific descriptions of the stage1 device.""" ++ return { ++ "disk": _(MBR_DESCRIPTION), ++ "partition": _(PARTITION_DESCRIPTION) ++ } ++ ++ @property ++ def stage1_constraints(self): ++ """The platform-specific constraints for the stage1 device.""" ++ constraints = { ++ PLATFORM_DEVICE_TYPES: ["disk"] ++ } ++ return dict(super().stage1_constraints, **constraints) ++ ++ ++class RISCV64EFI(EFI): ++ ++ @property ++ def non_linux_format_types(self): ++ """Format types of devices with non-linux operating systems.""" ++ return ["vfat", "ntfs"] ++ ++ + def get_platform(): + """Check the architecture of the system and return an instance of a + Platform subclass to match. If the architecture could not be determined, +@@ -496,6 +531,8 @@ + return ArmEFI() + elif arch.is_loongarch(): + return LOONGARCHEFI() ++ elif arch.is_riscv64(): ++ return RISCV64EFI() + else: + return EFI() + elif arch.is_x86(): +@@ -504,6 +541,8 @@ + return ARM() + elif arch.is_loongarch(): + return LOONGARCHEFI() ++ elif arch.is_riscv64(): ++ return RISCV64() + else: + raise SystemError("Could not determine system architecture.") + diff --git a/anaconda.spec b/anaconda.spec index b4526d1..a18d37b 100644 --- a/anaconda.spec +++ b/anaconda.spec @@ -1,4 +1,4 @@ -%define anolis_release 7 +%define anolis_release 8 Summary: Graphical system installer Name: anaconda @@ -32,6 +32,8 @@ Patch1006: 1006-Reconfig-blivet-ABI-version-to-3.0.patch Patch1007: 1007-Remove-nvdimm-support.patch # Refer to https://github.com/rhinstaller/anaconda/commit/4d2164c19bb082dcff57df39556169ed484fa668 Patch1008: 1008-Do-not-use-stringize-and-unicodeize-from-Blivet.patch +# Refer to https://github.com/rhinstaller/anaconda/commit/fed051f660c06ce9c3566b8fb12864a5c2737423 +Patch1009: 1009-backport-a-riscv64-enablement-patch-from-upstream.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -453,6 +455,9 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{buildroot}%{_d %{_prefix}/libexec/anaconda/dd_* %changelog +* Fri Jun 13 2025 Yihao Yan - 38.23-8 +- add riscv64 support + * Fri Dec 13 2024 Chang Gao - 38.23-6 - Reconfig blockdev version to 3.0 - Backport patch to remove unsupported device: nvdimm -- Gitee