Difference between pages "Toolchain update" and "Power Management"

From Funtoo
(Difference between pages)
Jump to: navigation, search
(What about libtool?)
 
 
Line 1: Line 1:
This guide explains how to upgrade the Funtoo toolchain to the new version available. With this toolchain update comes some other core packages bumps that were depending on the new toolchain.  
+
__TOC__
 +
Note: This page is a work in progress.
  
{{fancynote| This toolchain update affects the users of the ''current'' tree. ''Stable'' users should not update to this toolchain yet as many stable packages may not build with it.}}
+
== Who is this for? ==
  
== Current toolchain ==
+
The majority of people who will be interested in power management on Funtoo will be split into the following two cases:
Funtoo currently provides the following core package versions for stable branch:
+
*sys-devel/gcc-4.6.4-r2
+
*sys-devel/binutils-2.22
+
*sys-kernel/linux-headers-3.4-r2
+
*sys-libs/glibc-2.15-r4
+
  
== Toolchain update ==
+
* Laptop users
Those core packages will be updated to the following versions. These packages now included in current branch
+
* Low Power Workstation/Server users
*sys-devel/gcc-4.8.1-r3
+
*sys-devel/binutils-2.23.2
+
*sys-kernel/linux-headers-3.7
+
*sys-libs/glibc-2.18
+
  
 +
This article is currently almost exclusively directed at laptop users.
  
== Unmasking the packages ==
+
==== Why bother? ====
  
To unmask the packages, run <tt>emerge --sync</tt>. If you are using the funtoo-current, they should now be unmasked. To perform this manually (no longer necessary,) do this:
+
Battery life, environmentalism, obsessiveness.
  
<console>
+
The author of this article saw a huge improvement in battery life after setting up necessary options, jumping from a 5:37 hour ACPI estimate to over 11 hours! (Thinkpad T420, 9-cell battery)
# ##i##install -d /etc/portage/package.unmask
+
# ##i##echo ">=sys-devel/gcc-4.8.1" >> /etc/portage/package.unmask/toolchain
+
# ##i##echo "=sys-devel/binutils-2.23.1" >> /etc/portage/package.unmask/toolchain
+
# ##i##echo "=sys-kernel/linux-headers-3.7" >> /etc/portage/package.unmask/toolchain
+
# ##i##echo "=sys-libs/glibc-2.18" >> /etc/portage/package.unmask/toolchain
+
</console>
+
  
Easier way is to copy <code>funtoo-toolchain</code> from /usr/portage/profiles/package.mask, assuming that /etc/portage/package.unmask is a directory:
+
We've only got one planet right now, resources are limited, so why not use them wisely? Saving power reduces strain on your infrastructure and might save a couple furry bear cubs down the road. Also note that a reduction in power consumption means a reduction in your electricity bill.
<console>
+
# ##i##cp /usr/portage/profiles/package.mask/funtoo-toolchain /etc/portage/package.unmask
+
</console>
+
  
== Keywords changes for ''stable'' users ==
+
== The trade-off ==
If ''Stable'' users are not afraid to upgrade their toolchain, they must add the correct keywords too:
+
<console>
+
# ##i##install -d /etc/portage/package.keywords
+
# ##i##echo ">=sys-devel/gcc-4.8.1 **" >> /etc/portage/package.keywords/toolchain
+
# ##i##echo "=sys-devel/binutils-2.23.1 **" >> /etc/portage/package.keywords/toolchain
+
# ##i##echo "=sys-kernel/linux-headers-3.7 **" >> /etc/portage/package.keywords/toolchain
+
# ##i##echo "=sys-libs/glibc-2.18 **" >> /etc/portage/package.keywords/toolchain
+
</console>
+
  
== Upgrading to the new toolchain ==
+
First of all, you need to decide how much performance (if any) you're willing to sacrifice for a reduction in power.
As the dependencies have been adjusted so the packages are built in the right order, no user manipulation is required. Updating everything should work out of the box, but to ensure that no unwanted package is updated between the toolchain parts, proceed as following:
+
<console>
+
# ##i##emerge --sync
+
# ##i##emerge -1 glibc
+
# ##i##emerge -uNDav @world
+
</console>
+
  
Done!
+
Tools like laptop-mode and cpufreqd can cause a reduction in performance, however with careful configuration you can make this minimal while maintaining most of the benefits. Throughout this guide make sure to read comments in configuration files and decide what you need and want.
  
== What about libtool? ==
+
== Getting started ==
libtool is supposed to be automatically rebuilt during the update process. This avoids any manual steps to be executed after the update. If you are worried that libtool was not rebuilt, execute the following command to reinstall it:
+
<console>
+
###i## emerge --oneshot
+
</console>
+
  
== Rebuilding the whole system? ==
+
----
Some people argue that this is necessary to rebuild the whole system (even twice) after a toolchain upgrade. This is never necessary, but users who changed their CFLAGS or CXXFLAGS due to a new available arch or optimization flag are welcome to do so, if they want. However, remember that this is never necessary.
+
  
== Case of depclean ==
+
==== Using Gentoo's resources ====
After switching to new gcc, it can be cleaned (accidentally) by emerge ---depclean, it is recommended to save older gcc for failover
+
<console>
+
# ##i##emerge -av --depclean --exclude sys-devel/gcc
+
</console>
+
  
== Troubleshooting ==
+
You'll find a fantastically written starter guide on the Gentoo site [http://www.gentoo.org/doc/en/power-management-guide.xml], note however that you are not required to use Gentoo-Sources. (Making your own kernel is a boatload of fun though! You're missing out.)
After the update, if any package fails to start with a shared library missing problem, try to run:
+
 
<console>
+
==== Laptop-mode-tools ====
# ##i##revdep-rebuild
+
 
</console>
+
Laptop-mode-tools should be reasonably well configured out of the box.
Sometime, with toolchain update, system can be damaged. If such issues experienced, follow resurrection guide
+
 
http://www.funtoo.org/System_resurrection
+
<pre>
[[Category:HOWTO]]
+
vim /etc/laptop-mode/laptop-mode.conf
 +
</pre>
 +
 
 +
Make sure it's enabled:
 +
<pre>
 +
###############################################################################
 +
# Enable/Disable laptop-mode-tools execution
 +
# ------------------------------------------
 +
# Set it to 0 to completely disable laptop-mode-tools from running
 +
###############################################################################
 +
#
 +
ENABLE_LAPTOP_MODE_TOOLS=1
 +
</pre>
 +
 
 +
Next declare when to use laptop-mode:
 +
<pre>
 +
# Enable laptop mode when on battery power.
 +
#
 +
ENABLE_LAPTOP_MODE_ON_BATTERY=1
 +
 
 +
# Enable laptop mode when on AC power.
 +
#
 +
ENABLE_LAPTOP_MODE_ON_AC=0
 +
</pre>
 +
 
 +
Next you will probably be safe to enable AUTO_MODULES with:
 +
<pre>
 +
 
 +
ENABLE_AUTO_MODULES=1
 +
</pre>
 +
 
 +
However, provided you're not using HAL (You shouldn't be, it's deprecated and is replaced by udev) you may want to disable the HAL module explicitly:
 +
<pre>
 +
vim /etc/laptop-mode/conf.d/hal-polling.conf
 +
----
 +
CONTROL_HAL_POLLING=0
 +
</pre>
 +
 
 +
Finally, lets start up laptop_mode, then add it to our init.
 +
<pre>
 +
/etc/init.d/laptop_mode start
 +
 
 +
rc-update add laptop_mode default
 +
</pre>

Latest revision as of 22:58, 11 November 2011

Note: This page is a work in progress.

Who is this for?

The majority of people who will be interested in power management on Funtoo will be split into the following two cases:

  • Laptop users
  • Low Power Workstation/Server users

This article is currently almost exclusively directed at laptop users.

Why bother?

Battery life, environmentalism, obsessiveness.

The author of this article saw a huge improvement in battery life after setting up necessary options, jumping from a 5:37 hour ACPI estimate to over 11 hours! (Thinkpad T420, 9-cell battery)

We've only got one planet right now, resources are limited, so why not use them wisely? Saving power reduces strain on your infrastructure and might save a couple furry bear cubs down the road. Also note that a reduction in power consumption means a reduction in your electricity bill.

The trade-off

First of all, you need to decide how much performance (if any) you're willing to sacrifice for a reduction in power.

Tools like laptop-mode and cpufreqd can cause a reduction in performance, however with careful configuration you can make this minimal while maintaining most of the benefits. Throughout this guide make sure to read comments in configuration files and decide what you need and want.

Getting started


Using Gentoo's resources

You'll find a fantastically written starter guide on the Gentoo site [1], note however that you are not required to use Gentoo-Sources. (Making your own kernel is a boatload of fun though! You're missing out.)

Laptop-mode-tools

Laptop-mode-tools should be reasonably well configured out of the box.

vim /etc/laptop-mode/laptop-mode.conf

Make sure it's enabled:

###############################################################################
# Enable/Disable laptop-mode-tools execution
# ------------------------------------------
# Set it to 0 to completely disable laptop-mode-tools from running
###############################################################################
#
ENABLE_LAPTOP_MODE_TOOLS=1

Next declare when to use laptop-mode:

# Enable laptop mode when on battery power.
#
ENABLE_LAPTOP_MODE_ON_BATTERY=1

# Enable laptop mode when on AC power.
#
ENABLE_LAPTOP_MODE_ON_AC=0

Next you will probably be safe to enable AUTO_MODULES with:


ENABLE_AUTO_MODULES=1

However, provided you're not using HAL (You shouldn't be, it's deprecated and is replaced by udev) you may want to disable the HAL module explicitly:

vim /etc/laptop-mode/conf.d/hal-polling.conf
----
CONTROL_HAL_POLLING=0

Finally, lets start up laptop_mode, then add it to our init.

/etc/init.d/laptop_mode start

rc-update add laptop_mode default