Senin, 05 September 2011

Indikator battery nya ngga muncul di ubuntu

Silahkan dicoba yak..... kalo berhasil jangan lupa posting balik OK...

Here was the scenario.

Laptop Made : Toshiba L650 X5310
OS : Ubuntu, Centos, BackTrack Linux
Issue : None of them detects and show my battery status.
I have tried different versions of Ubutnu, distros, Kernels and none of them helped and hence raised a bug report at https://bugs.launchpad.net/ubuntu/+source/linux/+bug/703302
Surprisingly the thread got replies/responses from many people who were having the same issue and none had a clue about the fix. But reply no:16 by George Moutsopoulos helped me to find the solution.
Old Results
efheem@tuxjockey:~$ cat /proc/acpi/battery/BAT1/*
present:                 no

present:                 no

present:                 no

efheem@tuxjockey:~$ dmesg | grep batt

[    1.370268] ACPI: Battery Slot [BAT1] (battery absent)





The cause of issue is because Toshiba included two sets of boot data that tell the OS what hardware exists in the machine. Windows reads the correct one whereas Linux doesn’t. We will need to build our own kernel to make this happen. We will need to extract the DSDT (Differentiated System Description Table) from the machine, the ASL modified, and a new AML DSDT can be compiled. The sections below show the way to tell Linux to use this modified DSDT instead of the version that came with the BIOS.

The cause of issue is because Toshiba included two sets of boot data that tell the OS what hardware exists in the machine. Windows reads the correct one whereas Linux doesn’t. We will need to build our own kernel to make this happen. We will need to extract the DSDT (Differentiated System Description Table) from the machine, the ASL modified, and a new AML DSDT can be compiled. The sections below show the way to tell Linux to use this modified DSDT instead of the version that came with the BIOS.
Get the original DSDL of machine:
# cat /sys/firmware/acpi/tables/DSDT > DSDT.dat

Disassemble it

# iasl -d DSDT.dat

Make the changes:

# vi DSDT.dsl

search for line : OperationRegion (EMEM, SystemMemory, 0xFF808001, 0xFF)
and replace it with : OperationRegion (EMEM, EmbeddedControl, 0×00, 0xFF)
save the file.
Build it:

# iasl -tc DSDT.dsl

This will create a file DSDT.hex (This file is used for kernel recompilation)
I received the below two errors during this compilation
N:B :- You can actually ignore these errors, this works even having these error unfixed. But if interested you can work out to get those fixed.  Else directly goto ‘Kernel Recompilation’ section.

DSDT.dsl  2656:                     0x00000000,         // Length

Error    4122 -                              ^ Invalid combination of Length and Min/Max fixed flags


DSDT.dsl  2663:                     0x00000000,         // Length

Error    4122 -                              ^ Invalid combination of Length and Min/Max fixed flags

Fix : (If you didnt receive any error please skip this part )
open DSDT.dsl file and go to the line where iasl indicated the error. In my case I go to lines 2656 and 2663.
iasl is complaining about the “Length” line “0×00000000″. This is wrong. Look at the “Range Minimum” and “Range Maximum”. Open up your Kcalc or whatever you Gnome people use and change it to Numeral System Mode. Make sure HEX is selected and now we subtract the minimun range from the maximun range and then we add 1. Since the minimum range is 0 (And you can’t subtract 0) I will input  FEAFFFFF and then add 1 which gives me FEB00000  (Don’t get confused, I’m simply omitting “0x”, the calculator doesn’t need this). I change 0×00000000 to 0xFEB00000 by Length. So now it looks like this:

0×00000000,         // Granularity
0×00000000,         // Range Minimum

0xFEAFFFFF,         // Range Maximum
0×00000000,         // Translation Offset
0xFEB00000,         // Length


Line 2663 changed to

0×00000000,    // Granularity
0xFED40000,         // Range Minimum
0xFED44FFF,         // Range Maximum
0×00000000,         // Translation Offset
0×00005000,         // Length


compile again.

Kernel Recompilation :

Install necessary packages:

apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5 libncurses5-dev


apt-get build-dep --no-install-recommends linux-image-$(uname -r)


mkdir /root/source


cd /root/source


apt-get source linux-image-$(uname -r)

NB: My uname -r was 2.6.38.2-generic

cd linux-2.6.38

(replace this with your kernel version)
copy kernel config file from your current kernel:

cp -vi /boot/config-`uname -r` .config

now copy the DSDT.hex file to the include folder inside kernel source

cp DSDT.hex /root/source/linux-2.6.38/include

open .config file we have just copied

vi /root/source/linux-2.6.38/.config

Make the below changes

CONFIG_STANDALONE=n

CONFIG_ACPI_CUSTOM_DSDT=y

CONFIG_ACPI_CUSTOM_DSDT_FILE="DSDT.hex"
save and quit.

My pwd : /root/source/linux-2.6.38
start compiling the Kernel:

make menuconfig

load the .config file, save the menu file and exit.

We are about to start the compile process . A little trick you can do is to set the CONCURRENCY_LEVEL variable to speed up the compile of the kernel. The number should be the number of processors you have plus one. So in my case I have a Intel Core i5 processor so I will add one with the 4 available.

cat /proc/cpuinfo | grep -i processor

processor    : 0

processor    : 1

processor    : 2

processor    : 3

I have got 4 processors, so concurrency will be 4+1

# export CONCURRENCY_LEVEL=5

Start Building :
Here I named my custom kernel as tuxsage, replace it with the one you wish.

# make-kpkg clean

# fakeroot make-kpkg --initrd --append-to-version=-tuxsage kernel-image kernel-headers
(This will take some time)

Once this is completed you will find the built kernel one directory up from your present directory

# cd /root/source

# dpkg -i linux-image-2.6.38.(This part will be whatever name you gave it).deb

# dpkg -i linux-headers-2.6.38.(This part will be whatever name you gave it).deb

Make initramfs:

# update-initramfs -c -k 2.6.38+tuxsage (replace tuxsage with correct name)

Update Grub :
#update-grub
Reboot to the New Kernel :)
N:B : This post was made very soon after I got this fixed and you may find typos and other errors. Will proofread and fix those soon if any :-)

References :
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/703302
https://bugzilla.kernel.org/show_bug.cgi?id=34532
https://bugzilla.kernel.org/show_bug.cgi?id=15707
http://homeport.org/~bcordes/satellite-l500-install.html
http://www.insanelymac.com/forum/lofiversion/index.php/t189272-100.html
http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems
http://www.lesswatts.org/projects/acpi/overridingDSDT.php
http://www.question-defense.com/2010/09/26/how-to-recompile-your-ubuntu-10-10-kernel-for-patching-or-to-add-support-for-a-specific-device

sumber : http://techinterplay.com/fix-toshiba-battery-issue-linux.html

Tidak ada komentar:

Posting Komentar