Search:  
Gentoo Wiki

HOWTO_Compile_Kernel_With_Distcc_and_CCache

This article is still a Stub. You can help Gentoo-Wiki by expanding it.

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

HOWTO compile kernel with distcc

This article shows how we can compile the linux kernel with two or more machines using distcc.

Requirements

This setup requires two or more linux hosts with the same baseline of gcc on an IP network, preferably a private one. Distcc must be installed on both hosts (see [1]).

The use of ccache is optional.

(see www.delorenzo.info)

Setting up

In this example, we suppose that we have one or more server machines which run a distcc daemon, and a client machine where the compilation kernel will go. The client machine may optionally participate in the compilation of the kernel. If not, the kernel will be compiled by the servers.

On the server(s)

Now, we will see the config features on the server or multiple servers.

The file /etc/conf.d/distccd

DISTCCD_OPTS="-j2" #The number of files processed by distcc
[...]
DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"  #Network port config
[...]
DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical" #Syslog config
[...]
DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24" #Network config. This is the net where the server listen petitions
[...]
DISTCCD_NICE="15"

Finally, start the distcc server

[user@system ~] /etc/init.d/distccd start

If the client should help compile the kernel...

In that case, we can compile the kernel by this way:

[user@system ~] export DISTCC_HOSTS="localhost 192.168.0.10" #localhost is the client host; The 192.168.x.x is the distcc server
[user@system ~] cd /usr/src/linux
[user@system ~] make CC="distcc gcc" -j4

Note: If your machines use different architectures you may want to use for example:

make CC="distcc x86_64-pc-linux-gnu-gcc" -j4

If the client doesn't compile the kernel...

In that case, we compile the kernel by this way

[user@system ~] export DISTCC_HOSTS="192.168.0.10"
[user@system ~] cd /usr/src/linux
[user@system ~] make CC="distcc" -j4

Adding Ccache

Install Ccache:

emerge -av ccache

Set Ccache to prefix all make commands with distcc:

[user@system ~] export CCACHE_PREFIX='distcc'

If the client should help compile the kernel with Ccache

In that case, we can compile the kernel by this way:

[user@system ~] export DISTCC_HOSTS="localhost 192.168.0.10" #localhost is the client host; The 192.168.x.x is the distcc server
[user@system ~] cd /usr/src/linux
[user@system ~] make CC="ccache distcc" -j4

If the client doesn't compile the kernel but still uses Ccache

In that case, we compile the kernel by this way

[user@system ~] export DISTCC_HOSTS="192.168.0.10"
[user@system ~] cd /usr/src/linux
[user@system ~] make CC="ccache distcc" -j4

Sources

Distcc Home Page
Ccache Home Page
Gentoo Distcc Documentation
Speed up compiling software with distcc
Speeding up recompilation with ccache

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Compile_Kernel_With_Distcc_and_CCache"

Last modified: Fri, 05 Sep 2008 03:52:00 +0000 Hits: 18,480