Wednesday, May 30, 2012

CPU Undervolting with Linux Mint 12


Hi guys,

PHC stands for Processor Hardware Control and, as it's easy to understand, it allows users to customize some features of CPU control in a linux environment, as undervolting.


So what do we need? A Mint (or Debian) box, usually undervolting is useful on laptops: it enhance battery duration and reduces the heat production. You will also need some time and patience, ;]
  1. You will need a kernel patch and a particular CPU driver so that the hardware control will be possible. First let's add the repo:
    sudo add-apt-repository ppa:linux-phc/ppa
    sudo add-apt-repository ppa:linux-phc/testing
    sudo apt-get update
  2. Now let's install the kernel and its headers:
    sudo apt-get install linux-generic-phc linux-headers-generic-phc
    First pause... restart your PC and be sure to choose your new *-phc kernel.
  3. As we will need to compile some stuff some users might need
    sudo apt-get install gtk2-engines-pixbuf python-gtk2-dev build-essential
    And then:
    sudo apt-get install dkms debhelper
    Before doing anything else we have to create an empty file to match dmks autoconfiguration: Intel users go with the first, AMD with the second line!
    sudo sh -c 'echo >> /etc/modprobe.d/phc-intel.conf'
    sudo sh -c 'echo >> /etc/modprobe.d/phc-k8.conf'
  4. Now you have to download the driver, choose it looking at your CPU: there are two choices AMD and Intel, be sure to take the right one.
  5. Unpack the package to a temporary folder. Open a terminal and move there:
    cd **your_path**
    Intel users can generate a debian package:
    make dkms_mkdeb
    And install the resulting .deb package:
    sudo dpkg -i phc-intel-dkms_0.3.2_all.deb
    While AMD can't generate it, so:
    sudo make dkms_install 
    Now you have your driver ready to go!
  6. So we will unload the old driver:
    sudo modprobe -r acpi-cpufreq
    Once you're done load the new one, amd users will have the second line, intel the first!
    sudo modprobe phc-intel
    sudo modprobe phc-k8
    If you experience the error: "FATAL: Module acpi_cpufreq is in use." you'll need to:
    sudo sh -c ' echo "\n#blackist required to load phc drivers\n blacklist acpi_cpufreq\n blacklist cpufreq_stats\n" > /etc/modprobe.d/blacklist.conf'
    sudo sh -c ' echo "modprobe ##your module##\n" > /etc/modules'
    And REBOOT =_= ...
  7. Now I guess you want a cool GUI to easier setting VIDs: get it here. Unpack it to a non temporary folder and move there.
  8. From the main phctool folder run:
    sudo ./install.sh
  9. Follow the instruction (both yes will be OK)
  10. Create a new program link in the menu with "Main Menu" to the command /**your_path**/pchtool.sh
  11. Be sure to create a startup entry with the command
    /**your_path**/phctray.sh
    So voltages will be restored at each startup! 
After this installation procedure try to launch phctool from your main menu: there you can set the voltages and see many infos about your CPU. If it happens that you can't refresh the actual values install msr-tools and run it with:
sudo apt-get install msr-tools
sudo modprobe msr
The correct undervolted values are not universal, so you'll need some testing. If you think you'll need a guide, then take a look here:

http://linuxsolver.blogspot.com/2011/10/how-to-set-cpu-voltage.html


Cheers!

6 comments:

  1. I found some problems, when tryed use this tutorial:

    1º some lines when breaked, give rong ideia of other command, instead of same's command. Need some prefix.

    2º When we have a erro to trying unload a module, I think the right command is
    >$ sudo sh -c ' echo "\n#blacklist required to load phc drivers \nblacklist acpi_cpufreq \nblacklist cpufreq_stats" >> /etc/modprobe.d/blacklist.conf' $<
    and
    >$ sudo sh -c ' echo "##your module##" >> /etc/modules' $<
    PS: All command is between >$ $< tags

    After all this, all working, well the software is installed but need to improve it.

    ReplyDelete
    Replies
    1. Thanks for your suggestions, I'll update the guide.

      If you are willing to contribute in improving the software feel free to give some feedback here: http://www.linux-phc.org/

      Cheers

      Delete
  2. Hello,

    i got an Error when i want to remove the acpi_cpufreq module:

    FATAL: Module acpi_cpufreq is in use.

    how can i solve this problem? How to unload the Module?

    ReplyDelete
  3. Sorry i missed the line where the problem was discussed. A simple reboot solved my problem. Thank you so much for this explanation.

    ReplyDelete
  4. Hi,
    I am trying to download the kernel but it seems is not online anymore any other way to get it?

    Thank you

    ReplyDelete
  5. Buongiorno Fabio, is there still a possibility to install this on Linux Mint Rebecca?

    ReplyDelete

Loading...