From 59e732dc1d16f4df825de5cef27582f71883b48d Mon Sep 17 00:00:00 2001 From: yueyuankun Date: Tue, 18 Mar 2025 12:20:16 +0800 Subject: [PATCH] add support for sw_64 architecture (cherry picked from commit 5b38a07ddd2ed02b29d6401bd2621f40c9113044) --- anaconda-33.19.sw.patch | 124 ------------------- anaconda-36.16.5-add-support-for-sw_64.patch | 99 +++++++++++++++ anaconda.spec | 13 +- 3 files changed, 108 insertions(+), 128 deletions(-) delete mode 100755 anaconda-33.19.sw.patch create mode 100644 anaconda-36.16.5-add-support-for-sw_64.patch diff --git a/anaconda-33.19.sw.patch b/anaconda-33.19.sw.patch deleted file mode 100755 index 9bbb5bd..0000000 --- a/anaconda-33.19.sw.patch +++ /dev/null @@ -1,124 +0,0 @@ -diff -Nuar anaconda-33.19.org/pyanaconda/modules/storage/bootloader/factory.py anaconda-33.19.sw/pyanaconda/modules/storage/bootloader/factory.py ---- anaconda-33.19.org/pyanaconda/modules/storage/bootloader/factory.py 2022-09-07 14:50:46.860000000 +0800 -+++ anaconda-33.19.sw/pyanaconda/modules/storage/bootloader/factory.py 2022-09-07 14:50:57.380000000 +0800 -@@ -106,6 +106,10 @@ - platform_class = platform.platform.__class__ - - # Get the type of the bootloader. -+ if platform_class is platform.Sw_64: -+ from pyanaconda.modules.storage.bootloader.grub2 import GRUB2 -+ return GRUB2 -+ - if platform_class is platform.X86: - from pyanaconda.modules.storage.bootloader.grub2 import GRUB2 - return GRUB2 -diff -Nuar anaconda-33.19.org/pyanaconda/modules/storage/bootloader/grub2.py anaconda-33.19.sw/pyanaconda/modules/storage/bootloader/grub2.py ---- anaconda-33.19.org/pyanaconda/modules/storage/bootloader/grub2.py 2022-09-07 14:50:46.860000000 +0800 -+++ anaconda-33.19.sw/pyanaconda/modules/storage/bootloader/grub2.py 2022-09-07 14:56:42.550000000 +0800 -@@ -101,7 +101,7 @@ - name = "GRUB2" - # grub2 is a virtual provides that's provided by grub2-pc, grub2-ppc64le, - # and all of the primary grub components that aren't grub2-efi-${EFIARCH} -- packages = ["grub2", "grub2-tools"] -+ packages = ["grub2-common", "grub2-tools"] - _config_file = "grub.cfg" - _config_dir = "grub2" - _passwd_file = "user.cfg" -@@ -453,16 +453,47 @@ - return - - try: -- self.write_device_map() -- self.stage2_device.format.sync(root=conf.target.physical_root) -- os.sync() -- self.install() -- os.sync() -- self.stage2_device.format.sync(root=conf.target.physical_root) -+ if os.path.exists("/mnt/sysroot/boot/grub"): -+ FileName="/mnt/sysroot/boot/grub/grub.cfg" -+ f=open(FileName,"w+") -+ f.write("# SW_64 Grub default configurations\n") -+ f.write("set default=0\n") -+ f.write("set timeout=10\n") -+ f.write("\n") -+ f.write("set menu_color_normal=white/black\n") -+ f.write("set menu_color_highlight=light-red/black\n") -+ f.write("\n") -+ f.write("loadfont ${prefix}/fonts/unicode.pf2\n") -+ f.write("insmod efi_gop\n") -+ f.write("set lang=zh_CN\n") -+ f.write("set gfxmode=800x600\n") -+ f.write("set gfxplayload=auto\n") -+ f.write("terminal_output gfxterm\n") -+ f.write("background_color 64,0,64\n") -+ f.write("\n") -+ f.write("menuentry 'openEuler 22.03 LTS SP1' --class gnu-linux --class gnu --class os{\n") -+ f.write("echo \"Loading, please wait for a moment......\"\n") -+ f.write ("set boot=(${root})\n") -+ f.write("echo \"Loading boot\"\n") -+ f.write ("linux.boot ${boot}/initramfs-5.10.0-39.0.0.21.sw_64.img\n") -+ f.write("echo \"Loading vmlinuz\"\n") -+ f.write("linux.vmlinux ${boot}/vmlinuz-5.10.0-39.0.0.21.sw_64 root=/dev/mapper/openeuler-root rootdelay=60 net.ifnames=0 loglevel=0 vga=current rd.systemd.show_status=false rd.udev.log-priority=3 quiet splash video=sm750fb:1280x1024@60 cgroup.memory=nokmem notc\n") -+ f.write("echo \"Booting......\"\n") -+ f.write("boot\n") -+ f.write("}") -+ f.close() -+ else: -+ self.write_device_map() -+ self.stage2_device.format.sync(root=conf.target.physical_root) -+ os.sync() -+ self.install() -+ os.sync() -+ self.stage2_device.format.sync(root=conf.target.physical_root) - finally: -- self.write_config() -- os.sync() -- self.stage2_device.format.sync(root=conf.target.physical_root) -+ pass -+ #self.write_config() -+ #os.sync() -+ #self.stage2_device.format.sync(root=conf.target.physical_root) - - def check(self): - """When installing to the mbr of a disk grub2 needs enough space -diff -Nuar anaconda-33.19.org/pyanaconda/modules/storage/platform.py anaconda-33.19.sw/pyanaconda/modules/storage/platform.py ---- anaconda-33.19.org/pyanaconda/modules/storage/platform.py 2022-09-07 14:50:46.850000000 +0800 -+++ anaconda-33.19.sw/pyanaconda/modules/storage/platform.py 2022-09-07 14:50:57.380000000 +0800 -@@ -116,6 +116,17 @@ - selection fails.""" - return self._boot_stage1_missing_error - -+class Sw_64(Platform): -+ _boot_stage1_device_types = ["disk"] -+ _boot_mbr_description = N_("Master Boot Record") -+ _boot_descriptions = {"disk": _boot_mbr_description, -+ "partition": Platform._boot_partition_description, -+ "mdarray": Platform._boot_raid_description} -+ -+ # XXX hpfs, if reported by blkid/udev, will end up with a type of None -+ _non_linux_format_types = ["vfat", "ntfs", "hpfs"] -+ _boot_stage1_missing_error = N_("You must include at least one MBR- or " -+ "GPT-formatted disk as an install target.") - - class X86(Platform): - _boot_stage1_device_types = ["disk"] -@@ -281,6 +292,8 @@ - raise SystemError("Unsupported PPC machine type: %s" % ppc_machine) - elif arch.is_s390(): - return S390() -+ elif arch.is_sw_64(): -+ return Sw_64() - elif arch.is_efi(): - if arch.is_mactel(): - return MacEFI() -diff -Nuar anaconda-33.19.org/tests/nosetests/pyanaconda_tests/module_bootloader_test.py anaconda-33.19.sw/tests/nosetests/pyanaconda_tests/module_bootloader_test.py ---- anaconda-33.19.org/tests/nosetests/pyanaconda_tests/module_bootloader_test.py 2022-09-07 14:50:46.610000000 +0800 -+++ anaconda-33.19.sw/tests/nosetests/pyanaconda_tests/module_bootloader_test.py 2022-09-07 14:50:57.130000000 +0800 -@@ -393,6 +393,7 @@ - # Test known platforms. - boot_loader_by_platform = { - platform.X86: GRUB2, -+ platform.Sw_64: GRUB2, - platform.EFI: EFIGRUB, - platform.MacEFI: MacEFIGRUB, - platform.PPC: GRUB2, diff --git a/anaconda-36.16.5-add-support-for-sw_64.patch b/anaconda-36.16.5-add-support-for-sw_64.patch new file mode 100644 index 0000000..5941196 --- /dev/null +++ b/anaconda-36.16.5-add-support-for-sw_64.patch @@ -0,0 +1,99 @@ +From 71d07ee8db5f48baad5d1f9cee46bfc194683f43 Mon Sep 17 00:00:00 2001 +From: yueyuankun +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 + diff --git a/anaconda.spec b/anaconda.spec index a9888e3..bb66449 100644 --- a/anaconda.spec +++ b/anaconda.spec @@ -1,7 +1,7 @@ %define _empty_manifest_terminate_build 0 Name: anaconda Version: 36.16.5 -Release: 46 +Release: 47 Summary: Graphical system installer License: GPLv2+ and MIT URL: http://fedoraproject.org/wiki/Anaconda @@ -12,9 +12,6 @@ Source3: hce.conf Source4: disable-disk-encryption.patch Source5: nestos.conf -%ifarch sw_64 -Patch6001: anaconda-33.19.sw.patch -%endif Patch9000: add-passwd-policy.patch Patch9001: bugfix-GUI-nfs-unknown-error.patch @@ -65,6 +62,8 @@ Patch10000: 0001-add-loongarch-support-for-anaconda.patch # https://github.com/rhinstaller/anaconda/pull/4235 Patch10001: 0001-check-that-the-password-contains-the-username.patch +Patch10002: anaconda-36.16.5-add-support-for-sw_64.patch + %if ! 0%{?openEuler} Patch9027: disable-disk-encryption.patch %endif @@ -330,6 +329,12 @@ update-desktop-database &> /dev/null || : %{_prefix}/libexec/anaconda/dd_* %changelog +* Sun Mar 16 2025 yueyuankun - 36.16.5-47 +- Type:update +- ID:NA +- SUG:NA +- DESC: add support for sw_64 architecture + * Thu Jan 16 2025 sunhai - 36.16.5-46 - Type:bugfix - ID:NA -- Gitee