Defcon:Blog Keklkakl blog blag


Debian Kernel compilation and installation for Sun/Cobalt RaQ

Compiling and installing a new, working Linux kernel on a RaQ appliance is not as trivial as it would be on a commodity PC/server. Here, I go through how I got my Lenny based RaQ's up and running with new kernels, starting from an already operational Debian Lenny i386 install


Start off by installing the prerequisites for kernel-compilation:

apt-get install build-essential bzip2 \
    kernel-package gcc libncurses5 libncurses5-dev \
    bin86 gawk ncurses-dev initramfs-tools \
    zlib1g zlib1g-dev binutils

Download patch

Now we select, and download the cobalt patch for the Linux kernel. I like to do this _before_ downloading the kernel itself, as it allows me to see what patches exist, and select the kernel-version accordingly. I have found the -jeffw-patches to be the ones that wotk, while the -tw patches from Tim&Tina usually fail with a hang while booting. So, look over and find a patch for the kernel-version you wish to use((Keep in mind that Lenny uses 2.6.26 as its “native” kernel)).


Download kernel

With the patch selected, and downloaded, it is time to download an appropriate kernel-source((While this may be done using apt-get, I prefer downloading it from the source-tree)). Pick the newest subpatch-release of the patchlevel kernel you selected. E.g. if you chose the 2.6.26 kernel patch, the latest subpatch is as I write this


Unpack and apply patch

Unpack the kernel under /usr/src/ and move it to an appropriate name to identify that you are patching this kernel. After unpacking, apply the patch.

cd /usr/src/
tar jxvf ~/linux-
mv linux- linux-
cd linux-
sed -e '/^EXTRAVERSION/s/$/-cobalt/' -i Makefile
patch -p1 < ~/linux-cobalt-

Download and apply base config

Next, fetch the “base-config” for the jeffw-patch. I silently ignore that Debian kernel compile recommends that you do a base in the Debian kernel config, simple because it a) includes support for a lot of hardware that the RaQ does not have, and b) the RaQ has a limitation on how large the kernel can be2). If I recall correctly, the bzip2-compressed kernel cannot exceed 1800KBytes in size.

Here, you really should select the appropriate config for your hardware.

* The RaQ3 and RaQ4, as well as most Intel Cubes are Generation III machines. * The RaQ550 is a Generation V machine.

# Generation III
wget -O .config

# Generation V
wget -O .config

Configure the kernel

Now, we do a standard Debian kernel compilation based on the “oldconfig” that we just downloaded. We include “menuconfig” so that we can look over the config and check that we havent forgotten anything we should have included. Adjust the revision to suit your needs:

make oldconfig
make menuconfig

Debian-compile the kernel

Following the standard procedure of kernel-compilation is an option, but not a recommended one. You really should run the Debian tools for kernel compilation, as this prepares an initrd for you, does housekeeping, in addition to creating .deb packages that you can use on later installs..

make-kpkg clean
make-kpkg --initrd --revision='1' kernel_image kernel_headers modules_image

Install the new kernel

First, install the kernel at you normally would a Debian kernel package:

cd /usr/src/linux
dpkg -i linux-image-
dpkg -i linux-headers-

Next, copy the compiled kernel from the kernel source tree to /boot, strip it, and bzip2 it. This is because the RaQ does not use Grub, Lilo or such, but loads the kernel off a predetermined location, namely /boot/vmlinux.bz2. You also need to link up the initrd and the

cd /boot
cp /usr/src/linux- .
strip vmlinux
bzip2 -c vmlinux > vmlinux.bz2
ln -s
ln -s initrd.img- initrd.img
Filed under: Systems administration Tagged as: Leave a comment
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

Trackbacks are disabled.