Re: Rebooting and APM halt

Tsurng-Chen Chern (maxchern@kazakhstan.it.earthlink.net)
Mon, 7 Apr 1997 23:28:34 -0700 (PDT)


Oh, Well,

Before a real fix is available, here is a quick fix -

...../linux/arch/i386/kernel/process.c

line 377 of 627

void machine_halt(void)
{
+#if defined(CONFIG_APM) && defined(CONFIG_APM_POWER_OFF)
+ apm_set_power_state(APM_STATE_OFF);
+#endif
}

void machine_power_off(void)
{
#if defined(CONFIG_APM) && defined(CONFIG_APM_POWER_OFF)
apm_set_power_state(APM_STATE_OFF);
#endif
}

Sorry about not providing a real patch, I haven't figure out
how to do that yet.

> > I've noticed since the new reboot changes were put into 2.1.30 that my laptop
> > compiled with CONFIG_APM_POWER_OFF no longer turns off when I do a halt.
> > What program will give the correct sequence of stuff in linux/kernel/sys.c
> > to actually halt and power off the system?
>
> The change was first made in the SPARC tree since the notions of
> "halt" and "power off" are very different. On a SPARC, "halt" returns
> the system to monitor mode while "power off" shuts off the
> system. Many other systems make the same distinction.
>
> As a temporary fix, change the call to the reboot() system call in
> your halt program to the following and recompile:
>
> #include <linux/reboot.h>
>
> ...
>
> reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
> LINUX_REBOOT_CMD_POWER_OFF);
>
>
> And name this new binary "poweroff" or something close.
>
> What should really happen is that the SysVInit maintainer whoever he
> is should add a "power down" runlevel just like most other Unix
> systems like Solaris have.
>
> Tom
>

Max Chern, Unix Software Engineer | Voice: 818-296-5014
EarthLink Network, Inc. | Fax: 818-296-5113
maxchern@earthlink.net | 3100 New York Dr., Ste 201
http://www.earthlink.net/ | Pasadena, CA 91107