ACPIBattery

Differences between revisions 11 and 12
Revision 11 as of 2005-09-27 20:51:22
Size: 6833
Editor: 217
Comment: cleanup
Revision 12 as of 2005-10-30 13:32:00
Size: 6834
Editor: CPE-60-226-22-72
Comment: Trivial spelling change to test editting
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
I am aware there are alot of forum posts on this but none show you how to easily fix the problem. I am aware there are a lot of forum posts on this but none show you how to easily fix the problem.

Some Notebooks don't display the battery status. This HOWTO will show you how to fix this annoying problem. I am aware there are a lot of forum posts on this but none show you how to easily fix the problem.

Note: The Ubuntu kernel already contains the patch that is needed for this to work, so no recompiling of the kernel is needed in this HOWTO!

Prerequisites

We need to compile some stuff along the way, so we need the package build-essential. We also need the packages flex-old (which will replace flex) and bison.

sudo apt-get install build-essential bison flex-old

The DSDT for your notebook

The DSDT (Differentiated System Description Table) sits in your BIOS and gives Linux all the information on your computer. Yours is obviously messed up, so we have to get a new one.

Go to the [http://acpi.sf.net ACPI page] at sourceforge and in the menu on the left click on DSDT and View. Here you can select your manufacturer, model and BIOS version. On the page you will get then, you can download a fixed DSDT for your notebook. If there is none for you notebook, see the links at the end of this document. If there is no DSDT for you BIOS version, update your BIOS (which in fact might already fix the problem).

So copy the download address (to paste it to the console) and in your $HOME do:

mkdir acpi
cd acpi
wget http://acpi.sourceforge.net/dsdt/tables/Manufacturer/Model/DSDT.asl.gz
gzip -d DSDT.asl.gz

(the link after wget has to be replaced with the link to your DSDT)

Obtaining Intel's iasl compiler

The DSDT has to be compiled. For this we need a special compiler from Intel. Download there Unix source [http://www.intel.com/technology/IAPC/acpi/downloads.htm here]. You might have to replace the download link in the following.

wget http://www.intel.com/technology/iapc/acpi/downloads/acpica-unix-20050624.tar.gz
tar zxf acpica-unix-20050624.tar.gz
cd acpica-unix-20050624/compiler
make
cp iasl ../..
cd ../..

If the make didn't work I can only assume that bison is not installed or you still have the flex instead of flex-old.

Compiling your DSDT

Since the 2005 versions of iasl are more restrictive than older versions your DSDT might not compile. You can either try to find an older version of iasl (I couldn't) or fix the DSDT by yourself (I will explain this).

cp yourdsdtfile.asl dsdt.asl # backup
./iasl -tc dsdt.asl          # compiling

If this works you should get 0 errors, a couple of warnings and two new files. A .hex and a .aml file. If it doesn't you will have alot of error messages telling you a ResourceSource string is missing. These errors are easy to fix. Keep the windows with the compile errors open, since we will need the line numbers.

What the errors might look like:

dsdt.asl  1028:                     0x0100, 0x00)
Error    1094 -                                 ^ Missing ResourceSource string (required)

dsdt.asl  1034:                     0x00000CF8, 0x00)
Error    1094 -                                     ^ Missing ResourceSource string (required)

dsdt.asl  1041:                     0x0000F300, 0x00)
Error    1094 -                                     ^ Missing ResourceSource string (required)

Lets open the .asl file and look at line 1028.

gedit dsdt.asl&

It looks like this:

1023  WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
1024      0x0000, /* Address Space Granularity */
1025      0x0000, /* Address Range Minimum */
1026      0x00FF, /* Address Range Maximum */
1027      0x0000, /* Address Translation Offset */
1028      0x0100, 0x00)

What we have to do is simply remove the 0x00 so that line 1028 looks like

1028      0x0100)

Do this for all missing ResourceSource string errors (they should all be in the same place), save the file and close gedit. Now compile again with ./iasl -tc dsdt.asl and watch the magic.

Some backups

As we don't want to mess with your working system we'll work on a backup and add that backup to your bootloader.

sudo -s -H   # followed by user pw
cp /boot/initrd.img-2.6.10-5-686 /boot/initrd.img-2.6.10-5-386.acpi
cp /boot/vmlinuz-2.6.10-5-686 /boot/vmlinuz-2.6.10-5-386.acpi
exit

To be able to boot from this kernel-copy we need to add a section for it to the grub bootloader.

gedit /boot/grub/menu.lst&

Add a section that looks like this (see other sections in your menu.lst for comparison)...

title           Ubuntu, kernel 2.6.10-5-386 Battery
root            (hd0,3)
kernel          /boot/vmlinuz-2.6.10-5-386.acpi root=/dev/hda4 ro quiet splash
initrd          /boot/initrd.img-2.6.10-5-386.acpi
savedefault
boot

...and place it where you want it to appear in the bootmenu.

Putting your DSDT into initrd

What remains is to actually add the DSDT to your initrd. There are 2 ways of doing this. The first one is to patch the initrd.img file, so that the initrd.img will include the DSDT. (NOTE: if you are a BREEZY user the second method is prefered):

echo -n "INITRDDSDT123DSDT123" >> /boot/initrd.img-2.6.10-5-386.acpi
cat dsdt.asl >> /boot/initrd.img-2.6.10-5-386.acpi

The alternative option is to add the DSDT.aml file in a specific place so that the default initrd image will search for it and load it on boot. As a bonus, with every kernel update the DSDT will be loaded. Beware that if the DSDT is incorrect it may lead to a kernel panic.

If you are using HOARY or below: Once you have the DSDT compiled, copy the DSDT.aml in /etc/mkinitrd/DSDT (without the extension, I don't know if this is necessary):

sudo cp dsdt.aml /etc/mkinitrd/DSDT

Then reconfigure the kernel package you are using:

sudo dpkg-reconfigure linux-image-$(uname -r)

If you are using BREEZY, the location to put the DSDT.aml file has changed, it's:

/etc/mkinitramfs/DSDT.aml

WITH the extension! it's necessary. Then reconfigure the kernel package as before:

sudo dpkg-reconfigure linux-image-$(uname -r)

That's it. Reboot your computer and pick the newly created bootoption. If it all works out you can savely remove the $HOME/acpi directory and modify the bootmenu as you like (i.e. make the new bootoption default).

[http://acpi.sourceforge.net acpi.sf.net] - ACPI HomepageBR [http://forums.gentoo.org/viewtopic.php?t=122145 Gentoo Forums] - How to fix a DSDT yourselfBR [http://www.intel.com/technology/IAPC/acpi/downloads.htm Intel ACPI] - Download iasl compilerBR [http://gaugusch.at/kernel.shtml gaugusch.at] - the kernel patch to make this work


CategoryLaptop CategoryHardware CategoryDocumentation

ACPIBattery (last edited 2008-08-06 16:22:21 by localhost)