OpenFirmware Question

Discussion in 'Mac Programming' started by longofest, Sep 26, 2006.

  1. Editor emeritus

    longofest

    Joined:
    Jul 10, 2003
    Location:
    Falls Church, VA
    #1
    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?
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    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...
     
  3. thread starter Editor emeritus

    longofest

    Joined:
    Jul 10, 2003
    Location:
    Falls Church, VA
    #3
    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?
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I did a search but could not find anything, that's why I suggested booting OSX and doing it there!
     
  5. macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #5
    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.
     
  6. thread starter Editor emeritus

    longofest

    Joined:
    Jul 10, 2003
    Location:
    Falls Church, VA
    #6
    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!).
     
  7. macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #7
    Yup.

    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.)
     

Share This Page