Quick howto on building a Linux (SUSE) kernel

This is a quick step-by-step guide to compiling your own kernel in SUSE. Whilst thankfully no longer a requirement for most it is handy to know.

1. Using Yast install the kernel source, GCC and ncurses-devel (plus any dependencies).

2. Change to the /usr/src/linux-x.x.x directory (where x.x.x is the kernel version)

3. Configure the kernel using menuconfig (requires ncurses-devel package).

make menuconfig

4. Give the kernel a unique name by editing the .config file created by the kernel config process. Look for the EXTRAVERSION parameter and name it something other than default. If you do not specify a unique kernel name you run the risk of overriding the default kernel and modules (which means no fallback position if things do not work).

5. Clean out the build directory before beginning the build process.

make clean

6. Make the kernel image (approximately >10 minutes depending on the hardware).

make bzImage

7. Make the modules (approximately 20 minutes depending on the hardware and modules defined).

make modules

8. Install the modules into /lib/modules

make modules_install

9. Copy the newly created kernel and system.map to /boot (where x.x.x is your kernel version).

cp /usr/src/linux.x.x.x/arch/i386/boot/bzImage /boot/vmlinuz-x.x.x
cp /usr/src/linux.x.x.x/System.map /boot/System.map-x.x.x

Note: The above commands assume a i386-based system has been used to compile.

10. Create an initrd (initial RAM disk) for the kernel to load on boot (where x.x.x is your kernel version).

cd /boot
mkinitrd -k vmlinuz-x.x.x -i initrd-x.x.x

11. Configure grub to use the new kernel.
Edit /boot/grub/menu.lst
Add or modify an existing menu entry (where x.x.x is your kernel version).

title New Kernel Name
kernel /vmlinuz-x.x.x ro root=LABEL=/
initrd /initrd-x.x.x

Note: look at the previous parameters in the grub.conf file and note what "root=" and use what is existing.

12. Reboot and choose the new kernel from the boot menu.

With a little luck your new kernel will load successfully with all the correct drivers in place for your hardware.