(Configure, compile, and install your very own Linux kernel!)
Knowing your hardware:
Prior to doing this, you’ll need to gather as much information about your computer as you can. The processor, motherboard, audio card, network interface card, modem, or any other devices that will need specific modules loaded into the kernel.
Downloading the kernel source:
After a visit to kernel.org, you’ll be able to download the kernel from either ftp or http. A good place to download this file to is /home/*userid*/downloads or /downloads. A copy of it should also be placed in /usr/src. That is where we will be working from.
Unpacking the kernel:
Everything that we will be doing here will require that you have root privileges.
cd /usr/src mv linux linux-2.4.6 (or whatever your current version is) gunzip linux-184.108.40.206.tar.gz tar –xvf linux-220.127.116.11.tar ln –s linux-18.104.22.168 linux cd linux
Assuring a back-out:
You want to leave your existing kernel in-tact, just in case you've made a mistake or your new kernel won't boot. We will do this by backing up a few files & directories shown below.
mv arch/i386/boot/bzImage /boot/vmlinuz mv System.map /boot/System.map mv /boot /boot_2.4
Pick your poison, making your menu:
make menuconfig* this is the one that I use.
make config* this takes forever!
Inside of the menu is where we will select of the modules to install for your devices.
What exactly is a kernel module?
Modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. An example of one type of module is the device driver, which allows the kernel to access hardware connected to the system. The alternative to building a module, is compiling the code into the kernel, and add new functionality directly into the kernel image. Besides having larger kernels, this has the disadvantage of requiring us to rebuild and reboot the kernel every time we want new functionality. Obviously, this is one of the advantages over using MS Windows.
Compiling your kernel:
Now that we have selected which modules to install into our new kernel, we will now compile the kernel.
make dep make clean (for older kernels) make bzImage make modules make modules_install
Everyone needs a boot loader.
The two main boot loaders that you’ll find are lilo & grub. Lilo, stands for Line In Line Out. Unlike lilo, grub is a graphical boot loader. Both lilo & grub allow you to choose an Operating System to boot from a menu. This allows you to install Linux & MS Windows onto the same machine.
Reboot & enjoy:
Your new kernel should now be installed! & if all went well, issuing the reboot command should boot up your new kernel.