backport a patch for riscv64 enablement from upstream

Signed-off-by: jchzhou <zhoujiacheng@iscas.ac.cn>
This commit is contained in:
jchzhou 2024-05-09 15:47:25 +08:00
parent 89b1bb1980
commit 7fd1e6103d
2 changed files with 122 additions and 1 deletions

View File

@ -1,7 +1,7 @@
%define _empty_manifest_terminate_build 0
Name: anaconda
Version: 36.16.5
Release: 32
Release: 33
Summary: Graphical system installer
License: GPLv2+ and MIT
URL: http://fedoraproject.org/wiki/Anaconda
@ -50,6 +50,8 @@ Patch9022: bugfix-change-the-startup-mode-of-do_transaction-sub-proces.patch
Patch6007: backport-Don-t-attempt-to-add-frozen-python-modules-to-initramfs.patch
Patch6008: backport-module-setup.sh-Don-t-ignore-errors-unbound-variable-and-pipe-fails.patch
Patch6009: backport-Fix-the-systemd-generator-for-systemd-253-2165433.patch
# https://github.com/rhinstaller/anaconda/pull/5198
Patch6010: backport-a-riscv64-enablement-patch-from-upstream.patch
Patch9023: bugfix-change-root-and-storage-interface-shows.patch
Patch9024: bugfix-revert-Set-default-entry-to-the-BLS-id-instead-of-the-entry-index.patch
@ -315,6 +317,12 @@ update-desktop-database &> /dev/null || :
%{_prefix}/libexec/anaconda/dd_*
%changelog
* Thu May 09 2024 jchzhou <zhoujiacheng@iscas.ac.cn> - 36.16.5-33
- Type:feature
- ID:NA
- SUG:NA
- DESC: backport a riscv64 enablement patch from upstream
* Mon Apr 22 2024 Huang Yang <huangyang@loongson.cn> - 36.16.5-32
- Type:bugfix
- ID:NA

View File

@ -0,0 +1,113 @@
From: U2FsdGVkX1 <U2FsdGVkX1@gmail.com>
Signed-off-by: Songsong Zhang <U2FsdGVkX1@gmail.com>
Reviewed-by: Wei Fu <wefu@redhat.com>
Subject: [PATCH] Backport a riscv64 enablement patch from upstream
Signed-off-by: jchzhou <zhoujiacheng@iscas.ac.cn>
---
pyanaconda/modules/storage/bootloader/efi.py | 8 ++++
.../modules/storage/bootloader/factory.py | 8 ++++
pyanaconda/modules/storage/platform.py | 38 +++++++++++++++++++
3 files changed, 54 insertions(+)
diff --git a/pyanaconda/modules/storage/bootloader/efi.py b/pyanaconda/modules/storage/bootloader/efi.py
index 1b47e24..6743717 100644
--- a/pyanaconda/modules/storage/bootloader/efi.py
+++ b/pyanaconda/modules/storage/bootloader/efi.py
@@ -214,6 +214,14 @@ class ArmEFIGRUB(EFIGRUB):
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 --git a/pyanaconda/modules/storage/bootloader/factory.py b/pyanaconda/modules/storage/bootloader/factory.py
index 8aa3afb..4815685 100644
--- a/pyanaconda/modules/storage/bootloader/factory.py
+++ b/pyanaconda/modules/storage/bootloader/factory.py
@@ -146,4 +146,12 @@ class BootLoaderFactory(object):
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 --git a/pyanaconda/modules/storage/platform.py b/pyanaconda/modules/storage/platform.py
index d0aa7ca..20f2c4d 100644
--- a/pyanaconda/modules/storage/platform.py
+++ b/pyanaconda/modules/storage/platform.py
@@ -459,6 +459,40 @@ class ARM(Platform):
}
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
@@ -486,12 +520,16 @@ def get_platform():
return Aarch64EFI()
elif arch.is_arm():
return ArmEFI()
+ elif arch.is_riscv64():
+ return RISCV64EFI()
else:
return EFI()
elif arch.is_x86():
return X86()
elif arch.is_arm():
return ARM()
+ elif arch.is_riscv64():
+ return RISCV64()
else:
raise SystemError("Could not determine system architecture.")
--
2.44.0