These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX02/Kernel Recompilation

Classnotes | UNIX02 | RecentChanges | Preferences

Most of the time, the kernels that come included with Linux distributions are pretty bad. These kernels are refered to as "stock kernels", and are often times the first thing you replace.

Why are they bad?

  • They usually are not optimized for any particular hardware.
  • They may or may not be compiled for specific needs you might have (for example, you may have more than a Gig of RAM or you may have multiple processors).
  • They might not have the appropriate drivers or options enabled which you need.
  • You might need additional patches compiled into your kernel for performance, compatibility, or some other reason.

To solve these problems, some distribution manufacturers will actually sell what are known as "Enterprise" versions of their distributions which will typically be their normal distributions with extra kernel features tacked on. Some people (myself included) think this is a rip-off considering that with a little elbow grease and patience you can recompile your own kernel and enable what you want.

The spoon is not there

For persons new to Linux (heck, for persons experienced with Linux) kernel compilation can be a scary thing. There are so many options, and so many features, and so many drivers that it is very easy to feel overwhelmed. Bear in mind that Linux is a highly versatile operating system, and can run everything from PDAs to mainframes, so many of these features you will not be using in your recompilation.

The Linux Kernel HOWTO (http://tldp.org/HOWTO/Kernel-HOWTO/index.html) is an indespensible resource for kernel questions. However, all you really need to know about kernel compilation is contained in the second section. Basically:

 # make clean; make mrproper
 # make xconfig
 # make dep
 # make bzImage
 # make modules; make modules_install

these are the essential steps in kernel compilation. From last time, you will notice that these are very similar to other application compilation under Linux.

Here, the 'make xconfig' command will bring you a graphical-based kernel configuration interface:

you could have also done a 'make menuconfig' which would have brought you a text-based configuration interface:

Regardless, you would have gotten the same questions.

Looking at these screenshots, it is evident that there will be a lot of options to select or unselect, and there is a high likelihood for human error. For this reason, I generally start with a working known configuration file and reconfigure my kernels from there. Typically, your OS will come with a configuration file (Red Hat has it installed in /boot, for example).



Classnotes | UNIX02 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited May 17, 2003 3:51 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.