Compiling Kernel   «Prev  Next»

Lesson 12Linux Kernel Configuration and Compilation: Module Summary
ObjectiveReview module management, the source-build workflow, and the checks needed before trusting a newly booted kernel.

Linux Kernel Configuration and Compilation: Module Summary

This module connected everyday kernel administration with the more specialized task of building a kernel from source. The first decision is whether a custom build is needed at all. For routine RHEL administration, supported kernel and driver packages are the normal starting point. The upstream build exercises belong in a prepared lab with a recovery path.

Review the lessons as one workflow

  1. Introduction: identify the running environment and separate configuration, compilation, installation, and activation.
  2. Kernel architecture: Linux is monolithic in architecture while supporting both built-in features and loadable modules.
  3. Module inspection: distinguish installed files, loaded modules, and built-in functionality using the appropriate tools.
  4. Module loading: use modprobe to resolve dependencies, verify results, and remove modules only when their users allow it.
  5. Persistent configuration: separate module options in modprobe.d from deliberate startup requests in modules-load.d.
  6. Build decision: define a measurable reason for customization and account for maintenance, compatibility, and support.
  7. Preparation: select and verify source, check prerequisites, and establish separate source and build directories.
  8. Configuration: review .config, boot dependencies, signing inputs, and a distinct local-version suffix.
  9. Build and installation: compile as an ordinary user and install matching artifacts through a checked distribution-specific mechanism.
  10. Post-installation verification: target the newly built release explicitly when checking modules and its initramfs, then verify the actual boot.
  11. Boot entries: inspect GRUB 2/BLS entries, test the selected kernel, and preserve a known-good fallback.

Keep three distinctions clear

Available versus loaded: a module can exist on disk without being loaded. A built-in driver can work without appearing in lsmod. Use modinfo and configuration information alongside the loaded-module list.

Running versus target: uname -r describes the kernel executing now. Before rebooting, use the recorded target release to inspect the new module directory, image, and initramfs.

Built versus verified: a successful build produces artifacts. A working installation also needs a usable boot entry, trusted code under the system's policy, access to the root filesystem, and successful workload checks.

A compact verification record

For a lab build, retain the source release or revision, any patches, the configuration, relevant tool versions, target release, installation method, and test results. After selecting the target in the boot menu, a useful initial check is:

uname -r
lsmod
findmnt /
sudo journalctl -k -b --no-pager

Then test the feature that motivated the build and the system services that depend on the kernel. These commands provide evidence, but no single command certifies that every driver and application works. Keep the previous kernel until the new system has passed the checks appropriate to its use.

Key terms

Kernel module
A separately loadable piece of code that executes in kernel space.
Built-in feature
Code linked into the kernel image rather than supplied as a removable module.
Kernel configuration
The build-time settings in .config that select features and dependencies.
Kernel release
The identifier used to associate a kernel with its modules and other artifacts.
Initramfs
The temporary early-boot filesystem containing tools, configuration, and any modules needed to reach the real root filesystem.
Boot entry
The bootloader's description of the kernel, early-boot image, and parameters to use.

Check your understanding

Compiling Linux Kernel - Quiz

Compiling Linux Kernel - Quiz

You can now approach kernel changes as a controlled sequence: establish the need, configure deliberately, build reproducibly, install matching artifacts, and verify the boot and workload. Continue to the next module when you are comfortable explaining that sequence.

References


SEMrush Software 12 SEMrush Banner 12