Compiling Kernel   «Prev  Next»

Lesson 12

Compiling Linux Kernel Procedures Conclusion

This module introduced you to issues and procedures related to configuring and compiling the Linux kernel. The module began with a discussion of monolithic and modularized kernels. You learned that monolithic kernels include all hardware and filesystem support compiled into the kernel. Depending on the number of supported components, the kernel can grow to a critical size very quickly. Modularized kernels, on the other hand, load modules as needed so the kernel is not inflated with unused component support.
Next, you explored the use of modprobe as a method to intelligently controlling the loading of kernel modules. When the kernel sees the need for a module, the kernel thread kmod uses modprobe to load the necessary module.
Next, you explored the advantages and disadvantages of building a custom kernel. One of the reasons you might want to build a custom kernel include is to enable advanced routing options or capabilities not enabled in the standard Red Hat kernel. However, unless it is absolutely necessary, building a custom kernel is not recommended.
Finally, you explored the steps involved in configuring, compiling, and installing the Linux kernel and modules. You learned the many steps required to actually build and install the kernel and modules, then you learned the post-installation issues including ramdisks and the LILO map installer.
The approach of modularized kernels is still used in Red Hat Enterprise Linux (RHEL) 9.4. RHEL uses a modular kernel architecture[1], allowing the system to load kernel modules dynamically as needed. This design helps keep the kernel's memory footprint smaller by loading only the necessary drivers and components, rather than including all possible hardware and filesystem support directly in the kernel. In RHEL, modules can be loaded and unloaded dynamically using tools like `modprobe` and `insmod`. This modular design improves flexibility, scalability, and system stability, and is particularly beneficial for enterprise environments where different hardware configurations are common.
  • Linux Kernel Learning Objectives Having completed this module, you should be able to
    1. Explain the differences between modular and monolithic kernels
    2. List available modules
    3. Load kernel modules:
    4. Configure kernel modules
    5. List the advantages and disadvantages of building a custom Linux kernel
    6. Describe preliminary kernel-building procedures
    7. Configure kernel options before compilation
    8. Compile and install the kernel and modules
    9. Describe common post-installation procedures
    10. Use the LILO map installer to install first- and second-stage boot loaders

Load kernel modules in Red Hat Linux

In Red Hat Linux, you can load kernel modules using the `modprobe` command. Here's a breakdown of the process and key aspects:
  1. `modprobe` Command:
    • This is the primary tool for managing kernel modules.
    • Example: sudo modprobe module_name (replace module_name with the actual name of the module).
    • modprobe automatically handles dependencies, loading any required modules before loading the specified one.
  2. Module Locations:
    • Modules are typically stored in /lib/modules/<kernel_version>/kernel/drivers/.
    • Within this directory, modules are organized into subdirectories based on their functionality (e.g., net/ for network drivers, scsi/ for SCSI drivers).
  3. Dependency Management:
    • depmod is a tool that generates a list of module dependencies. This list is stored in /lib/modules/<kernel_version>/modules.dep.
    • modprobe consults this file to ensure all dependencies are met before loading a module.
  4. Manual Loading vs. Automatic Loading:
    • Manual Loading: Use the modprobe command as described above to load modules on demand.
    • Automatic Loading: Modules can be loaded automatically at boot time. This is usually handled by configuration files in /etc/modules-load.d/ or by entries in the /etc/modprobe.d/ directory.
  5. Additional Options:
    • modprobe -v: Provides verbose output, showing the actions taken by modprobe.
    • modprobe -r: Removes a module.

Important Notes:
  • You'll typically need root privileges (using sudo) to load or unload kernel modules.
  • Loading or unloading kernel modules can affect system stability, so it's important to know what you're doing.

If you need more specific information about loading a particular kernel module or troubleshooting module loading issues, providing the module name and any error messages you encounter would be helpful.

Red Hat Linux Kernel Glossary Terms

This module introduced you to the following terms.
  1. Compiler: A program that converts source code into an executable machine binary.
  2. Demand loading: Loading functionality only when it is needed.
  3. Developmental: Developmental modules are still being tested and improved. If you chose to use one, be aware that it may include many unresolved bugs.
  4. Device drivers: A unit of code written to interact with a specific hardware device.
  5. 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.
  6. Instance: A particular session of any object, where each session has particular characteristics that identify it uniquely. For example, a red car is an instance of the general "car" object, and you can identify the car by its red characteristic.
  7. IrDA: An acronym for Infrared Data Association, IrDA is an international standards body that plans the hardware and software requirements for wireless, infrared data communication.
  8. ISDN: An acronym for Integrated Services Digital Network, ISDN is a standards specification for data transmission over telephone wires and other land-based media.
  9. Kernel: The core component of an operating system. The kernel is responsible for interfacing with the system hardware on user program's behalf, managing system memory and scheduling tasks to run.
  10. Kernel thread: The Linux kernel is multi-threaded, meaning that multiple actions occur within the kernel simultaneously.
  11. Major version: The major version is the first number included in the standard module naming convention. It specifies the kernel version.
  12. Memory footprint: The total amount of physical and swap memory a process uses.
  13. Minor version: The minor version is the second number included in the standard module naming convention. It specifies the version of the kernel version. Odd numbers indicate developmental versions of a particular kernel and even numbers indicate a production or stable version of a particular kernel.
  14. Modular kernel: A modular kernel is one in which some drivers are built as object files, or modules, that the kernel can load on demand.
  15. Monolithic kernel A monolithic kernel is one in which support for all hardware, network protocols, and file systems is built within a single file.
  16. Object files: Compiled source code (such as C or C++).
  17. Patch level: The patch level is the third number included in the standard module naming convention. The greater the number, the more recent the patch is and the more likely bug fixes are implemented and security holes closed.
  18. Process: The computer's representation of a task. When a program is run from the command line, the binary is loaded into memory as a "process." The kernel shuffles processes around very quickly, simulating "simultaneous" program execution.
  19. Ramdisk: Ramdisks are block devices like hard disks and CD-ROM drives. However, ramdisks store their data in random access memory, as opposed to on disk. This is useful during installation.
  20. RPM: An acronym for Red Hat Package Manager, an RPM is a group of files stored in a single portable file.
  21. Stable: A stable version is indicated by even minor version numbers and should not contain any crippling bugs.
  22. Stanza: A block of commands in the /etc/lilo.conf file that define configuration values for a specific operating system.
The next module discusses how to administer Linux serial and networking devices.

Compiling Linux Kernel Quiz

Before moving on to the next module, click the Quiz link below to test your knowledge of configuring and compiling the Linux kernel.
Compiling Linux Kernel - Quiz
[1] modular kernel architecture: A modular kernel architecture is a design where the core operating system functions are implemented in separate modules that can be loaded and unloaded as needed. This allows for flexibility, customization, and efficient use of resources, as only the necessary modules need to be active at any given time.

SEMrush Software 12 SEMrush Banner 12