next up previous contents
Next: Testing Up: Compilation and installation Previous: Installation   Contents

Automated configuration and installation

Some of the above steps or even all of them may be completed by the kernel installation script available in your distribution. Still, very often they have to be done manually. In such a case you can use the following script, which allows you to download, compile and install the latest stable kernel, after adjusting it to suit your system configuration:

#! /bin/sh

# Patch to the kernel source directory
SRC_PATH="/usr/src/kernel/linux-stable"
OBJ_PATH="$SRC_PATH-obj/"

cd $SRC_PATH
# Download the latest -stable
ketchup 2.6
# Save the version
VER=`ketchup -m`
# Generate the configuration file (based on the old one)
make O=$OBJ_PATH oldconfig
# Build the kernel
make O=$OBJ_PATH
# Install modules
sudo make O=$OBJ_PATH modules_install
# Copy the compressed kernel image into /boot
sudo cp $OBJ_PATH/arch/i386/boot/bzImage /boot/vmlinuz-$VER
# Copy System.map into /boot
sudo cp $OBJ_PATH/System.map /boot/System.map-$VER
# If you use Fedory, you have to generate the Fedora initrd
sudo /sbin/new-kernel-pkg --make-default --mkinitrd --depmod --install $VER

Generally, each distribution has its own preferred method of building and installing new kernels. The following table contains the links to the kernel installation instructions for several selected distributions:

Distribution URL
CentOS http://www.howtoforge.com/kernel_compilation_centos
Debian http://www.howtoforge.com/howto_linux_kernel_2.6_compile_debian
Fedora http://www.howtoforge.com/kernel_compilation_fedora
Gentoo http://www.gentoo.org/doc/en/kernel-upgrade.xml
Mandriva http://www.howtoforge.com/kernel_compilation_mandriva
OpenSUSE http://www.howtoforge.com/kernel_compilation_suse
Ubuntu http://www.howtoforge.com/kernel_compilation_ubuntu

To learn more about the configuration and compilation of the Linux kernel you can refer to the book Linux Kernel in a Nutshell by Greg Kroah-Hartman (http://www.kroah.com/lkn/).


next up previous contents
Next: Testing Up: Compilation and installation Previous: Installation   Contents
MichaƂ Piotrowski 2007-06-21