原文删除
问题已解决,下载编译一个内核模块即可。
hdaps + tp_smapi-(0.3x我使用0.39)
tp smapi下载
http://sourceforge.net/project/showfiles.php?group_id=1212&package_id=171579
以下转载自ThinkWiki
Installation on Ubuntu or Debian is quite easy, but there are a few things to look after:
To get your system ready for compiling code, install the build-essentials (as root, of course, as all of the following comands; Ubuntu users have to prepend 'sudo' to every line and enter their own password when prompted):
apt-get install build-essential
To get tp_smapi to work, obtain the latest source as mentioned above and unpack it. If you want to use HDAPS, you need to install the kernel source matching te kernel you are running. To do so, issue this:
uname -r
This will give you the version of your current kernel. Debian users execute the following:
apt-get install linux-source-`uname -r`
Ubuntu users execute the following using the kernel-version only (exclude -XX-generic; e.g. 'linux-source-2.6.20'):
apt-get install linux-source-`uname -r`
Be sure to unpack the source file. The easiest way is to open Nautilus as root:
sudo nautilus
Then browse to /usr/src/ and extract the source file to that directory.
Now change to the tp_smapi dir:
cd tp_smapi-X.YY(X.YY being the version-number of tp_smapi)
and make and install tp_smapi as instructed above.
If you get an error that the kernel version isn't matching (or that you need to set KSRC/KBUILD), please check that there is a symlink from the modules dir to the kernel source:
root@localhost:~#ls -l /lib/modules/2.6.20-16-generic
lrwxrwxrwx 1 root root 28 2007-02-02 08:39 source -> /usr/src/linux-source-2.6.20
Create the link if the line above is not existent:
root@localhost:~#ln -s /usr/src/linux-source-2.6.20 /lib/modules/2.6.20-16-generic/source
Now the following will build and install the correct modules to their locations:
make install HDAPS=1
To make sure your system loads the modules at boot time, do this:
echo "tp_smapi" >> /etc/modules
echo "hdaps" >> /etc/modules
and update your initramfs:
update-initramfs -u
To get tp_smapi running now, just load the modules:
modprobe -a tp_smapi hdaps
This description was tested on Kubuntu 'Feisty Fawn' and should work on all Debian-based distros with minor tweaks.
EDIT: Works on Kubuntu 7.10 ("Gutsy Gibbon"), too
Battery charge control features
To set the thresholds for starting and stopping battery charging (in percent of current full charge capacity):
# echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
# echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
# cat /sys/devices/platform/smapi/BAT0/*_charge_thresh
To prevent charging for 17 minutes (regardless of thresholds):
# echo 17 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes
To cancel charging preventation:
# echo 0 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes
To force battery discharging (even if connected to AC):
# echo 1 > /sys/devices/platform/smapi/BAT0/force_discharge
To cancel forced discharge:
# echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge
Installation from source
You will need the kernel headers and makefiles corresponding to your current kernel version.
On Fedora Core, this means
# yum install kernel-devel-$(uname -r)
.
# tar xzvf tp_smapi-0.39.tgz
# cd tp_smapi-0.39
Then, either compile and load the driver within the current working directory (for testing):
# make load
OR compile and install into the kernel's module path:
# make install
If you use the HDAPS driver, add HDAPS=1 to also patch the hdaps for compatibility with tp_smapi
(this requires a kernel source tree matching the current kernel). Again, either load the driver within the current working directory:
# make load HDAPS=1
OR install into the kernel's module path:
# make install HDAPS=1
Ubuntu 8.04.1 comes with tp_smapi and hdaps_ec (the renamed hdaps),
so we do not need to install these modules. However, to enable the active protection system (hard disk parking),
we need to do something more.
Installing daemon and utilities:
$ sudo apt-get install hdapsd hdaps-utils
Adjust the configuration daemon for your hard disk device:
$ sudo vim /etc/default/hdapsd
For IDE:
DISK="hda"
For SATA:
DISK="sda"
Add the necessary modules in the list that is loaded after boot:
$ echo tp_smapi | sudo tee -a /etc/modules
$ echo hdaps_ec | sudo tee -a /etc/modules
Preparation
Installation of tools for compiling and creating a working 'thinkpad' components:
$ sudo apt-get install linux-kernel-devel fakeroot build-essential
mkdir ~/thinkpad
Obtaining resources for compiling the kernel and modules:
$ cd ~/thinkpad
$ sudo apt-get build-dep linux-image-$(uname -r)
$ apt-get source linux-image-$(uname -r)
$ sudo apt-get build-dep linux-ubuntu-modules-$(uname -r)
$ apt-get source linux-ubuntu-modules-$(uname -r)
$ sudo apt-get build-dep linux-restricted-modules-common
$ apt-get source linux-restricted-modules-common
Compile kernel
Getting the two patches for the 2.6.24 kernel:
$ cd ~/thinkpad
$ wget -c 'http://sourceforge.net/mailarchive/attachment.php?list_name=hdaps-devel&message_id=87hcjjedbn.fsf%40denkblock.local&counter=2' -O disk-protect.patch
$ wget -c 'http://sourceforge.net/mailarchive/attachment.php?list_name=hdaps-devel&message_id=87bq6l2ihm.fsf%40denkblock.local&counter=2' -O adjust-blocked-counters.patch
Applications patch, the change of name from generic to thinkpad, compiling and installing the kernel (CONCURRENCY_LEVEL parameter = 2 is only for the Core Duo processor):
$ cd ~/thinkpad/$(ls -1p ~/thinkpad | grep ^linux-2".6"..*/$)
$ patch -p1 -l < ../disk-protect.patch
$ patch -p1 -l < ../adjust-blocked-counters.patch
$ mv debian/config/i386/config.generic debian/config/i386/config.thinkpad && mv debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)i386/generic debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)i386/thinkpad && mv debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)i386/generic.modules debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)i386/thinkpad.modules && mv debian/config/amd64/config.generic debian/config/amd64/config.thinkpad && mv debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)amd64/generic debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)amd64/thinkpad && mv debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)amd64/generic.modules debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)amd64/thinkpad.modules && mv debian/control debian/control.orig && sed s/-$(uname -r | sed 's/thinkpad/generic/')/-$(uname -r | sed 's/generic/thinkpad/')/ debian/control.orig > debian/control
CONCURRENCY_LEVEL=2 AUTOBUILD=1 NOEXTRAS=1 fakeroot debian/rules binary-debs flavours=thinkpad
$ sudo dpkg -i ~/thinkpad/$(ls -1 ~/thinkpad | grep ^linux-image-2".6"..*thinkpad.*".deb$)
$ sudo dpkg -i ~/thinkpad/$(ls -1 ~/thinkpad | grep ^linux-headers-2".6"..*thinkpad.*".deb$)
Modules
Change of name from generic to thinkpad, compiling and installing the modules (CONCURRENCY_LEVEL parameter = 2 is only for the Core Duo processor):
$ cd ~/thinkpad/$(ls -1p ~/thinkpad | grep ^linux-ubuntu-modules-2".6"..*/$)
$ mv debian/control debian/control.orig && sed s/-$(uname -r | sed 's/thinkpad/generic/')/-$(uname -r | sed 's/generic/thinkpad/')/ debian/control.orig > debian/control
CONCURRENCY_LEVEL=2 AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=thinkpad
$ cd ~/thinkpad/$(ls -1p ~/thinkpad | grep ^linux-restricted-modules-2".6"..*/$)
$ mv debian/control.stub.in debian/control.stub.in.orig && sed s/-@@ABIVER@@-generic/-@@ABIVER@@-thinkpad/ debian/control.stub.in.orig > debian/control.stub.in && debian/rules debian/control
CONCURRENCY_LEVEL=2 AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=$(uname -r | sed 's/generic/thinkpad/') ati_flavours=$(uname -r | sed 's/generic/thinkpad/') nv_flavours=$(uname -r | sed 's/generic/thinkpad/')
$ sudo dpkg -i ~/thinkpad/$(ls -1 ~/thinkpad | grep ^linux-ubuntu-modules-2".6"..*thinkpad.*".deb$)
$ sudo dpkg -i ~/thinkpad/$(ls -1 ~/thinkpad | grep ^linux-restricted-modules-2".6"..*thinkpad.*".deb$)
If you are using additional drivers under the Restricted (FGLRX, NVIDIA, etc.), the analogy is to install (as in the ~/thinkpad). In my case, I did not install these Restricted modules (my system do not need):
$ cd ~/thinkpad
$ ls -1 | grep ".deb$
$ sudo dpkg -i .deb
Then, reboot with new kernel, '2.6.xx kernel-xx-thinkpad'
Test an accelerometer
$ hdaps-gl
If the detection of movement inverse, we need to put a parameter for hdaps_ec, e.g. 'hdaps_ec parameter invert = 1', in '/etc/modules'. More information and parameters are provied at
http://www.thinkwiki.org/wiki/Tp_smapi#HDAPS_axis_orientation
Install GNOME applet
This will show a status icon on a panel to indicate the active protection status:
$ sudo apt-get install libpanel-applet2-dev
$ mkdir -p ~/thinkpad/gnome-hdaps-applet
$ cd ~/thinkpad/gnome-hdaps-applet
$ wget -c http://www.zen24593.zen.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz
$ tar -xzvf gnome-hdaps-applet-20060120.tar.gz
$ gcc $(pkg-config --cflags --libs libpanelapplet-2.0) -o gnome-hdaps-applet gnome-hdaps-applet.c
$ sudo cp gnome-hdaps-applet /usr/bin
$ sudo mkdir /usr/share/pixmaps/gnome-hdaps-applet/
$ sudo cp *.png /usr/share/pixmaps/gnome-hdaps-applet/
$ sudo cp GNOME_HDAPS_StatusApplet.server /usr/lib/bonobo/servers/
转载于:https://www.cnblogs.com/nniixl/archive/2008/11/01/1324208.html