代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/anaconda 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From b2f3dad1bb1a4170262c874a5d35b35728e3bf7e Mon Sep 17 00:00:00 2001
From: yangxiaoxuan <yangxiaoxuan@openanolis.org>
Date: Wed, 15 Sep 2021 10:33:09 +0800
Subject: [PATCH] anaconda anolis add loongarch pmon support
---
data/product.d/centos.conf | 3 +
pyanaconda/modules/storage/bootloader/base.py | 5 +-
.../modules/storage/bootloader/factory.py | 4 +
pyanaconda/modules/storage/bootloader/pmon.py | 87 +++++++++++++++++++
.../modules/storage/devicetree/fsset.py | 6 +-
pyanaconda/modules/storage/platform.py | 5 +-
6 files changed, 107 insertions(+), 3 deletions(-)
create mode 100644 pyanaconda/modules/storage/bootloader/pmon.py
diff --git a/pyanaconda/modules/storage/bootloader/base.py b/pyanaconda/modules/storage/bootloader/base.py
index 819abaa..98d197d 100644
--- a/pyanaconda/modules/storage/bootloader/base.py
+++ b/pyanaconda/modules/storage/bootloader/base.py
@@ -735,7 +735,10 @@ class BootLoader(object):
# Choose the largest swap device for that.
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/factory.py b/pyanaconda/modules/storage/bootloader/factory.py
index b0dcea3..215ebd4 100644
--- a/pyanaconda/modules/storage/bootloader/factory.py
+++ b/pyanaconda/modules/storage/bootloader/factory.py
@@ -142,6 +142,10 @@ class BootLoaderFactory(object):
from pyanaconda.modules.storage.bootloader.efi import LOONGARCHEFIGRUB
return LOONGARCHEFIGRUB
+ if platform_class is platform.LOONGARCHLEGACY:
+ from pyanaconda.modules.storage.bootloader.pmon import LOONGARCHPMON
+ return LOONGARCHPMON
+
if platform_class is platform.ARM:
from pyanaconda.modules.storage.bootloader.extlinux import EXTLINUX
return EXTLINUX
diff --git a/pyanaconda/modules/storage/bootloader/pmon.py b/pyanaconda/modules/storage/bootloader/pmon.py
new file mode 100644
index 0000000..7e02f61
--- /dev/null
+++ b/pyanaconda/modules/storage/bootloader/pmon.py
@@ -0,0 +1,87 @@
+#
+# Writer: Sun Haiyong (youbest@sina.com)
+#
+import os
+
+from pyanaconda.modules.storage.bootloader.base import BootLoader, Arguments, BootLoaderError
+from pyanaconda.core import util
+from pyanaconda.core.configuration.anaconda import conf
+from pyanaconda.product import productName
+
+from pyanaconda.anaconda_loggers import get_module_logger
+log = get_module_logger(__name__)
+
+__all__ = ["PMON", "LOONGARCHPMON"]
+
+
+class PMON(BootLoader):
+ name = "PMON"
+ _config_file = "boot.cfg"
+ _config_dir = "/boot"
+
+ stage2_format_types = ["ext3", "ext2"]
+ stage2_device_types = ["partition"]
+# stage2_bootable = True
+
+ @property
+ def config_file(self):
+ return "%s/%s" % (self._config_dir, self._config_file)
+
+ @property
+ def boot_prefix(self):
+ """ Prefix, if any, to paths in /boot. """
+ if self.stage2_device.format.mountpoint == "/":
+ prefix = "/boot"
+ else:
+ prefix = ""
+
+ return prefix
+
+ def write_config_console(self, config):
+ if not self.console:
+ return
+
+ console_arg = "console=%s" % self.console
+ if self.console_options:
+ console_arg += ",%s" % self.console_options
+ self.boot_args.add(console_arg)
+
+ def write_config_images(self, config):
+ self.write_config_console(config)
+ for image in self.images:
+ args = Arguments()
+ args.update(["root=%s" % image.device.path, "ro"])
+ args.update(self.boot_args)
+ log.info("bootloader.py: used boot args: %s ", args)
+
+ # extlinux labels cannot have spaces
+ label = "%s(%s)" % (self.image_label(image), image.version)
+ label = label.replace(" ", "")
+ stanza = ("title %(label)s\n"
+ "\tkernel /dev/fs/ext2@wd0%(boot_prefix)s/%(kernel)s\n"
+ "\tinitrd /dev/fs/ext2@wd0%(boot_prefix)s/%(initrd)s\n"
+ "\targs %(args)s\n\n"
+ % {"label": label,
+ "kernel": image.kernel,
+ "initrd": image.initrd,
+ "args": args,
+ "boot_prefix": self.boot_prefix})
+ config.write(stanza)
+
+ def write_config_header(self, config):
+ header = ("timeout %(timeout)d\n"
+ "showmenu 1\n"
+ % {"timeout": self.timeout})
+ config.write(header)
+ if self.default is not None:
+ config.write("default 0\n\n")
+
+ def install(self, args=None):
+ """installation should be a no-op, just writing the config is sufficient for the
+ firmware's bootloader (petitboot)
+ """
+ pass
+
+
+class LOONGARCHPMON(PMON):
+ """ LOONGARCHPMON """
diff --git a/pyanaconda/modules/storage/devicetree/fsset.py b/pyanaconda/modules/storage/devicetree/fsset.py
index 00aef10..ab7cd6f 100644
--- a/pyanaconda/modules/storage/devicetree/fsset.py
+++ b/pyanaconda/modules/storage/devicetree/fsset.py
@@ -24,6 +24,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
@@ -764,7 +765,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 4678e73..9b730c1 100644
--- a/pyanaconda/modules/storage/platform.py
+++ b/pyanaconda/modules/storage/platform.py
@@ -187,6 +187,9 @@ class LOONGARCHEFI(EFI):
class ArmEFI(EFI):
_non_linux_format_types = ["vfat", "ntfs"]
+class LOONGARCHLEGACY(Platform):
+ _boot_stage1_device_types = ["partition"]
+ _boot_descriptions = {"partition": Platform._boot_partition_description}
class PPC(Platform):
_ppc_machine = arch.get_ppc_machine()
@@ -299,7 +302,7 @@ def get_platform():
elif arch.is_arm():
return ARM()
elif arch.is_loongarch():
- return LOONGARCHEFI()
+ return LOONGARCHLEGACY()
else:
raise SystemError("Could not determine system architecture.")
--
2.18.4
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。