Re: [PATCH] Migrate PPC from Yaboot to Grub2 for Anaconda

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2012-03-12 at 15:49 -0500, Mark Hamzy wrote:
> ---
>  pyanaconda/bootloader.py |   69 +++++++++++++++++++++++++++++++++++++++++++++-
>  pyanaconda/platform.py   |    4 +-
>  2 files changed, 70 insertions(+), 3 deletions(-)

Ack.

> 
> diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
> index 0e759f5..c339e58 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,73 @@ 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.updateNVRAMBootList()
> +
> +        super(IPSeriesGRUB2, self).install()
> +
> +    # This will update the PowerPC's (ppc) bios boot devive order list
> +    def updateNVRAMBootList(self):
> +
> +        log.debug("updateNVRAMBootList: 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 ("Failed to determine nvram boot device")
> +            return
> +
> +        boot_list = buf.strip().split()
> +        log.debug("updateNVRAMBootList: boot_list = %s" % boot_list)
> +
> +        buf = iutil.execWithCapture("ofpathname",
> +                                    [self.stage1_device.path],
> +                                    stderr="/dev/tty5")
> +
> +        if len(buf) > 0:
> +            boot_disk = buf.strip()
> +        else:
> +            log.error("Failed to translate boot path into device name")
> +            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)
> +
> +        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("Failed to update new boot device order")
> +
> +    #
> +    # 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+")
> +        # The terminfo's X and Y size, and output location could change in the future
> +        defaults.write("GRUB_TERMINFO=\"terminfo -g 80x24 console\"\n")
> +        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")


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux