+ In 2.1.40, the APM power down on system halt does not work as one would
+ expect, it has to be done manually. With both CONFIG_APM and
+ CONFIG_APM_POWER_OFF enabled, 2.0.30 switches power off on system halt
+ automatically.
I made a patch for sysvinit-2.71 to enable APM poweroff.
---
diff -urN sysvinit-2.71.orig/debian/etc/init.d/halt sysvinit-2.71/debian/etc/init.d/halt
--- sysvinit-2.71.orig/debian/etc/init.d/halt Wed May 28 01:48:10 1997
+++ sysvinit-2.71/debian/etc/init.d/halt Wed May 28 01:48:23 1997
@@ -39,4 +39,4 @@
/etc/init.d/ups-monitor poweroff
fi
-halt -d -f
+halt -d -f -p
diff -urN sysvinit-2.71.orig/slackware/etc/rc.d/rc.6 sysvinit-2.71/slackware/etc/rc.d/rc.6
--- sysvinit-2.71.orig/slackware/etc/rc.d/rc.6 Tue Aug 13 19:24:52 1996
+++ sysvinit-2.71/slackware/etc/rc.d/rc.6 Wed May 28 01:48:57 1997
@@ -93,5 +93,5 @@
echo "$message"
sleep 1
[ ! -f /etc/fastboot ] && echo "On the next boot fsck will be FORCED."
- $command -f
+ $command -f -p
diff -urN sysvinit-2.71.orig/src/halt.c sysvinit-2.71/src/halt.c
--- sysvinit-2.71.orig/src/halt.c Thu Apr 17 03:31:10 1997
+++ sysvinit-2.71/src/halt.c Wed May 28 02:24:35 1997
@@ -8,11 +8,12 @@
* execute an "shutdown -r". This is for compatibility with
* sysvinit 2.4.
*
- * Usage: halt [-n] [-w] [-d] [-f]
+ * Usage: halt [-n] [-w] [-d] [-f] [-p]
* -n: don't sync before halting the system
* -w: only write a wtmp reboot record and exit.
* -d: don't write a wtmp record.
* -f: force halt/reboot, don't call shutdown.
+ * -p: tune power off. (linux-2.1.x only)
*
* Reboot and halt are both this program. Reboot
* is just a link to halt.
@@ -60,7 +61,11 @@
*/
void usage()
{
+#if LINUX_VERSION_CODE > 0x20100
+ fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-i] [-p]\n", progname);
+#else
fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-i]\n", progname);
+#endif
exit(1);
}
@@ -142,6 +147,9 @@
char **argv;
{
int do_reboot = 0;
+#if LINUX_VERSION_CODE > 0x20100
+ int do_poweroff = 0;
+#endif
int do_sync = 1;
int do_wtmp = 1;
int do_nothing = 0;
@@ -166,7 +174,7 @@
if (!strcmp(progname, "reboot")) do_reboot = 1;
/* Get flags */
- while((c = getopt(argc, argv, ":idfnwt:")) != EOF) {
+ while((c = getopt(argc, argv, ":idfnwpt:")) != EOF) {
switch(c) {
case 'n':
do_sync = 0;
@@ -184,6 +192,11 @@
case 'i':
do_ifdown = 1;
break;
+ case 'p':
+#if LINUX_VERSION_CODE > 0x20100
+ do_poweroff = 1;
+#endif
+ break;
#if COMPATIBLE
case 't':
tm = optarg;
@@ -223,6 +236,10 @@
if (do_reboot) {
init_reboot(BMAGIC_REBOOT);
+#if LINUX_VERSION_CODE > 0x20100
+ } else if (do_poweroff) {
+ init_reboot(BMAGIC_POWEROFF);
+#endif
} else {
/* Turn on hard reboot, CTRL-ALT-DEL will reboot now */
init_reboot(BMAGIC_HARD);
diff -urN sysvinit-2.71.orig/src/reboot.h sysvinit-2.71/src/reboot.h
--- sysvinit-2.71.orig/src/reboot.h Thu Apr 17 04:02:52 1997
+++ sysvinit-2.71/src/reboot.h Wed May 28 00:18:38 1997
@@ -5,6 +5,7 @@
* Version: @(#)reboot.h 1.00 23-Jul-1996 miquels@cistron.nl
*
*/
+#include <linux/version.h>
#if defined(__GLIBC__)
# include <sys/reboot.h>
@@ -14,6 +15,10 @@
#define BMAGIC_SOFT 0
#define BMAGIC_REBOOT 0x01234567
#define BMAGIC_HALT 0xCDEF0123
+
+#if LINUX_VERSION_CODE > 0x20100
+#define BMAGIC_POWEROFF 0x4321FEDC
+#endif
#if defined(__GLIBC__)
#define init_reboot(magic) reboot(magic)
---
Thanks.
Akira Yoshiyama
<yosshy@jedi.seg.kobe-u.ac.jp>