HOWTO.html — The Linux Tips HOWTO provides some useful tips that make it worth the time to read because it addresses some file system problems such as 'Is there enough free space?' and 'How do I move directories between file systems?'
> http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/BootPrompt- HOWTO.html — The BootPrompt HOWTO informs you of boot time arguments that can be passed to the kernel to deal with misbehaving hardware, configure non-PNP devices, and so on.
> http://www.linux-usb.org/USB-guide/x498.html — The USB Guide for mass storage and other USB devices. If you have a USB device and need to know whether it is supported and how to access it, check here. (Tip: USB storage devices are emulated as SCSI devices.)
CHAPTER 36
Kernel and Module Management
A kernel is a complex piece of software that manages the processes and process interactions that take place within an operating system. As a user, you rarely, if ever, interact directly with it. Instead, you work with the applications that the kernel manages.
The Linux kernel is Linux. It is the result of years of cooperative (and sometimes contentious) work by numerous people around the world. There is only one common kernel source tree, but each major Linux distribution massages and patches its version slightly to add features, performance, or options. Each Linux distribution, including Fedora, comes with its own precompiled kernel as well as the kernel source code, providing you with absolute authority over the Linux operating system. This chapter examines the kernel and so you can learn what it does both for you and for the operating system.
In this chapter, you also learn how to obtain the kernel sources, as well as how and when to patch the kernel. The chapter leads you through an expert's tour of the kernel architecture and teaches you essential steps in kernel configuration, how to build and install modules, and how to compile drivers in Fedora. This chapter also teaches you important aspects of working with GRUB, the default Fedora boot loader. Finally, the chapter's troubleshooting information will help you understand what to do when something goes wrong with your Linux kernel installation or compilation process. As disconcerting as these problems can seem, this chapter shows you some easy fixes for many kernel problems.
Most users find that the precompiled Fedora kernel suits their needs. At some point, you might need to recompile the kernel to support a specific piece of hardware or add a new feature to the operating system. If you have heard horror stories about the difficulties of recompiling the Linux kernel, you can relax; this chapter gives you all the information you need to understand when recompiling is necessary and how to painlessly work through the process.
The Linux Kernel
The Linux kernel is the management part of the operating system that many people call 'Linux.' Although many think of the entire distribution as Linux, the only piece that can correctly be called Linux is the kernel. Fedora, like many Linux distributions, includes a kernel packaged with add-on software that interacts with the kernel so that the user can interface with the system in a meaningful manner.
The system utilities and user programs enable computers to become valuable tools to a user.
In 1991, Linus Torvalds released version .99 of the Linux kernel as the result of his desire for a powerful, Unix-like operating system for his Intel 80386 personal computer. Linus wrote the initial code necessary to create what is now known as the Linux kernel and combined it with Richard Stallman's GNU tools. Indeed, because many of the Linux basic system tools come from the GNU Project, many people refer to the operating system as GNU/Linux. Since then, Linux has benefited as thousands of contributors have added their talents and time to the Linux project. Linus still maintains the kernel, deciding on what will and will not make it into the kernel as official releases, known to many as the vanilla or
The Linux Source Tree
The source code for the Linux kernel is kept in a group of directories called the kernel source tree. The structure of the kernel source tree is important because the process of compiling (building) the kernel is automated; it is controlled by scripts interpreted by the make
application. These scripts, known as
It is not necessary for the Linux kernel source code to be installed on your system for the system to run or for you to accomplish typical tasks such as email, web browsing, or word processing. It is necessary that the kernel sources be installed, however, if you want to compile a new kernel. In the next section, we show you how to install the kernel source files and how to set up the special symbolic link required. That link is /usr/src/kernels/<
, and it is how we will refer to the directory of the kernel source tree as we examine the contents of the kernel source tree.
The /usr/src/kernels/<
directory contains the .config
and the Makefile
files among others. The .config
file is the configuration of your Linux kernel as it was compiled. There is no .config
file by default; you must select one from the /configs
subdirectory. There you will find configuration files for each flavor of the kernel Fedora provides; simply copy the one appropriate for your system to the default directory and rename it .config
.
We have already discussed the contents of the /configs
subdirectory, so now you can examine the other directories found under /usr/src/kernels/<
. The most useful is the Documentation
directory. In it and its subdirectories, you will find almost all the documentation concerning every part of the kernel. The 00-INDEX
file (each Documentation
subdirectory also contains a 00-INDEX
file as well) contains a list of the files in the main directory and a brief explanation of what they are. Many files are written solely for kernel programmers and application writers, but a few are useful to the intermediate or advanced Linux user attempting to learn about kernel and device driver issues. Some of the more interesting and useful documents are
> devices.txt
— A list of all possible Linux devices that are represented in the /dev
directory, giving major and minor numbers and a short description. If you have ever gotten an error message that mentions char-major-xxx
, this file is where that list is kept. Devices are mentioned in Chapter 35, 'Managing the File System.'
> ide.txt
— If your system uses IDE hard drives, this file discusses how the kernel interacts with them and lists the various kernel commands that can be used to solve IDE-related hardware problems, manually set data transfer modes, and otherwise manually manage your IDE drives. Most of this management is automatic, but if you want to understand how the kernel interacts with IDE devices, this file explains it.