Enabling server mode

Bill Fink yellowdog-general@lists.terrasoftsolutions.com
Fri, 6 Aug 2004 12:07:53 -0400


Hi,

On Fri, 06 Aug 2004, sadfsdf wrote:

> I've got an old performa 6400, and when it has mac os on it I enabled 
> "server mode" where if it lost power it would power back up again. How 
> do I set this mode again from linux, as I no longer have mac OS installed?

Here's an old message where I explained how to do this on an OldWorld
PowerMac.  One new point is to make sure you are using an ext3 filesystem
which should be more robust in the event of an unexpected power outage.

						-Bill



Date: Wed, 31 May 2000 05:58:48 -0400
From: Bill Fink <billfink@capu.net>
To: linuxppc-user@lists.linuxppc.org
Subject: Re: Autostart after powerfailure

> I want my two Linux-boxes running on G4's to start automaticly after a
> powerfailure.
> 
> Do I have to do anything in UNIX or is it enough to tell them in Mac OS-mode
> that "Autostart after a powerfailure" - I think you do that in the
> powersaving-control.
> 
> Thanks!
> 
> /Micke Moggia

Here's what I do on my home router:

	1.  I created the 3-byte file /etc/powerup-boot containing exactly
	    the following hex sequence (no terminating null or newline):

		0x011301

	    The first 0x01 indicates this is a CUDA_PACKET (see <asm/adb.h>)
	    since the CUDA chip is responsible for power management among
	    other things.  The 0x13 indicates the specific CUDA parameter
	    being accessed or modified, and isn't even documented in
	    <asm/cuda.h>, but by digging around in MOL, I figured out that
	    it was the CUDA_FILE_SERVER_FLAG parameter.  The second 0x01
	    indicates that this system is a file server (really any machine
	    that has to stay up all the time), and so if there is a power
	    failure, when the power is restored, the CUDA chip allows the
	    power to be passed through to the main processor initiating
	    the boot sequence.

	    I also created the 3-byte file /etc/powerup-off containing the
	    hex sequence:

		0x011300

	    This file can be used to restore the system to the default powerup
	    behavior following a power failure, namely to not automatically
	    boot up, requiring the user to turn on the power to the main
	    processor to initiate the boot process (this is the way I leave
	    my primary home system set up since I'd rather not have it possibly
	    damaged by multiple power fluctuations that might occur during a
	    severe lightning storm for example - better to just leave it off).

	2.  At the end of my /etc/rc.d/rc.local file, I added the following
	    line:

		cat /etc/powerup-boot >> /dev/adb

	    The ADB device is used to access and control the CUDA chip.
	    This command may actually only have to be done once rather than
	    during every boot, but I haven't tested that, and it seemed safer
	    to just redo it every boot.  I believe the power management
	    settings are kept in the PRAM so they should in theory be saved
	    across reboots.

	3.  I set the Open Firmware variable boot-command to:

		begin ['] boot catch 1000 ms cr again

	    This allows the disk time to spin up, and retries the boot command
	    after a second (I got this tidbit from one of the installation
	    manuals).

I figured out a lot of this by looking at Takashi Oe's pmacpow-tool
source, which allows you to set the powerup time on a PowerMac (I was
too lazy to modify his source to add an option to set/clear the
CUDA_FILE_SERVER_FLAG parameter, but it should be relatively easy
to do).

To test this you have to be relatively brave and simulate a power
failure by for example pulling the power cord (after doing a few sync
commands of course to flush the disk cache in memory out to the actual
disk).  After doing a graceful shutdown, the user still has to explicitly
reapply power to the main processor by pressing the power key.  I am using
this on my home router (a 7500) and have also tested it on my primary
home system (a 6500) and it works fine on both these systems.

Some of this may be processor or model dependent, so YMMV.  And of
course I assume absolutely no responsibility whatsoever for any negative
impact on your system, so use this advice with appropriate caution (for
example make sure to have a recent, validated system backup if concerned
about data integrity before performing the power failure test).

						-HTH

						-Bill Fink

P.S.  The Power Saving Control Panel should also work fine I think since
      it should effectively be doing the same thing by setting the
      CUDA_FILE_SERVER_FLAG parameter in the PRAM.