-->
Page 53
Page 54
The kernel is the program that is loaded at boot time which provides an interface between the user-level programs and the hardware. Its functionality includes performing the actual task switching that occurs in multitasking systems, handling requests to read and write to disks, dealing with the network interface, and managing memory. It is these functions that give Linux its underlying behavior seen throughout the system.
Technically, Linux is only the kernel. The programs that surround it, such as the compilers, editors, windowing managers, and so on, make up the distribution. (For example, Red Hat Linux is considered a distribution of Linux.) Therefore, several different distributions of Linux exist, but the kernel remains common among them.
The kernel is important because it is the glue that holds everything together. Working as a central command post for the system, it manages all the programs running, their memory allocation, their means of accessing the disk, and so on. Without the kernel, there is no Linux.
The default kernel that comes on the CD-ROM is the 2.0.30 kernel. This kernel, which is automatically installed, contains support for a large number of devices, thereby making it flexible. Unless you have a particularly unusual configuration, the standard issue kernel with Red Hat should work on your machine without any changes.
Although the standard issue kernel will work, you might need to add support for a new device or simply pare down the list of devices the kernel supports so that it takes less memory. Either way, you will need to step through the kernel configuration process.
WARNING |
Recompiling a new kernel can be potentially dangerous. By doing so, you can easily deny yourself access to the system, so be sure to follow all the safety tips in this chapter. Being locked out of your own machine because of a silly mistake is one of the most frustrating results than can occur. |
Now that you have an understanding of what the kernel does, you might find a need to reconfigure and build it. In this section, I discuss the preamble to the process: acquiring the source code and installing it in the correct place.
Page 55
The CD-ROM that comes with this book contains an RPM for the kernel source tree. To use it, simply install it using the rpm package. You can find updated versions of the kernel source at www.redhat.com or from one of the following:
The source tree comes in one large file titled linux-X.X.XX.tar.gz, where X.X.XX is the version number of the kernel. For this example, you will use version 2.0.30.
NOTE |
Version numbers in Linux have more significance than what may appear to you at first glance. To understand what I mean, look at the kernel used in this chapter2.0.30. |
If you decide to download a more recent source tree instead of using the version on the
CD-ROM, you need to decompress and untar it. You should do so in the
/usr/src directory because symbolic links from
/usr/include have already been set up. By manipulating the
Page 56
/usr/src directory so that /usr/src/linux always points to the most recent kernel, you don't have to fix the /usr/include directories every time you compile a new kernel. (See the following tip.)
To unpack the kernel, simply run
tar xzf linux-2.0.30.tar.gz
where linux-2.0.30.tar.gz is the name of the kernel you downloaded. This line decompresses and untars the kernel into the /usr/src/linux directory.
TIP |
If you have an older kernel in place, you might not want to remove the previous source tree. After all, if you need to revert back to it, not having to download it again would be nice! Instead, create a new directory titled linux-2.0.30, where 2.0.30 is the version number of the new kernel. Then create a symbolic link from /usr/src/linux to /usr/src/linux-2.0.30. By doing so, you can easily repoint the symbolic link to new kernels as they are released. As a side benefit, your /usr/include directories can always remain pointed to /usr/src/linux. |
If this is the first kernel you've compiled, be sure to take a few minutes to read the /usr/src/linux/README file. It contains up-to-the-minute details about the exact kernel you are working with as well as problem reporting information.
TIP |
Due to the amount of concurrent development done in the Linux community, you might find that not all the drivers provided with the Linux kernel are the latest. If you have problems with a particular device, searching on the Internet to see whether a more recent version of the driver is available is often worthwhile. |