[PATCH] Update ppc SMS bios after installation

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

 



Here is a proposed patch that updates a PowerPC's BIOS to boot from the newly installed hard disk rather than back to the installer.

The BIOS maintains a list of bootable targets which can be queried with the nvram utility.  This list can be modified so that the installation harddrive will show up first.  This code will read the list, figure out what drive contains the PReP partition, prepends that drive to the list, and then updates BIOS.

For example the list could be the DVD, hard drive, and ethernet.

[anaconda root@(none) /]# nvram --print-config=boot-device
/vdevice/v-scsi@30000005/disk@8100000000000000 /vdevice/v-scsi@30000002/disk@8100000000000000 /vdevice/l-lan@30000003:speed=auto,duplex=auto,000.000.000.000,,000.000.000.000,000.000.000.000,5,5,000.000.000.000,512

After running this function, the list will be as follows:

[anaconda root@(none) /]# nvram --print-config=boot-device
/vdevice/v-scsi@30000002/disk@8100000000000000 /vdevice/v-scsi@30000005/disk@8100000000000000 /vdevice/l-lan@30000003:speed=auto,duplex=auto,000.000.000.000,,000.000.000.000,000.000.000.000,5,5,000.000.000.000,512

---
 pyanaconda/bootloader.py |   58 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 1150335..84466cd 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1877,6 +1877,64 @@ class IPSeriesYaboot(Yaboot):
         config.write("nonvram\n")   # only on pSeries?
         config.write("fstype=raw\n")
 
+    #
+    # installation
+    #
+
+    def install(self, install_root=""):
+        self.updatePowerPCBootList()
+
+        super(IPSeriesYaboot, self).install(install_root=install_root)
+
+    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/hvc1",
+                                    root="/")
+
+        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/hvc1",
+                                    root="/")
+
+        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/hvc1", stderr="/dev/hvc1",
+                                    root="/")
+        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)
+
 
 class MacYaboot(Yaboot):
     prog = "mkofboot"
-- 
1.7.7

_______________________________________________
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