Compiling a kernel
This is an example how to compile a Linux kernel. It has been tested for SUSE Linux 11.1 and kernel 2.6.27, but should work same or similar for every combination.
- Make sure you have a compiler installed - open a console and issue
yast -i gcc
Get the code
- Download the kernel from ftp.kernel.org
- unpack the kernel
- unpack the kernel for the second time
tar xvf linux-2.6.27.tar
- configure the kernel
- answer some un-understandable questions
The sense of the step make oldconfig is to tell the kernel its configuration, e.g. which parts should be built as a module, which parts should not be built at all and the name of your special build. oldconfig takes over the settings from the running kernel that you can check with zcat /proc/config.gz if the switch EXTRACT-IKCONFIG is on. The settings for the new kernel are stored in the file .config. E.g. a line CONFIG_LOCALVERSION="-thorsten" in .config would tell kernel 2.6.27 to call himself 2.6.27-thorsten.
- compile the kernel,
- on a virtual machine with two virtual CPUs @ 2.4 GHz, this lasted 55 minutes.
- compile the drivers
make -j4 modules
- install the drivers
- install the kernel
cp arch/x86_64/boot/bzImage /boot/vmlinuz-2.6.27
This will install the kernel for the x86_64 architecture.
- prepare the initial ramdisk
cp System.map /boot mkinitrd
This will build an initial ramdisk for all kernels contained in /boot.
- add an entry to the bootloader. Let's take grub's /boot/grub/menu.lst:
title 2.6.27-selfcompiled root (hd0,0) kernel /boot/vmlinuz-2.6.27 root=/dev/sda1 initrd /boot/initrd-2.6.27