1 Star 0 Fork 107

zhiqifeiyang/anaconda_1

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
anaconda-33.19.sw.patch 6.22 KB
一键复制 编辑 原始数据 按行查看 历史
t.feng 提交于 2022-12-26 14:31 . rebase from SP1
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,
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhiqifeiyang/anaconda_1.git
git@gitee.com:zhiqifeiyang/anaconda_1.git
zhiqifeiyang
anaconda_1
anaconda_1
master

搜索帮助