125 lines
6.2 KiB
Diff
125 lines
6.2 KiB
Diff
|
|
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,
|