Linux on Mobile Computers
A major concern for many people taking their notebooks away from power outlets is how long their battery will last. Without any power management software, my 486DX4/75 notebook with a NiMH battery will last about forty-five minutes to an hour and a half away from a power outlet. While this will vary from machine to machine, it would be nice if this could be extended.
The goal of power management software is to manage the overall level of power consumption of the hardware by reducing or eliminating power consumption where it is not needed. This process is accomplished by communication between the hardware and operating system through a standard interface. For PC notebooks, this interface is known as the Advanced Power Management (APM) specification, version 1.1 at the time of this writing, and is defined by a document drafted by Microsoft and Intel. The specifications are intended to be operating system independent.
Although the APM specifications are intended to make power management independent of the operating system used, the unfortunate reality of the market is that some notebook manufacturers have decided to implement power management systems that work only with an MS-DOS or MS-Windows operating system.
Usually, new notebooks on the market will implement the specifications correctly, but there are many older models and even a few newer models that do not. If you happen to have one of those machines that does not implement APM correctly or sufficiently, you may be out of luck. Careful research of new machines can ensure that your machine is compatible.
APM works through communication between a properly designed system BIOS and an APM device driver in the operating system. BIOS stands for Basic Input/Output System, and is a Read Only Memory chip on your computer's motherboard. A system BIOS that implements APM can both read and modify the power consumption level of the hardware components in the machine. These components include your CPU, battery, screen, hard disk, floppy drive, PCMCIA drive, I/O ports, sound card, CD-ROM drive, and so forth.
The BIOS can communicate with the operating system's device driver, relaying this information so the operating system and BIOS can together make intelligent decisions about power levels. In this way, the operating system can power down or reduce power to those devices in the system that aren't in use, leaving more battery life for those devices that are in use. In addition, many notebooks feature a Suspend button that lets you manually put the notebook into a state of extremely low power consumption until you wake it up.
The Linux APM driver is maintained by Rik Faith, and the most recent version can be found already in kernel 1.3.46 or later. Support for APM can simply be chosen as a compile option in these kernels. Versions of the driver for older kernels and the 1.2.x kernels do exist as kernel patches, but are no longer supported by Rik and the other developers and lack some of the newer features. Those interested in APM support are therefore strongly encouraged to use a 1.3.x kernel. APM support will be a standard part of the next production kernel series, which will be called 1.4.x or 2.0.x.
In order for the APM driver to work, the system BIOS on your laptop's motherboard must support the APM version 1.0 or 1.1 interface, preferably version 1.1. It must also support 32-bit protected-mode connections. While most late model notebooks meet these requirements, a vendor's marketing claim of APM compliance is not sufficient. While the APM specifications strongly encourage laptop manufacturers to meet these standards, there is some leeway given to them. If APM support is important to you, make sure that the machine you are using meets these requirements.
In addition to the actual APM driver, there are several utilities available that use the APM kernel driver and the /proc/apm directory. These utilities are located at ftp://ftp.cs.unc.edu/pub/users/faith/linux and the current version of the utilities is available in the file apmd-2.1.tar.gz. This package includes a daemon process called apmd that logs battery status, and a utility named apm that simply outputs the information available in /proc/apm including the current battery level. For those running X-Windows, a simple utility called xapm displays a simple graph of battery life. And for those interested in hacking, a C library called libapm.a is provided so users can write their own utilities.
For those who have notebooks that do not have an adequate APM implementation in the BIOS, there is at least one other option available. A simple utility called hdparm is available which sets many IDE parameters, including how much inactivity an IDE drive should wait for before spinning down. The hdparm utility comes with every current Linux distribution, and can be obtained from ftp://tsx-11.mit.edu/pub/linux/sources/sbin/hdparm-2.7.tar.gz This is not true APM, but it's better than nothing. Hard disks use significant power and this simple utility can increase battery life up to 50%, in my experience.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- SUSE – “Will not diverge from its Open Source roots!”
- Dealing with Boundary Issues
- Vagrant Simplified
- Libreboot on an X60, Part I: the Setup
- System Status as SMS Text Messages
- October 2015 Issue of Linux Journal: Raspberry Pi
- Bluetooth Hacks
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- New Products
- October 2015 Video Preview