This tutorial was copied from my original site. I haven’t used it in several years (since about kernel version 2.0.36). Good luck!
Here are some quick instructions on how to build and install a new kernel. (these instructions are not all inclusive, just a quick reference guide).
The latest stable source can be downloaded via ftp at ftp://ftp.kernel.org/pub/linux/kernel. Keep in mind that the current source is in the neighborhood of 25MB. (this statement was made back when a 56k modem was a big deal – it took some time to download 25MB at that speed!)
rm -f /usr/src/linux
mv linux-X.X.X.tar.gz /usr/src
tar -zxvf linux-X.X.X.tar.gz
mv linux linux-X.X.X
ln -s linux-X.X.X linux
Ok. Now we have the kernel source unpacked and placed in the directory /usr/src/linux where we want it. We are ready to start building the kernel now. *The following steps must be executed in the same order that they are listed here. make mrproper; make menuconfig; make dep; make clean; make bzImage; make modules; make modules_install
make mrproper - Removes any old build files. If this is a new source tree, there shouldn’t be any, but it doesn’t hurt to run this the first time you build a kernel.
make menuconfig (or xconfig if you prefer a gui) – This step is the most difficult one. You need to step through *all* of the kernel options and make sure that you enable everything you need. Keep in mind to also disable options that you don’t need, as a smaller kernel runs faster. Using modules is a good way to minimize your kernel. *Pay attention here, take your time and read the help section for the options that you don’t understand.
make dep - Builds all of the kernel dependencies
make clean - purges any old builds from the build directory
make bzImage - This step is what actually builds your kernel. When this step completes, you will have a file called /usr/src/linux/arch/i386/boot/bzImage . This is your new kernel!
mv bzImage /boot/vmlinuz-X.X.X-new - put the new kernel into the boot directory, making sure not to over-write any old kernels (we want to save the old in case our new kernel doesn’t boot)
If you are using modules, you will need to run the following two commands to build and install your modules.
make modules - builds kernel modules
make modules_install - installs kernel modules in /lib/modules/X.X.X
Now our new kernel is built and in place, all we have to do is add the new kernel to lilo or whatever boot loader you use. I will only cover lilo (LInux LOader) here.
Using your favorite editor (I like vi), add the following lines to /etc/lilo.conf
Now run the command /sbin/lilo to get lilo to reread its config file. It should output something like:
[root@localhost linux]# /sbin/lilo
Added linux *
Go through and double check to ensure that you haven’t missed anything and reboot your box (shutdown -ry now). At the lilo prompt, type ‘new’ and cross your fingers in hopes that it will boot
Broaden your knowledge base with one of these great books from Amazon.com.