David’s Blog

Custom Debian Kernel Build without “make menuconfig”

Posted in Systems Engineering / Unix Systems Operations by david415 on August 9, 2008

I maintain a cluster of MySQL servers. I mentioned below that Linux has some memory management issues which cause our MySQL servers to swap when they really should not. So my idea was to upgrade the kernel to the Debian Etch Testing 2.6.25 kernel… but patched with Rik van Riel’s Split LRU patch (check it out: http://www.surriel.com/node/6).
Also… I don’t feel any need to compile a super efficient static kernel with only the modules we use. I’m OK with the Debian default initrd module loading kernel.

So what I ended up doing was first installing Debian’s kernel :

apt-get install linux-image-2.6.25-2-amd64

Then I grab the Debian kernel source (Linux kernel patched by Debian) :

apt-get source linux-image-2.6.25-2-amd64

which creates these files in the currect directory :

linux-2.6-2.6.25
linux-2.6_2.6.25-7.diff.gz
linux-2.6_2.6.25-7.dsc
linux-2.6_2.6.25.orig.tar.gz

Patch the kernel with the split-LRU patch :

cd linux-2.6-2.6.25
patch -p1 < ../linux-2.6.25-splitlru.patch

I move the changelog so that make-kpkg doesn’t complain and quit :

cd debian
mv changelog changelog.fu
cd ..

Here’s the secret sauce… I’m lazy and don’t want to do a “make menuconfig”
because I’m happy enough with the way Debian configures the kernel + initrd module loading.
So I copy the Debian config from the Kernel we just installed :

cp /boot/config-2.6.25-2-amd64 .config

Edit the Makefile and put unique id in EXTRAVERSION; this'll show up in a 'uname -a' :
e.g.

EXTRAVERSION = spinn3r.r1

I was building on a dual core machine so I set the CONCURRENCY_LEVEL
to tell the Debian make-kpkg to spawn instances of the compiler for building.
However if I was doing this often I'd use DistCC (http://code.google.com/p/distcc/).

export CONCURRENCY_LEVEL=2

Build the kernel, create debian package with a custom name :

fakeroot make-kpkg --initrd --us --uc --revision=spinn3r kernel_image

After some period of time that'll create a .deb file in the kernel directory's parent directory
which you can installed via a dpkg -i file.deb


2 Responses

Subscribe to comments with RSS.

  1. [...] 3, 2008 in linux For the last few weeks we’ve been running with the Split-LRU patch and [...]

  2. Linux Swap Issue « David’s Weblog said, on October 8, 2008 at 7:13 pm

    [...] mysql, oom, patch, split-lru, swapoff, swapon, workaround « Megaraid Nagios Plugins Custom Debian Kernel Build without “make menuconfig” [...]


Leave a Reply