diff mbox

[1/1] ybin: Update boot-device for pSeries

Message ID 201209141822.q8EIMFhJ032277@d03av02.boulder.ibm.com
State New
Headers show

Commit Message

Brian King Sept. 14, 2012, 6:22 p.m. UTC
ybin/mkofboot was not updating the boot-device OF path, which results in
pSeries users needing to manually set the boot device in SMS in many
scenarios. This is easily fixed with the following small change.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 ybin/ybin |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
diff mbox

Patch

diff -puN ybin/ybin~ybin_set_ofbootdev ybin/ybin
--- yaboot/ybin/ybin~ybin_set_ofbootdev	2012-09-14 09:13:47.000000000 -0500
+++ yaboot-bjking1/ybin/ybin	2012-09-14 09:34:11.000000000 -0500
@@ -507,12 +507,8 @@  checkconf()
 	[ "$nonvram" = 0 ] && echo 1>&2 "$PRG: OldWorld PowerMac, nvram will not be updated"
 	nonvram=1
     elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'pSeries') ; then
-	## IBM hardware does not need nvram update AFAICT
-	nonvram=1
 	ADDNOTE=yes
     elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'PowerNV') ; then
-	## IBM hardware does not need nvram update AFAICT
-	nonvram=1
 	ADDNOTE=yes
     else
 	#echo 1>&2 "$PRG: Warning: Unknown archetecture, $boot may not be bootable on this machine"
@@ -1156,6 +1152,17 @@  raw_install()
 	echo 1>&2 "$PRG: Installation failed."
 	return 1
     fi
+
+    ## update the boot-device variable in OF nvram.
+    if [ "$nonvram" = 0 ] ; then
+       [ "$VERBOSE" = 1 ] && echo "$PRG: Updating OpenFirmware boot-device variable in nvram..."
+       [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: boot-device=${ofboot}"
+       nvsetenv boot-device "${ofboot}"
+       if [ $? != 0 ] ; then
+          echo 1>&2 "$PRG: An error occured while updating nvram, we'll ignore it"
+       fi
+    fi
+
     sync ; sync
     [ "$VERBOSE" = 1 ] && echo "$PRG: Installation successful"
     return 0