PDA

View Full Version : OpenFirmware Question




longofest
Sep 26, 2006, 07:17 AM
Okay, this is a pretty in-depth question. So, my old quicksilver G4 (dual 1 GHz) is currently acting as my server and is running Yellow Dog Linux as its OS. Pretty good setup, however as a server, I want it to re-boot after a power failure (my UPS has been a little flakey, and has on occasion been known to give overload signals even though it is definitely not overloaded, and cut power).

OSX has a setting in Energy Prefs (OS 9 had this too) where you could "reboot after power failure". This is obviously a firmware setting, and I basically want to duplicate this setting in OpenFirmware. Somehow I have a gut feeling that I'm going to have to write a firmware script or do some hex programming, but does anyone know some hidden OF variable that I'm missing?



robbieduncan
Sep 26, 2006, 07:38 AM
You need to set this in the nvram. OSX has the nvram command line tool that can do this. Perhaps boot OSX (for an external disk say), set it then boot back to Linux. As it's in nvram the setting should persist...

longofest
Sep 26, 2006, 08:34 AM
well, I know you can set nvram params in Openfirmware as well. I figured whatever I did would be set in nvram. Do you have any idea what parameter I'd be setting?

robbieduncan
Sep 26, 2006, 08:43 AM
well, I know you can set nvram params in Openfirmware as well. I figured whatever I did would be set in nvram. Do you have any idea what parameter I'd be setting?

I did a search but could not find anything, that's why I suggested booting OSX and doing it there!

iMeowbot
Sep 26, 2006, 08:54 AM
On OS X you would do this with the pmset command rather than nvram.

Under Lunix, you should be able to do it using
echo "server_mode=1" > /proc/pmu/options
...but this isn't sticky, it needs to be added on each reboot.

longofest
Sep 26, 2006, 02:28 PM
On OS X you would do this with the pmset command rather than nvram.

Under Lunix, you should be able to do it using
echo "server_mode=1" > /proc/pmu/options
...but this isn't sticky, it needs to be added on each reboot.

Interesting... so that is a PMU setting? How does one get it "sticky" without having to run some kind of chron job perl script? I'm noticing that it looks like the power just took a hit AGAIN today (two days in a row!).

iMeowbot
Sep 26, 2006, 11:07 PM
Interesting... so that is a PMU setting?
Yup.

How does one get it "sticky" without having to run some kind of chron job perl script?

You can add it somewhere like the /etc/rc.d/rc.local script, so that the autoreboot is always set up at boot time.

You can always cat the options "file" to make sure the setting went in properly.

This does leave a small window where autoreboot may fail: the situation where the power drops, Linux starts to boot, and then the power fails again before the boot scripts complete may leave the PMU at its defaults. I suspect that OS X may suffer from the same limitation, given the results of some unfortunate past incidents with power cords.

(OS X is really doing something similar to the rc.local thing with its pmset and preference pane, it puts the values into a plist that it checks at boot time.)