RSS Feed twitter airdump.cz Follow RemoteSec on the Facebook
Remote Security Random Tips
News & Ads

BackTrack Linux How to Extend battery life

BackTrack 3 Can your CPU do this? The idea is, I have a notebook and I want to extend the time of working on the nootbook without being pluged into the electric outlet. There are many possibilities how to do it. It definitely means that you have installed linux based operating system. You can save something by taking away modules that are unnecessary for hardware or by reducing the backlight of LCD. And what is the second biggest time glutton right after LCD?

Yes, it is the CPU. The are two possible solutions how to save something from the battery. So called throttling is simply a thing that inserts into the processor a command “don´t do anything, don´t count anything, don´t search anything”.

The time of this depends on the setting and it can last miliseconds up to seconds. The processor takes the same amount of electricity but it cools itself and therefore the cooling fan does not turn on so often and you should save something. What saves for sure is to bring down the CPU frequency.

CPU with reduced frequency is good to use when you work with a text or when you are doing a not so demanding calculation work. When reducing the frequency the CPU should not get warm so much. Unfortunately I have not tested it so far so I can´t tell the temperature differences before and after. But I´m pretty sure that this gave me about 15-20 minut of the battery life. Then when taking away modules such as sound card, ethernet, wi-fi, etc. simply everything except the keyboard LCD HDD Touchpad, the notebook will last for 4 hours.

And thats nice. I´m planning to test it besides this in combination with throttlingem, but about this next time.

And now, how to do it. If you find out that your processor supports scaling (steping) you can go further. So you can install utility cpufrequtills002 from kernel.org. My distro Backtrack3 (Slackware) had some troubles with compilation, so I downloaded from http://slax.hosting4p.com/modules.php module cpufreq.ko (*.ko yes it´s from an older distribution, now it uses *.lzm). Converting is possible with utility ko2lzm. After converting add cpufreq.lzm to modules folder and restart. After restart it was necessary in my case to load module for CPU frequency steping – p4-clockmode.

modprobe p4-clockmode

The rest is easy. Just use command “cpufreq-info” to find out if it is possible to bring down the processor frequency. My cpufreq-info dump:

bt ~ # cpufreq-info
cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to linux@brodo.de, please.
analyzing CPU 0:
driver: p4-clockmod
CPUs which need to switch frequency ať thé samé time: 0
hardware limits: 200 MHz – 1.60 GHz
available frequency steps: 200 MHz, 400 MHz, 600 MHz, 800 MHz, 1000 MHz, 1.20
GHz, 1.40 GHz, 1.60 GHz
available cpufreq governors: userspace
current policy: frequency should be within 200 MHz and 1.60 GHz.
The governor “userspace” may decide which speed to use within this range.
current CPU frequency is 200 MHz (asserted by call to hardware).

Here you can see on which frequency you can set the processor.

You can do it for example by command “cpufreq-set -f 199Mhz” This parametr (megahertz) value has to be one point less than CPU frequency step.

Explanation: if you use as value 200 the processor will be set up for 400Mhz, if you put value 199 the processor will be set up for 200Mhz.

So great, the processor runs on 200Mhz but what now when you don´t want to manualy load the module and set the frequency every time after the restart.

Module loading can be done by easy script added to boot up executing folder.

/etc/rc.d or /root/.kde/Autostart

Script example:

#!/bin/bash
modprobe p4-clockmod

Simple menu for frequency change can look like (must be loaded as bash):

#!/bin/bash
cpufreq-info
echo “Wajtas Hax()r CPU frequency”
echo “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
echo “1. 200 Mhz”
echo “2. 400 Mhz”
echo “3. 600 Mhz”
echo “4. 800 Mhz”
echo “5. 1000 Mhz”
echo “6. 1,2 Ghz”
echo “7. 1,4 Ghz”
echo “8. 1,6 Ghz”
echo “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
echo “”
echo “”
echo -n “Its time to choose: ”
read -n 1 mark
echo
case $mark in
1) cpufreq-set -f 199Mhz;cpufreq-info ;;
2) cpufreq-set -f 399Mhz;cpufreq-info ;;
3) cpufreq-set -f 599Mhz;cpufreq-info ;;
4) cpufreq-set -f 799Mhz;cpufreq-info ;;
5) cpufreq-set -f 999Mhz;cpufreq-info ;;
6) cpufreq-set -f 1199Mhz;cpufreq-info ;;
7) cpufreq-set -f 1399Mhz;cpufreq-info ;;
8) cpufreq-set -f 1599Mhz;cpufreq-info ;;
*) echo “ERROR Bad Options” ;;
esac

That ´s all ;) Wajtas571

Share/Save/Bookmark

Similar Posts: