UbuntuWiki:UndervoltingHowto

来自Ubuntu中文
跳到导航跳到搜索

{{#ifexist: :UbuntuWiki:UndervoltingHowto/zh | | {{#ifexist: UbuntuWiki:UndervoltingHowto/zh | | {{#ifeq: {{#titleparts:UbuntuWiki:UndervoltingHowto|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:UbuntuWiki:UndervoltingHowto|1|-1|}} | zh | | }}

How to undervolt a Pentium M CPU on Ubuntu Edgy

WARNING !

Use this document at your own risk. Changing the voltage of a Pentium M CPU is not recommended because it can make it run out of its specifications. It can possibly damage your computer. Backup your data regularly to an off line medium.

Introduction

The Pentium M family of CPU's has the ability to change the frequency of the CPU. Each frequency has a specific voltage related to it. Lower frequencies work with a lower CPU voltage and higher frequencies needs a higher voltage. If the CPU switches to a lower voltage it consumes less energy (= voltage2 / resistance) and as a result dissipates less heat.

The BIOS of your laptop contains a good table of the possible frequencies and the related voltage. The kernel reads this table and applies the correct voltage to the CPU. It is possible to override this table with even lower voltages. Some reason why you might want to try this are:

  • Longer battery live
  • Less noise
  • Less heat
  • More environmental friendly

Some reasons you don't want to do it:

  • The functions to change the voltage are not supplied with the Linux kernel in Ubuntu. You have to recompile the kernel yourself (read on).
  • Your system can become unstable. The standard voltages are tested by Intel. A too low voltage can crash your computer or make it unstable (e.g. damage your filesystem).
  • Although I didn't read any reports about it, it can possibly permanently damage your hardware, void your warranty and explode in your face.

If you are happy about your laptop, it is stronly recommended not to use this howto.

Rebuilding the kernel

This procedure is based on the KernelCustomBuild page.

Create a new working directory:

$ mkdir ~/undervolt
cd ~/undervolt

Download the latest kernel source (replace vv with the version of the current kernel):

$ apt-get source linux-image-2.6.17-vv-generic

This creates a directory in your working directory with the kernel source.

Download the latest version of the linux-phc patch at the projects website https://www.dedigentoo.org/trac/linux-phc/ in the undervolt directory.

$ wget http://mesh.dl.sourceforge.net/sourceforge/linux-phc/linux-phc-0.2.9.tar.gz
tar zxfv linux-phc-0.2.9.tar.gz

Now we are ready to patch the kernel:

cd linux-source-2.6.17-2.6.17.1
patch -p1 < ../linux-phc-0.2.9/kernel-patch/linux-phc-0.2.9-kernel-ubuntu-2.6.17.patch

The patch adds a few options to the kernel configuration so we have to run:

debian/rules updateconfigs

Answer allways yes (y) to the new options.

If this fails with error number 127, try: (Replace vv with your appropriate kernel version)

sudo apt-get build-dep linux-image-2.6.17-vv-generic

The command can return an error because the files in the directory debian/bin/ are not executable. Make all the files executable in this directory and try again.

chmod +x debian/bin/*

This bug will probably be resolved in later version of the kernel package. Remove this note if the above command worked fine for you.

sudo apt-get install fakeroot kernel-wedge

To build the package enter:

AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=generic

This compiles only the 'generic' kernel. You likely want to use this flavour on a Pentium M system.

When the build is ready, install it on your system. Replace xxxx. This is a random string.

sudo dpkg -i debian/build/linux-image-2.6.17-vv-xxxx-generic_2.6.17.1-11.35_i386.deb

Reboot.

Check if the installation was successful:

cat /sys/devices/system/cpu/cpu0/cpufreq/voltage_table

(the file should exist).

If you have an Intel IPW2200 wireless card or something else that needs files from /lib/firmware/`uname -r` the hardware is not working when booting with the new kernel. To fix this create a link to the old directory:

cd /lib/firmware/
sudo ln -s 2.6.17-10-386 `uname -r`

Userspace

This part describes how to install the user space scripts and how to configure them.

cd ~/undervolt/linux-phc-0.2.8/ubuntu

First we have fix a small error on the first line of the startup script. Change #!/bin/sh in #!/bin/bash in etc/init.d/undervolt .

Install the userspace scripts of the Linux-PHC package:

sudo cp etc/init.d/undervolt /etc/init.d/
sudo cp -r etc/phc-config/ /etc/

Change the configuration file /etc/phc-config/undervolt now.

cat /sys/devices/system/cpu/cpu0/cpufreq/op_points_table

Copy this value in the configuration file in the DEFAULT_VTABLE variable and change the IS_CONFIGURED value to yes. Optionally you can set the SWITCH_BACK value to yes.

Now you have to find out the best 'undervolting' values for your system. Start with the values original values in /sys/devices/system/cpu/cpu0/cpufreq/op_points_table. You can change the values with this command:

sudo sh -c "echo 798000:700,1064000:844,1330000:892,1596000:908" > /sys/devices/system/cpu/cpu0/cpufreq/op_points_table"

The settings take effect immediately. The Gentoo wiki contains information how to find out the best values for your system. The settings in the table turned out to be remarkably accurate for my system. YMMV.

If you found a value that satisfied your needs, copy it into the CUSTOM_VTABLE variable in /etc/phc-config/undervolt.

Add the startup script to the boot sequence:

sudo update-rc.d undervolt defaults

Unfortunately the init script for Ubuntu from PHC version <=0.2.7 has a litle mistake so you probably need to change it. edit /etc/init.d/undervolt

sudo gedit /etc/init.d/undervolt

and change the second line from

source $CONFIGURATION ;

to

. $CONFIGURATION ;

Done !