Mac OpenFirmware Question

longofest

Editor emeritus
Original poster
Jul 10, 2003
2,791
1,303
Falls Church, VA
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

Moderator emeritus
Jul 24, 2002
24,596
60
Harrogate
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

Editor emeritus
Original poster
Jul 10, 2003
2,791
1,303
Falls Church, VA
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

Moderator emeritus
Jul 24, 2002
24,596
60
Harrogate
longofest said:
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

macrumors G3
Aug 30, 2003
8,643
0
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

Editor emeritus
Original poster
Jul 10, 2003
2,791
1,303
Falls Church, VA
iMeowbot said:
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

macrumors G3
Aug 30, 2003
8,643
0
longofest said:
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.)