From 567c41cafab520c16285a3adfa8132018984f4d2 Mon Sep 17 00:00:00 2001 From: "t.feng" Date: Mon, 26 Dec 2022 14:34:40 +0800 Subject: [PATCH] rebase from SP1 --- 0001-add-loongarch-support-for-anaconda.patch | 156 ++++++++++++++++++ anaconda-33.19.sw.patch | 124 ++++++++++++++ anaconda.spec | 36 +++- ...ve-connection-without-interface-name.patch | 26 +++ euleros.conf | 6 +- hce.conf | 6 +- openeuler.conf | 8 +- 7 files changed, 351 insertions(+), 11 deletions(-) create mode 100644 0001-add-loongarch-support-for-anaconda.patch create mode 100755 anaconda-33.19.sw.patch create mode 100644 bugfix-adapt-active-connection-without-interface-name.patch diff --git a/0001-add-loongarch-support-for-anaconda.patch b/0001-add-loongarch-support-for-anaconda.patch new file mode 100644 index 0000000..d6130a1 --- /dev/null +++ b/0001-add-loongarch-support-for-anaconda.patch @@ -0,0 +1,156 @@ +From b4cffadd1304fc2da30a727b030415168fcf7708 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Mon, 12 Dec 2022 01:37:57 +0000 +Subject: [PATCH] add loongarch support for anaconda + +--- + pyanaconda/modules/storage/bootloader/base.py | 9 +++-- + pyanaconda/modules/storage/bootloader/efi.py | 33 ++++++++++++++++++- + .../modules/storage/bootloader/factory.py | 4 +++ + .../modules/storage/devicetree/fsset.py | 6 +++- + pyanaconda/modules/storage/platform.py | 10 ++++++ + 5 files changed, 57 insertions(+), 5 deletions(-) + +diff --git a/pyanaconda/modules/storage/bootloader/base.py b/pyanaconda/modules/storage/bootloader/base.py +index 533d528..02ca7ca 100644 +--- a/pyanaconda/modules/storage/bootloader/base.py ++++ b/pyanaconda/modules/storage/bootloader/base.py +@@ -796,11 +796,14 @@ class BootLoader(object): + swap_devices = storage.fsset.swap_devices + dracut_devices.extend(swap_devices) + +- # Add resume= option to enable hibernation on x86. ++ # Add resume= option to enable hibernation on x86 and loongarch. + # Choose the largest swap device for that. +- if blivet.arch.is_x86() and swap_devices: ++ if (blivet.arch.is_x86() or blivet.arch.is_loongarch())and swap_devices: + resume_device = max(swap_devices, key=lambda x: x.size) +- self.boot_args.add("resume=%s" % resume_device.fstab_spec) ++ if not blivet.arch.is_efi() and blivet.arch.is_loongarch(): ++ self.boot_args.add("resume=%s" % resume_device.path) ++ else: ++ self.boot_args.add("resume=%s" % resume_device.fstab_spec) + + # Does /usr have its own device? If so, we need to tell dracut + usr_device = storage.mountpoints.get("/usr") +diff --git a/pyanaconda/modules/storage/bootloader/efi.py b/pyanaconda/modules/storage/bootloader/efi.py +index 1b47e24..99efde6 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"] ++__all__ = ["EFIBase", "EFIGRUB", "Aarch64EFIGRUB", "ArmEFIGRUB", "MacEFIGRUB", "LOONGARCHEFIGRUB"] + + + class EFIBase(object): +@@ -203,6 +203,37 @@ class Aarch64EFIGRUB(EFIGRUB): + super().__init__() + self._packages64 = ["grub2-efi-aa64", "shim-aa64"] + ++class LOONGARCHEFIGRUB(EFIGRUB): ++ _efi_binary = "grubloongarch64.efi" ++ stage2_is_valid_stage1 = False ++ stage2_bootable = False ++ ++ def __init__(self): ++ super().__init__() ++ self._packages64 = ["grub2-efi-loongarch64"] ++ ++ 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) ++ ++ rc = util.execInSysroot("cp", ["-a", "/boot/efi/EFI/openEuler/" + self._efi_binary, "/boot/efi/EFI/BOOT/" + "BOOTLOONGARCH64.EFI"]) ++ if rc: ++ raise BootLoaderError("Failed to set new efi boot target. This is most " ++ "likely a kernel or firmware bug.") ++ rc = util.execInSysroot("cp", ["-a", "/boot/efi/EFI/openEuler/" + self._efi_binary, "/boot/efi/EFI/BOOT/" + "BOOTLOONGARCH.EFI"]) ++ if rc: ++ raise BootLoaderError("Failed to set new efi boot target for new BIOS. This is most " ++ "likely a kernel or firmware bug.") ++ ++ 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"] +diff --git a/pyanaconda/modules/storage/bootloader/factory.py b/pyanaconda/modules/storage/bootloader/factory.py +index 8aa3afb..2fb9993 100644 +--- a/pyanaconda/modules/storage/bootloader/factory.py ++++ b/pyanaconda/modules/storage/bootloader/factory.py +@@ -114,6 +114,10 @@ class BootLoaderFactory(object): + from pyanaconda.modules.storage.bootloader.efi import EFIGRUB + return EFIGRUB + ++ if platform_class is platform.LOONGARCHEFI: ++ from pyanaconda.modules.storage.bootloader.efi import LOONGARCHEFIGRUB ++ return LOONGARCHEFIGRUB ++ + if platform_class is platform.MacEFI: + from pyanaconda.modules.storage.bootloader.efi import MacEFIGRUB + return MacEFIGRUB +diff --git a/pyanaconda/modules/storage/devicetree/fsset.py b/pyanaconda/modules/storage/devicetree/fsset.py +index 0d151d3..26667dd 100644 +--- a/pyanaconda/modules/storage/devicetree/fsset.py ++++ b/pyanaconda/modules/storage/devicetree/fsset.py +@@ -23,6 +23,7 @@ import gi + gi.require_version("BlockDev", "2.0") + from gi.repository import BlockDev as blockdev + ++from blivet import arch + from blivet.devices import NoDevice, DirectoryDevice, NFSDevice, FileDevice, MDRaidArrayDevice, \ + NetworkStorageDevice, OpticalDevice + from blivet.errors import UnrecognizedFSTabEntryError, FSTabTypeMismatchError +@@ -776,7 +777,10 @@ class FSSet(object): + break + if device.encrypted: + options += ",x-systemd.device-timeout=0" +- devspec = device.fstab_spec ++ if not arch.is_efi() and arch.is_loongarch(): ++ devspec = device.path ++ else: ++ devspec = device.fstab_spec + dump = device.format.dump + if device.format.check and mountpoint == "/": + passno = 1 +diff --git a/pyanaconda/modules/storage/platform.py b/pyanaconda/modules/storage/platform.py +index d0aa7ca..3a238f9 100644 +--- a/pyanaconda/modules/storage/platform.py ++++ b/pyanaconda/modules/storage/platform.py +@@ -287,6 +287,14 @@ class Aarch64EFI(EFI): + return ["vfat", "ntfs"] + + ++class LOONGARCHEFI(EFI): ++ ++ @property ++ def non_linux_format_types(self): ++ """Format types of devices with non-linux operating systems.""" ++ return ["vfat", "ntfs"] ++ ++ + class ArmEFI(EFI): + + @property +@@ -486,6 +494,8 @@ def get_platform(): + return Aarch64EFI() + elif arch.is_arm(): + return ArmEFI() ++ elif arch.is_loongarch(): ++ return LOONGARCHEFI() + else: + return EFI() + elif arch.is_x86(): +-- +2.33.0 + diff --git a/anaconda-33.19.sw.patch b/anaconda-33.19.sw.patch new file mode 100755 index 0000000..9bbb5bd --- /dev/null +++ b/anaconda-33.19.sw.patch @@ -0,0 +1,124 @@ +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.spec b/anaconda.spec index 833e094..2270673 100644 --- a/anaconda.spec +++ b/anaconda.spec @@ -1,7 +1,7 @@ %define _empty_manifest_terminate_build 0 Name: anaconda Version: 36.16.5 -Release: 8 +Release: 12 Summary: Graphical system installer License: GPLv2+ and MIT URL: http://fedoraproject.org/wiki/Anaconda @@ -32,6 +32,14 @@ Patch9015: bugfix-change-gnome-kiosk-to-use-metacity.patch Patch9016: bugfix-add-log-and-background.patch Patch9017: bugfix-add-SM3-with-tui.patch Patch9018: bugfix-change-product-name-do-not-with-upper.patch +Patch9019: bugfix-adapt-active-connection-without-interface-name.patch + +%ifarch sw_64 +Patch6001: anaconda-33.19.sw.patch +%endif +%ifarch loongarch64 +Patch6002: 0001-add-loongarch-support-for-anaconda.patch +%endif %define dasbusver 1.3 %define dbusver 1.2.3 @@ -270,6 +278,32 @@ update-desktop-database &> /dev/null || : %{_prefix}/libexec/anaconda/dd_* %changelog +* Mon Dec 26 2022 fengtao - 36.16.5-12 +- Type:feature +- ID:NA +- SUG:NA +- DESC: add loongarch and sw support patch in SP1 + +* Tue Dec 20 2022 Qingqing Li - 36.16.5-11 +- Type:feature +- ID:NA +- SUG:NA +- DESC:cgroup files is a additional enhanced cgroup feature, which will + limit cgroup opened files, add cgroup_disable=files to + default cmdline to disable this feature to keep cgroup's default behavior. + +* Thu Dec 15 2022 sunhai - 36.16.5-10 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix conf of storage + +* Wed Dec 14 2022 sunhai - 36.16.5-9 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:adapt active connection without interface name + * Sat Dec 10 2022 sunhai - 36.16.5-8 - Type:bugfix - ID:NA diff --git a/bugfix-adapt-active-connection-without-interface-name.patch b/bugfix-adapt-active-connection-without-interface-name.patch new file mode 100644 index 0000000..393a8ea --- /dev/null +++ b/bugfix-adapt-active-connection-without-interface-name.patch @@ -0,0 +1,26 @@ +From ade550fb89b10cf218ce96541e1c540a2a8a7ea1 Mon Sep 17 00:00:00 2001 +From: sun_hai_10 +Date: Wed, 14 Dec 2022 11:04:41 +0800 +Subject: [PATCH] adapt active connection without interface-name + +--- + pyanaconda/modules/network/initialization.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/pyanaconda/modules/network/initialization.py b/pyanaconda/modules/network/initialization.py +index c7f0ba4..85a1da7 100644 +--- a/pyanaconda/modules/network/initialization.py ++++ b/pyanaconda/modules/network/initialization.py +@@ -135,6 +135,9 @@ class ApplyKickstartTask(Task): + def _find_initramfs_connection_of_iface(self, iface): + device = self._nm_client.get_device_by_iface(iface) + if device: ++ active_connection = device.get_active_connection() ++ if active_connection: ++ return active_connection.get_connection() + cons = device.get_available_connections() + for con in cons: + if con.get_interface_name() == iface and con.get_id() == iface: +-- +2.23.0 + diff --git a/euleros.conf b/euleros.conf index 795115f..fb008b5 100644 --- a/euleros.conf +++ b/euleros.conf @@ -24,9 +24,9 @@ enable_closest_mirror = True [Storage] default_partitioning = -/ (min 1 GiB, max 70 GiB) -/home (min 500 MiB, free 50 GiB) -swap + / (min 1 GiB, max 70 GiB) + /home (min 500 MiB, free 50 GiB) + swap [Storage Constraints] swap_is_recommended = False diff --git a/hce.conf b/hce.conf index e36b45c..98ea38f 100644 --- a/hce.conf +++ b/hce.conf @@ -24,9 +24,9 @@ enable_closest_mirror = True [Storage] default_partitioning = -/ (min 1 GiB, max 70 GiB) -/home (min 500 MiB, free 50 GiB) -swap + / (min 1 GiB, max 70 GiB) + /home (min 500 MiB, free 50 GiB) + swap [Storage Constraints] swap_is_recommended = False diff --git a/openeuler.conf b/openeuler.conf index 1c31daf..294518a 100644 --- a/openeuler.conf +++ b/openeuler.conf @@ -16,16 +16,16 @@ default_on_boot = FIRST_WIRED_WITH_LINK [Bootloader] efi_dir = openEuler -additional_arguments = +additional_arguments = cgroup_disable=files [Payload] enable_closest_mirror = True [Storage] default_partitioning = -/ (min 1 GiB, max 70 GiB) -/home (min 500 MiB, free 50 GiB) -swap + / (min 1 GiB, max 70 GiB) + /home (min 500 MiB, free 50 GiB) + swap [Storage Constraints] swap_is_recommended = False