UndervoltingHowto

How to undervolt on Hardy

See this Ubuntu Forums thread: http://ubuntuforums.org/showthread.php?t=786402

There is no need to recompile the whole kernel as described in the Edgy guide below - only one of the kernel modules...

How to undervolt AMD Processors

There's a beta PHC patch available for AMD processors at the Linux-PHC forum at http://phc.athousandnights.de/viewtopic.php?f=13&t=2

There are also two alternatives (the first one much less complicated):

How to undervolt on Feisty

The kernel patches seem to have skipped over ubuntu's 2.6.20 flavor. Get 2.6.22 from Gutsy Then follow the quick & dirty directions at https://www.dedigentoo.org/trac/linux-phc/wiki/phc_howto_ubuntu_001 to get something running without replacing all the kernel packages.

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 strongly 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:

$ apt-get source linux-image-`uname -r`

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 http://phc.athousandnights.de/ in the undervolt directory.

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

Now we are ready to patch the kernel:

cd linux-source-2.6.20-2.6.20.1
patch -p1 < ../linux-phc-0.3.0/kernel-patch/linux-phc-0.3.0-kernel-ubuntu-2.6.20.patch

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

debian/rules updateconfigs

Answer always 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.20-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.20-vv-xxxx-generic_2.6.20.1-11.35_i386.deb

Reboot.

Check if the installation was successful:

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

(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.20-16-386 `uname -r`

Userspace

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

cd ~/undervolt/linux-phc-0.3.0/init-scripts/ubuntu

Install the userspace scripts of the Linux-PHC package:

sudo cp -r etc/* /etc/

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

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

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/phc_vids. You can change the values with this command:

sudo sh -c "echo 21 19 19 19" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids"

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.

Note that the values in that table uses the old mV values. To use this in the new (>0.3) interface of phc use this formula: vid = (volt-700) / 16

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 !

UndervoltingHowto (last edited 2009-01-15 22:16:08 by 82-169-236-159)