3. Installing from scratch

ACPI is constantly being revised. It is available in later versions of the 2.4.x series kernel (2.4.22 and higher), and all 2.6.x series kernels. You should always use the latest stable version of the kernel that your system will support. Patches are available from acpi.sourceforge.net. If you must use a kernel older than version 2.4.22 you will need to patch your kernel to get ACPI support.

Always check for kernel patches

Even the latest kernel will sometimes have minor bug fixes available as a patch. You should check the ACPI4Linux web site to see if there are any patches available.

You need to get the patch that exactly matches the version of the kernel that you are running. Since this is the install from scratch section I will assume you know exactly which kernel you will be installing.

3.1. DSDT: Differentiated System Description Table

Thanks to Erich writing this section.

You might need to override the DSDT when certain features like battery status are incorrectly reported (usually causing error messages to syslog). DELL laptops usually need this kind of override. Fixed DSDT for many systems are available on the DSDT page, along with a patch that tells the kernel to ignore the BIOS-supplied table but use the compiled-in fixed DSDT.

Basically you need to copy the fixed table into your kernel source with a special filename (or modifying the filename in the patch supplied at the DSDT page) This override is quite easy: instead of loading the DSDT table from BIOS, the kernel uses the compiled-in DSDT table. That is all.

3.2. Choosing a kernel

This document was originally written for the 2.4.20 kernel and has been updated since to include information about the 2.6.x series kernels. At the time of this update the 2.6.x series kernels are proving easy for some and harder for others.

If you can, I would recommend waiting to upgrade your kernel to the 2.6.x series until more bugs are ironed out, and more documentation is available. There are a lot of changes in the 2.6.x series kernel. When I upgraded to 2.6.5 to update this document I ran into problems with my wireless connection, my nVidia graphics card, my touch pad, and with ACPI. Your mileage may vary. I personally had good success with the 2.4.20 with the latest patch and the 2.4.22 kernel with no patch. (And then I upgraded from 2.4.22 directly to 2.6.5.) A Google through your distribution's mailing list, and the acpi-devel mailing list should help you to pick the right kernel.

Regardless of which kernel you choose, if it is a kernel that requires patching, it is important to use the latest version of the ACPI patch. Some distributions have already patched their kernels. This is the case for Debian, and may be the case for others. For more information on the patches that have been applied to the Debian kernel source package scan through: /usr/src/kernel-source-<version>/README.Debian. If you are not using Debian look in the /usr/src/kernel-source-<version> directory for an equivalent file.

Using pre-compiled kernels

I do not use the Debian pre-compiled kernels. I always opt to compile my own kernels using The Debian Way. If you are using your distribution's pre-compiled kernel, please check to make sure it has all relevant ACPI patches applied before you install it.

If you are running a production-level server and/or are serving web pages to the Internet, please also apply any additional security patches. You may have additional patches which must be applied for hardware or software problems specific to your system. Most laptop users should be fine with only the ACPI patch. If possible laptop users should also apply any additional security patches.

Patching a previously patched kernel

If a kernel has had other patches applied to it, you may have problems applying the ACPI patch. Of course, an ACPI patch should not be applied to a kernel that is already patched for ACPI. Depending on the patches applied, you may need to modify some of the Makefiles for your patch to be successful. This is beyond my current grasp of reality so it is not covered in this document.

3.3. Backups

If you are already running a kernel that is the same version of the one you are about to patch I recommend creating a fresh directory for the newly patched kernel. You should create a backup of all important kernel configuration and kernel-related files that may be affected by your work. Remember that backups are never a bad thing and can be easily deleted after your system has been successfully patched.

Example 1. Files to backup

  • /etc/lilo.conf

  • /usr/src/*.deb (Debian-specific)

  • /etc/modules

  • /etc/modutils/aliases

  • /usr/src/linux/.config

If you are not doing things The Debian Way you should also back up the following files:

  • /lib/modules (the entire directory)

  • /boot/vmlinuz

  • /usr/src/linux/arch/i386/boot/bzImage

  • /usr/src/System.map

It is possible the location of these files differs on your system. Use locate as follows if the files are not in the locations specified above:

locate <file>

3.4. Download and unpack the kernel source

3.4.1. Required packages

The following is a list of packages required to patch a kernel.

Example 2. Packages required for patching your kernel

2.6.x series kernels

  • kernel source files

  • ACPI patch that exactly matches the kernel version

  • debian packages: binutils, e2fsprogs, gcc, make, module-init-tools, procps, util-linux (see also the list from 2.4)

Learn more about the 2.6 kernel before you upgrade

This HOWTO does not include information on how to migrate from a 2.4 series kernel to a 2.6 series kernel. Please read the resources listed in Migrating to the 2.6 series kernels before attempting a kernel upgrade.

2.4.x series kernels

  • kernel source files

  • ACPI patch that exactly matches the kernel version

  • debian packages: make, bzip2, gcc, libc6-dev, tk8.3, libncurses5-dev, kernel-package

3.4.2. Getting the Source Files

Download a fresh kernel from www.kernel.org. You need to make sure you get a full kernel. Find the latest stable version of the Linux kernel and click on F for FULL. Wait patiently. A bzipped kernel is about 26M. If you are feeling particularly geeky you could also grab the file from the command line with wget.


You may or may not want the latest stable version. For more information read the Section 3.2, “Choosing a kernel” section of this document. If you decide to use a version of the kernel that is not published on the front page, use the /pub/linux/kernel directory on the kernel.org site to find the kernel you would like.

Example 3. Download the kernel and patch

  1. wget http://kernel.org/pub/linux/kernel/v2.4/linux-<version>.tar.bz2

  2. Download the latest patch for your kernel. This may or may not be the newest patch available. Please look carefully. For example: if you are using the 2.4.20 kernel you would get acpi-20021212-2.4.20.diff.gz. The patches can be downloaded from: http://prdownloads.sourceforge.net/acpi.

  3. Note the revision date. In this example above the date is 20021212 (December 12, 2002), but it will almost certainly be different for your kernel. You will need to know this number when you check to make sure the patch worked.

3.4.3. Unpack

You will need to unpack the bz2 file (bzip2) and move the directories into place. /usr/src/linux probably points to your current kernel. This link must point to the new kernel, you will update that link now as well.

Example 4. Unpacking your kernel source files

  1. cd /usr/src

  2. tar xjfv linux.<version>.tar.bz2

  3. rm linux (assuming it is a link to your old kernel)

  4. ln -s /usr/src/linux.<version> linux

If your kernel needs to be patched, do so now. Full instructions are available from Appendix A, Patching Kernels or you can skip right to the step-by-step instructions at Patching your kernel.

3.5. Configure the new kernel

Patch Your Kernel First

If you are using an old kernel you will need to patch it before you can proceed. Instructions on patching your kernel are available from Appendix A, Patching Kernels. Always check to see if your kernel should be patched.

Use make oldconfig to configure your new kernel. Using oldconfig instead of menuconfig allows you to start with the options you have selected in your current kernel and prompts you to select your preference for all new kernel options. This is much easier than looking for all of the new options by hand. For everything specific to ACPI and your hardware (if you use a Toshiba choose the Toshiba options, Asus choose the Asus options) choose M for module. There are about ten different ACPI related options that you will need to select.

Example 5. Configuring your kernel

Please also read the list of Known Issues.

  1. cd /usr/src/linux

  2. cp /usr/src/<oldkernel-source-directory>/.config .config

  3. make oldconfig (say M to all new options for ACPI--you can also say Y if you prefer to compile it directly into your kernel)

  4. Please confirm the kernel is properly configured:

    1. make menuconfig

    2. Select General Setup

    3. Confirm Power Management Support is ON

    4. Confirm APM (Advanced Power Management) is OFF (this is the old style of power management that is being replaced)

    5. Check everything to do with ACPI. Options related to your hardware should be M (modules) or * (compiled directly into the kernel). Read the list carefully. Some options will not apply to your hardware.

    6. Exit and save the new configuration

3.6. Compile and install the new kernel

It is now time to compile the kernel. These instructions are for Debian users. If you are not using Debian, or you do not like compiling your kernel The Debian Way, please read Appendix B, Compiling Kernels the Non-Debian Way for more help.

If you have additional modules that are not part of the main source tree, you will need to add modules_image when you make your Debian packages. This is almost inevitable if you are using a laptop and an older kernel. I still need this option even in the 2.6.6 kernel due to my nVidia graphics card.

Example 6. Compiling the kernel The Debian Way

Each of these steps should be performed as the root user.

  1. cd /usr/src/linux

  2. make-kpkg clean

  3. make-kpkg --append-to-version=.<a_unique_and_clever_name> kernel_image modules_image

I no longer use .date to distinguish kernel builds. It was too frustrating to have 030627a, 032627b (etc) as I tried to figure things out. I now use names, in alphabetical order, starting with the kernel build alien. My current kernel build is Ulairi. (The machine itself is Smeagol--a name it has earned.)

Now that the kernel is compiled it can be installed. For Debian users this means installing the Debian package file you created in the last step and then loading the new kernel into lilo. I like to configure lilo on my own and have provided the instructions here, but I leave that decision up to you.

Example 7. Install the new kernel

Each of these steps should be performed as the root user.

  1. cd /usr/src

  2. dpkg -i kernel-image-<version>.<a_unique_and_clever_name>_10.00.Custom_i386.deb

  3. At this point I decline all the lilo updates and configure it myself by hand.

  4. To configure lilo:

    1. vi /etc/lilo.conf

    2. Scroll to the end of the file and look for a line that starts with image=.

    3. Create an entry for your new kernel by adding the following three lines:

    4. Update the entry for your old kernel so that it points to the right vmlinuz file. You can use either vmlinuz.old if this is your first time recompiling the kernel, or look in /boot for the correct file.

    5. If you would like, you can update the kernel that is selected by default by changing the default= parameter.

  5. load the new kernel into lilo by running lilo from the command line. You need only type: lilo

  6. If you have any other deb files for your modules you should install them now as well. If you are not sure check /usr/src for additional .deb files.

3.7. Reboot and test

At this point you should reboot your machine. When your system comes back up (assuming of course that everything went well and you still have a system), you will need to check that you are running the new kernel with the correct patch.

Example 8. Confirm installed kernel and ACPI patch version

First you need to make sure you are running the correct kernel. This can be done with the command line tool uname. The revision is the date the patch was released and will be different for each kernel release.

$ uname -a

Assuming you are indeed running the new kernel, you can now check the ACPI's revision date with the following command.

$ cat /proc/acpi/info

This may give you only a version number, or a more detailed list. You are looking for the line that starts with version:.

If for some reason that gives you no information, you can also check the message printed when ACPI was first loaded as the system was booting. This information can be printed to a terminal window with the application dmesg.

$ dmesg | grep ACPI.*Subsystem\ revision

It should give the output: ACPI: Subsystem revision 20040326. The revision number is the date the patch was originally released by the development team. If you patched your kernel according to Appendix A, Patching Kernels this number will match the patch that you installed in Patching your kernel.

To read all the ACPI-related information, you can expand the pattern that grep matches and selectively print all ACPI messages:

$ dmesg | grep ACPI

3.8. Load related modules

Check to see that each of the ACPI modules have been loaded after your machine boots. You can do this with the command lsmod. You are looking for the following options: button, battery, fan, ac, thermal and processor. If you chose Y instead of modules when you compiled your kernel, you will not see this list. The output on my computer looks like this:

Module                  Size  Used by    Tainted: P  
button                  2420   0 (unused)
battery                 5960   0 (unused)
ac                      1832   0 (unused)
fan                     1608   0 (unused)
thermal                 6664   0 (unused)
processor               8664   0 [thermal]
NVdriver              945408  11 

The last module is my graphics card, which uses proprietary drivers. This is why I have a P next to Tainted on the top line.

If you compiled ACPI support in as Modules and you do not see the ACPI modules listed you will need to load the modules by hand. The modules should be in /lib/modules/<version>. <a_unique_and_clever_name>/kernel/drivers/acpi/, and are as follows:

-rw-r--r--    1 root     root         4.1k Jun  3 23:57 ac.o
-rw-r--r--    1 root     root         9.5k Jun  3 23:57 battery.o
-rw-r--r--    1 root     root         5.2k Jun  3 23:57 button.o
-rw-r--r--    1 root     root         3.7k Jun  3 23:57 fan.o
-rw-r--r--    1 root     root          14k Jun  3 23:57 processor.o
-rw-r--r--    1 root     root          11k Jun  3 23:57 thermal.o
-rw-r--r--    1 root     root         6.2k Jun  3 23:57 toshiba_acpi.o

Extensions on Modules

The module name is the bit before .o extension on a module filename. processor.o is the file, and processor is the module name. To install a loadable kernel module use: insmod processor.

The 2.4.x series kernels use the extension .o; however, the 2.6.x series kernel use the extension .ko.

The first time I rebooted I loaded them all by hand, typing insmod <modulename>. I personally load processor first, although there are mixed feelings on whether or not the order matters.

Operating System Power Management (OSPM)

The first time I tried this the modules were all in separate directories and were ospm_<name>. This was probably because I was using an old patch, but it is something to be aware of. The OSPM modules are now deprecated so hopefully you will not see them.

To prevent having to load the modules each time you reboot you can do one of two things: compile them directly into the kernel (bit late for that though, eh?), or add them to your /etc/modules file. If you do not already have a copy of the file just create a new one and add each module name (remember, no dot-o) on a separate line. You can also try running update-modules which should automatically update your /etc/modules.conf configuration file.