Compiling Kernel   «Prev  Next»

Lesson 7 Compiling the kernel: preliminaries
ObjectiveDescribe Preliminary Kernel Building Procedures

Describe Preliminary Kernel Building Procedures

Describe preliminary kernel-building procedures.
Before you build your new kernel, you should familiarize yourself with the terminology and requirements for kernel compilation. Your ability to speak intelligently about your kernel build not only gives you a "guru" edge, but also makes it easier for others to help you troubleshoot any problems.

Kernel-naming conventions

Linux usually refers to its kernels by major version number, minor version number, and patch level. Even-numbered minor versions (for example, 2.2.x) imply the kernel is part of the stable development branch; odd-numbered minor versions (2.3.x) imply the kernel is developmental.
In order to distinguish among various configurations of the same kernel version, Red Hat includes an extra-version specification[1], separated from the other version information by a hyphen. For example, kernel version 2.2.14-5.0smp refers to kernel major version 2, minor version 2, patch level 14, and extra-version 5.0smp.

Kernel-build requirements

To build a new kernel, you must acquire the kernel sources, have all necessary compiler utilities, and have some standard Linux libraries. Red Hat provides these files in the standard RPM[2] format, and you may download them from Red Hat's website.
You will need the following to build a new kernel.
  1. The kernel sources, which are available in kernel-source-(version).(arch).rpm.
  2. The kernel headers, which are available in kernel-headers-(version).(arch).rpm.
  3. The compiler utilities egcs, dev86, cpp, and make.
  4. The libraries glibc-devel, ncurses, and ncurses-devel.
Replace (version) with the kernel version you want and (arch) with your computer's architecture. For example, kernel-2.2.14-5.0smp.i386.rpm is the Linux 2.2.14 kernel source for the i386 architecture. 
The next lesson describes how to configure the kernel before compilation.

What Is an Operating System?

An operating system is made up of software instructions that lie between the computer hardware (disks, memory, ports, and so on) and the application programs (word processors, Web browsers, spreadsheets, and so on). At the center is the kernel, which provides the most basic computing functions (managing system memory, sharing the processor, opening and closing devices, and so on). Associated with the kernel are a variety of basic services needed to operate the computer, including:
  1. File systems: The file system provides the structure in which information is stored on the computer. Information is stored in files, primarily on hard disks inside the computer, but also on removable media such as CDs and DVDs. Files are organized within a hierarchy of directories. The Linux file system holds the data files that you save, the programs you run, and the configuration files that set up the system.
  2. Device drivers: These provide the interfaces to each of the hardware devices connected to your computer. A device driver enables a program to write to a device without needing to know details about how each piece of hardware is implemented. The program opens a device, sends and receives data, and closes a device.
  3. User interfaces: An operating system needs to provide a way for users to run programs and access the file system. Linux has both graphical and text-based user interfaces. GNOME and KDE provide graphical user interfaces, whereas shell command interpreters (such as bash) run programs by typing commands and options.
  4. System services: An operating system provides system services, many of which can be started automatically when the computer boots. In Linux, system services can include processes that mount file systems, start your network, and run scheduled tasks. In Linux, many services run continuously, enabling users to access printers, Web pages, files, databases, and other computing assets over a network.
Without an operating system, an application program would have to know the details of each piece of hardware, instead of just being able to say, open that device and write a file there.

[1]Extra-version specification: The extra-version specification is used to distinguish between various configurations of the same kernel version. It is separated from the traditional version by a hyphen.
[2]RPM: An acronym for Red Hat Package Manager, an RPM is a group of files stored in a single portable file.