HOWTO Compile Kernel With Distcc and CCache
From Gentoo Linux Wiki
This article is still a Stub. You can help Gentoo-Wiki by expanding it.
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
[edit] HOWTO compile kernel with distcc
This article shows how we can compile the linux kernel with two or more machines using distcc.
[edit] 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)
[edit] 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.
[edit] 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
[edit] 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
[edit] 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
[edit] 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
[edit] Sources
Distcc Home Page
Ccache Home Page
Gentoo Distcc Documentation
Speed up compiling software with distcc
Speeding up recompilation with ccache
