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
- Explain the differences between modular and monolithic kernels
- List available modules
- Load kernel modules:
- Configure kernel modules
- List the advantages and disadvantages of building a custom Linux kernel
- Describe preliminary kernel-building procedures
- Configure kernel options before compilation
- Compile and install the kernel and modules
- Describe common post-installation procedures
- Use the LILO map installer to install first- and second-stage boot loaders
In Red Hat Linux, you can load kernel modules using the `modprobe` command. Here's a breakdown of the process and key aspects:
- `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.
- 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).
- 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.
- 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.
- 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.
[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.