APM Power Management Configuration - Dell Inspiron 3800


Note: This is an archived page. I am keeping it available because people still find it useful - but the contents of this page will likely become gradually out of date.

In some ways it was pretty mindless to get power management working on my Linux/Windows computer, while other things weren't quite so straightforward. I'm not going to cover the "mindless" part on this page, but I will discuss how I resolved the more problematic issues. You might want to review my basic system configuration so you're aware of any differences between your computer and mine.

I also make some brief comments about using APM's standy and suspend functionality.

What I wanted to accomplish

My goals were fairly straightforward:

1. Get APM power management working under Linux
2. Move my Windows 98 SE configuration back to APM (I'd "upgraded" to ACPI earlier)
3. Get Save-To-Disk and Restore-From-Disk functioning under both OSes
4. (If possible) Restore-From-Disk should be as automatic under Linux as it is on a Windows-only system

My kernel APM settings
Here are the APM settings I use when I 'make xconfig' on a new kernel.

Getting APM working under Linux

Okay, this one was a no-brainer. The basic APM functions worked "out of the box" after I'd installed Red Hat Linux 7.1 (kernel 2.4.2). It had also worked in my original Linux setup, which was with Red Hat 7.0 (I believe that was kernel 2.2.18 or 2.2.19).

If you're building your own kernel, then you have to be sure to enable power management. The image on the right shows you the settings I use. Note that your settings for the options "RTC stores time in GMT" and "Use real mode APM BIOS call to power off" do not necessarilly have to be the same as mine. Also, if your machine hangs when you power up, you may need to disable "Enable PM at boot time".

If you don't dual-boot your system, you might want to try out the ACPI functionality that's built into newer kernels. Since I still, on occasion, need to boot into Windows, I'm using APM - ACPI saves the system's status into a file on your current operating system's disk, whereas APM saves it into a special partition that is independent of the OS.

Restoring my Windows 98 SE system to APM (removing ACPI)

Important note: Back up your computer first, especially your registry! I had to do these steps twice. The first time I managed to lock up Windows pretty darn well. Fortunately I had the previous registry available, so I was able to back-track. PLEASE don't ignore this warning! It is so easy to cook your registry...

Another Important note: I am pretty certain this is NOT a good thing to try under Windows ME, and of course it won't work under most versions of Windows 95 at all. Since ME will correctly go into ACPI hibernation (unlike Windows 98, at least if you're using a FAT32 disk) there's not a real good reason to do this anyway.

Step one: Apply Dell's ACPI-prevention patch. This registry tweak comes with all of the BIOS upgrades Dell releases for the Inspiron/Win98 combinations. You may wonder why you'd "prevent" ACPI if it's already being used on your computer. Just humor me...

Step two: Reboot your computer. While it's rebooting, go find your Windows 98 SE installation CD. If you can't find it, STOP NOW.

Step three: Open up the Windows Control Panel, and double-click the "Add New Hardware" item. This will launch the New Hardware Wizard. In the first part of the procedure, the wizard will attempt to locate any new plug-and-play devices on your system. It may or may not find some new device to add, but it's not likely to see the APM BIOS at this stage. The wizard will present a list of devices it's found (if any). Unless you see an entry for the APM BIOS, you'll need to let it continue to the next step - where it'll look for non-plug-and-play devices. This procedure should find the APM BIOS; if not, you're out of luck. Assuming the wizard did find it, allow the new hardware to be installed.

Step four: Reboot your computer (The New Hardware Wizard probably already did this for you after the install).

Step five: After rebooting, Windows should begin to install the APM device drivers. If you've previously upgraded your computer from APM to ACPI then these drivers are probably already present. If not, you'll need the Windows installation CD - I did tell you to go find it back at step two...

Final note: If the above steps don't do the trick, you may need to manually remove the ACPI device drivers from your setup. First, back up your registry! Then turn off all PM functions in your system BIOS. Next, boot into "Safe Mode". Open up the 'System' control panel and delete all ACPI entries in the device manager. Finally, re-enable the BIOS power management features, then start over from step one of this section (Apply Dell's ACPI-prevention patch).

You're done!

Getting Save-To-Disk and Restore-From-Disk working under Linux and Windows

As shipped from Dell, Windows 98 machines are already set with a Save-To-Disk (S2D) partition. This allows you to stop working at an arbitrary point, save your current status to the hard disk, turn your computer completely off, and then resume from where you were working after an arbitrary length of time. It's a really nifty feature.

Unfortunately, the Save-To-Disk setup, as factory-configured, will not work with Linux. Dell, to their credit, provides a solution for this. Go to Dell's download area and search for the file rh7s2d.exe. This program will create a bootable floppy that creates a S2D partition that'll work under both Windows and Linux. Of course you'll first need to remove your old S2D partition; if you've deleted it in the past, then you'll need to make sure there's ample space at the beginning of the disk drive for this partition.

The size needed for this partition varies, depending on your system RAM and video RAM. The formula is something like (system RAM + video RAM + 2 MB) * 1.02 = {required space}. I suggest giving yourself some leeway - it's not like the few MB are really going to matter! For my system the calculation is (160 + 8 + 2) * 1.02 = 173 MB, more or less; so I just left a 200 MB block open at the start of my disk.

There seems to be some confusion over which of Dell's programs to use to create the S2D utility. Based on their (sparse) documentation, you might think you want to run PHDISK.EXE - but you'd be wrong. For the Inspiron 3800, you'll want to run MKS2D.EXE. Jumping back a little: If you don't allow enough free space for the partition, the program will report the problem and then exit; so don't worry too much about not leaving enough space.

Once your partition is created, you can invoke the S2D mode by hitting the <Fn>+<A> key combination. The system BIOS also has a setting to Save-To-Disk after an adjustable idle period. Unfortunately, I haven't yet found a programmatic way to invoke this from Linux. The APM "suspend" function under Linux does a Suspend-To-RAM. Obviously this is an issue if you're shutting down for more than a day or two, since your system battery will be gradually drawn down by the energy requirements of keeping your memory going.

Automating Restore-From-Disk under both Linux and Windows

This one really vexed me for a while. If you've used the APM S2D functionality on a Windows machine, you are aware that it automatically restores from your S2D partition the next time you power on your computer. I tried all sorts of different things, and none of them worked... until I followed a hunch.

My hope is that, as laptops continue to grow in terms of popularity, the maintainers of the various bootloaders will recognize the fact that they really need to include a basic level of APM/ACPI awareness into their programs. If they'd do this, then this section will become pointless.

Method 1: Using Loadlin

This method is by far the simplest and safest, and is the ONLY one I'll recommend to anyone that's not willing to risk losing their data.

I tried many ways to get restore-from-disk working with LILO (the LInux LOader), and came away with a very sore skull from banging my head against a brick wall too many times. It's simple enough to add the S2D partition to your LILO configuration, but then you basically have to remember to select that partition the next time - and if you don't you can really screw things up! I did run this way for a while; take a look at my lilo.conf file from that setup.

But then I ran across a reference to Loadlin. As the true geeks in the audience undoubtably already know, this DOS executable can be used to launch Linux. It works just fine for me. The real beauty of using Loadlin, though, is not with Loadlin itself - it's the fact that by using Loadlin, you can use a Windows 98 Master Boot Record. Actually I shouldn't say "can", I should say "must" - if you've already got LILO there, you'll have to remove it. This is simply a matter of running FDISK /MBR from a DOS prompt. But to get back on track: Using the Windows boot record means your system will automatically detect when it should Restore-From-Disk!

I'm not going to spell out how to use Loadlin, since its author does a pretty good job of it already. If you are interested you can take a look at my config.sys and autoexec.bat files. I will point out that it is useful to use Loadlin parameter files if you need to pass information to the kernel. If you add parameters directly on the Loadlin command line, DOS has the nasty habit of converting everything to upper case; not a big deal with DOS, of course, but it can be terminal with Linux. You can take a look at my default laptop.par parameter file, if you wish. If you're used to LILO, it might be instructive to compare this file to my lilo.conf file.

For 99% of people who need to occasionally work with Windows, this will do just fine. But unfortunately it's not perfect - using Loadlin requires a small change in the Windows boot-up sequence, which subtly affects certain parts of Windows. In my case I noticed that my USB CD-RW drive did not work nearly as well - it was slower, and I saw occasional buffer underruns (which had never happened before). So I kept on trying, and finally arrived at...

Method 2: Using LILO

The heading is actually a bit misleading - perhaps I should have said "being able to restore-from-disk despite using LILO". I am compelled to point out that this method may be risky, since it's bending Window's rules regarding partitions. But the basic steps are pretty easy to describe:

The basic problem here is that Windows, in theory, doesn't like you to have more than one visible primary partition (its own). I think this could be a problem if you ran Linux on a FAT disk; but since Windows doesn't recognize Linux' ext2fs partitions, it doesn't appear to be a real issue. Also, I noticed that Microsoft themselves spelled out ways to "bend the rules" when a person wants to dual-boot Windows 95/98 and Windows NT/2000. In any case, Caveat emptor.

The main problem I've found with this method is sometimes your lilo.conf can get changed by certain programs (such as Win4Lin), as their installers will assume you didn't know what you were doing when you didn't install LILO into the MBR! So you'll need to keep an eye on things.


Using the Suspend Function

If you are turning off your laptop for short periods (less than one or two days), then it might make more sense for you to just use APM's suspend function. On my laptop I can do this by hitting the key pair <Fn>+<Esc>. You can also do this with the command 'apm -s' (I've added a launcher to my Gnome panel that runs this command). My laptop's battery life isn't great, but 24 hours in suspend mode only uses 10% or so of my battery's charge. The big advantage to suspend mode is that recovery is quick - not more than 5 seconds.

In the past there were a number of problems with APM suspend mode on systems with PCMCIA ports (most laptops, in other words), and also X didn't handle the resume-from-suspend gracefully. Based on my experience, I think these shouldn't be issues if your system is fairly up to date (kernel 2.4.6 or better, and XFree86 4.1.0 or better).

APM also has a standby mode, from which your computer launches even faster; but power usage is higher in standby, and if you carry your laptop in a backpack then the heat buildup can be an issue. Personally, I don't think the slight time advantage over suspend mode is significant, so I never use standby.

[Back to Trav's main page]


All contents © 2001 Travis Saling
Document last modified on 09/16/2001