1: If you have ATX hardware, for various reasons, you might want your box to poweroff by itself when you shut it down. To achieve this you have to enable [apm(8)](http://netbsd.gw.com/cgi-bin/man-cgi?apm+8+NetBSD-current) in the kernel. Here's how to do it:
2:
3: **Contents**
4:
5: [[!toc]]
6:
7: # Obtaining the Sources
8:
9: If you are running 3.0, you can get the Sources from the NetBSD FTP Server or from a [Mirror](Get BSD) close to you. If you are running current, you should check out the Sources from a CVS Mirror close to you.
10:
11:
12: # cd /
13: # ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.0/source/sets/syssrc.tgz
14: # tar -zxf syssrc.tgz
15:
16:
17: # Configure the kernel
18:
19: Edit the file `/usr/src/sys/arch/i386/conf` and uncomment _apm_ to enable APM, it should look like:
20:
21: apm0 at mainbus0 # Advanced power management
22:
23:
24: Alternatetively, you might want to customize (uncomment) these options:
25:
26: # Tuning for power management, see apm(4) for more details.
27: #options APM_NO_IDLE # Don't call BIOS CPU idle function
28: #options APM_V10_ONLY # Use only the APM 1.0 calls
29: #options APM_NO_POWEROFF # Don't power off on halt(8)
30: #options APM_POWER_PRINT # Print stats on the console
31: #options APM_DISABLE_INTERRUPTS=0 # Don't disable interrupts
32:
33:
34: # Build the kernel
35:
36: # config GENERIC_APM
37: # cd ../compile/GENERIC_APM
38: # make depend; make
39:
40:
41: If everything went OK, your new APM-enabled-kernel should be located in ./netbsd
42:
43: # Install the kernel
44:
45: # mv /netbsd /netbsd.old
46: # cp netbsd /
47: # shutdown -r now
48:
49:
50: Now when you shutdown the box it should poweroff by itself, without the need for the power button to be pressed.
51:
52: # Troubleshooting
53:
54: If something went wrong, test with [apm(8)](http://netbsd.gw.com/cgi-bin/man-cgi?apm+8+NetBSD-current). Sample output:
55:
56:
57: root@antfarm:~# apm
58: Battery charge state: absent
59: Battery remaining: 0 percent (0 minutes)
60: A/C adapter state: connected
61: Power management enabled
62:
63:
64: ## apmd
65:
66: You will need the apm Daemon _apmd_ running for setting your Notebook fall into sleep. For that please add:
67:
68: apmd=yes
69:
70:
71: to your /etc/rc.conf Also see [apmd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?apmd+8+NetBSD-current) for more power management issues.
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb