This is a patch to switch ppc from using Yaboot to using Grub2. Because the default terminal size is 80x24 and Open Firmware's default size is a little larger than that so repaints will mess up the display. Therefore, tell grub to configure 'terminfo -g 80x24 ofconsole'. We do this with a new GRUB_TERMINFO variable and enablement script in grub. --- pyanaconda/bootloader.py | 72 +++++++++++++++++++++++++++++++++++++++++++++- pyanaconda/platform.py | 4 +- 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py index 0e759f5..792d1e9 100644 --- a/pyanaconda/bootloader.py +++ b/pyanaconda/bootloader.py @@ -1794,7 +1794,7 @@ class GRUB2(GRUB): def install(self): # XXX will installing to multiple drives work as expected with GRUBv2? for (stage1dev, stage2dev) in self.install_targets: - args = ["--no-floppy", self.grub_device_name(stage1dev)] + args = ["--no-floppy", stage1dev.path] if stage1dev == stage2dev: # This is hopefully a temporary hack. GRUB2 currently refuses # to install to a partition's boot block without --force. @@ -2002,6 +2002,76 @@ class IPSeriesYaboot(Yaboot): log.info("Updated PPC boot list with the command: nvram --update-config %s" % update_value) +class IPSeriesGRUB2(GRUB2): + + # GRUB2 sets /boot bootable and not the PReP partition. This causes the Open Firmware BIOS not + # to present the disk as a bootable target. If stage2_bootable is False, then the PReP partition + # will be marked bootable. Confusing. + stage2_bootable = False + + # + # installation + # + + def install(self): + self.updatePowerPCBootList() + + super(IPSeriesGRUB2, self).install() + + def updatePowerPCBootList(self): + + log.debug("updatePowerPCBootList: self.stage1_device.path = %s" % self.stage1_device.path) + + buf = iutil.execWithCapture("nvram", + ["--print-config=boot-device"], + stderr="/dev/tty5") + + if len(buf) == 0: + log.error ("FAIL: nvram --print-config=boot-device") + return + + boot_list = buf.strip().split() + log.debug("updatePowerPCBootList: boot_list = %s" % boot_list) + + buf = iutil.execWithCapture("ofpathname", + [self.stage1_device.path], + stderr="/dev/tty5") + + if len(buf) > 0: + boot_disk = buf.strip() + log.debug("updatePowerPCBootList: boot_disk = %s" % boot_disk) + else: + log.error("FAIL: ofpathname %s" % self.stage1_device.path) + return + + # Place the disk containing the PReP partition first. + # Remove all other occurances of it. + boot_list = [boot_disk] + filter(lambda x: x != boot_disk, boot_list) + + log.debug("updatePowerPCBootList: updated boot_list = %s" % boot_list) + + update_value = "boot-device=%s" % " ".join(boot_list) + + rc = iutil.execWithRedirect("nvram", ["--update-config", update_value], + stdout="/dev/tty5", stderr="/dev/tty5") + if rc: + log.error("FAIL: nvram --update-config %s" % update_value) + else: + log.info("Updated PPC boot list with the command: nvram --update-config %s" % update_value) + + # + # In addition to the normal grub configuration variable, add one more to set the size of the + # console's window to a standard 80x24 + # + def write_defaults(self): + super(IPSeriesGRUB2, self).write_defaults() + + defaults_file = "%s%s" % (ROOT_PATH, self.defaults_file) + defaults = open(defaults_file, "a+") + defaults.write("GRUB_TERMINFO=\"%s -g %dx%d %s\"\n" % ("terminfo", 80, 24, "console")) + defaults.close() + + class MacYaboot(Yaboot): prog = "mkofboot" can_dual_boot = True diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py index 536a849..cfadbb3 100644 --- a/pyanaconda/platform.py +++ b/pyanaconda/platform.py @@ -231,7 +231,7 @@ class MacEFI(EFI): class PPC(Platform): _ppcMachine = iutil.getPPCMachine() - _bootloaderClass = bootloader.Yaboot + _bootloaderClass = bootloader.GRUB2 _boot_stage1_device_types = ["partition"] @property @@ -239,7 +239,7 @@ class PPC(Platform): return self._ppcMachine class IPSeriesPPC(PPC): - _bootloaderClass = bootloader.IPSeriesYaboot + _bootloaderClass = bootloader.IPSeriesGRUB2 _boot_stage1_format_types = ["prepboot"] _boot_stage1_max_end_mb = 10 _boot_prep_description = N_("PReP Boot Partition") -- 1.7.7.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list