Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Compiling kernels with distcc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Kream
n00b
n00b


Joined: 19 Apr 2002
Posts: 30
Location: New Delhi, India

PostPosted: Wed Dec 11, 2002 11:13 pm    Post subject: Compiling kernels with distcc Reply with quote

Compiling kernels with distcc

I test a number of kernels including vanillla, mandrake, lolo-sources, linux-beta and, of course, gentoo-sources so I find myself compiling the kernel lots of times. Even if you use distcc to emerge packages like I do, kernel compilations aren't distributed because the kernel make doesn't use /etc/make.conf. This is how I use distcc to radically speed up my compile times:
Overview

  1. Set up distcc

    1. Emerge distcc on the computers
    2. Start distccd on the slave systems

  2. Configure the kernel
  3. Edit Makefile
  4. make the kernel
Set up distcc
Set up distcc on all computers that you want to use, including the host computer. To accomplish this, a simple emerge command suffices:
Code:
 emerge -u distcc

Once done, make sure you start the distccd daemon on all the computers that you want compilation to be distributed to. This is done by running this command on all of them:
Code:
/etc/init.d/distccd start

Configure the kernel
Change to /usr/src/linux and configure the kernel using make menuconfig or make xconfig (does anyone still use make config ???? :roll: ). Save your config and and do a make dep.
Edit the Makefile
Fire up your favourite editor and load /usr/src/linux/Makefile. Find this section:
Code:
#
# Include the make variables (CC, etc...)
#

And change "gcc" in the CC line to
Code:

CC              = $(CROSS_COMPILE)distcc

Append this line to the section:
Code:

DISTCC_HOSTS=slave1 slave2 slave3 ... slaveN

You can enter the hostnames of the computers if you're sure that they resolve. If they don't, you can use their IP addresses. It's best to enter the computers in descending order of CPU power availability.
If you want the local machine to participate in the compile, remember to start distccd on it as well and add localhost to the list of DISTCC_HOSTS. I don't recommend this, though, as the local machine will already be doing the preprocessing and co-ordinating.

Add DISTCC_HOSTS to the line which says
Code:
export  VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
and save and exit.
Make the Kernel
When making the kernel, do a
Code:
 make -jQ bzImage
where Q is the number of parallel makes that you want to run. I recommend that Q be the number of slaves you have + 2. Examine the terminal's output to make sure that distcc is being called instead of gcc. If you're a gkrellm2 user like I am, you'll notice lots of data traffic outbound from your machine (preprocessed code) and a small amount of inbound traffic (compiled code).
I found my kernel being built *much* faster with distcc.

Aniruddha Shankar
Bangalore, India.

Vipassana Works.
Back to top
View user's profile Send private message
kyron
Apprentice
Apprentice


Joined: 26 Aug 2002
Posts: 198
Location: Montreal, Qc.

PostPosted: Fri Apr 11, 2003 1:45 am    Post subject: Reply with quote

To add to this wonderful document of yours, here is a script which I use each time I compile a kernel....just to make sue I don't forget anything :P
Code:
make dep && make clean

make -j6 bzImage
make -j6 modules
make modules_install

mount /boot/
#keep a date stamped copy ;-P
cp /boot/bzImage /boot/bzImage.`date +%F_%k-%M`
cp arch/i386/boot/bzImage /boot/bzImage
umount /boot/

#Making sure alsa-driver
export ALSA_CARDS=ens1370
emerge alsa-driver nvidia-kernel nvidia-glx
depmod -a
update-modules

_________________
M$ Windows: When in doubt, REBOOT
Linux: When in doubt, RTFM ;-)
Back to top
View user's profile Send private message
kyron
Apprentice
Apprentice


Joined: 26 Aug 2002
Posts: 198
Location: Montreal, Qc.

PostPosted: Fri Apr 11, 2003 1:49 am    Post subject: Reply with quote

One other thing I forgot, I also added ccache to the following line:
Code:
 CC              = $(CROSS_COMPILE)ccache distcc

_________________
M$ Windows: When in doubt, REBOOT
Linux: When in doubt, RTFM ;-)
Back to top
View user's profile Send private message
matroskin
Apprentice
Apprentice


Joined: 21 Jan 2003
Posts: 211

PostPosted: Wed Jul 16, 2003 1:31 pm    Post subject: Re: Compiling kernels with distcc Reply with quote

Kream wrote:
does anyone still use make config ???? :roll:
yes, i do. make config and make oldconfig are pretty good for configuring kernels throu scripts.
Back to top
View user's profile Send private message
kurifu
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jul 2003
Posts: 77

PostPosted: Sun Mar 28, 2004 10:00 pm    Post subject: distcc while using genkernel. Reply with quote

For anyone who wishes to use distcc and genkernel to make their kernel, all you have to do is follow your normal distcc setup (emerge -v distcc, visit the distcc howto link provided at the end of the emerge), follow the instruction at the top of this thread to prepare your kernel make file and use the following command with genkernel:

Code:
genkernel all --menuconfig --makeopts="-j5"


Obviously you can make a few changes to the genkernel command line, depending on how you wish to build the kernel. The important command is --makeopts="-j5" which actually sets up the number of parallel makes at once, needed to push some of the processes to your host.
Back to top
View user's profile Send private message
LordVan
Developer
Developer


Joined: 28 Nov 2002
Posts: 67
Location: Austria

PostPosted: Thu Nov 22, 2012 1:14 pm    Post subject: Reply with quote

Thanks for the well written instructions :) I was looking for just this (my laptop is too slow to compile kernel in reasonable time -- and also tends to overheat :( )
_________________
I don't suffer from insanity. I enjoy every minute of it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum