Compiling Kernel   «Prev 

As a Red Hat Linux Administrator tasked with building and installing the kernel and modules in Red Hat Linux 7.7, you'll need to keep several important considerations in mind. This is an advanced task that requires a deep understanding of Linux, knowledge of hardware, and the implications of the changes being made. Missteps during this process can result in system instability or render the system unbootable.
  1. Hardware Compatibility: Before proceeding, ensure that the kernel you're planning to build supports all the hardware components used by your system. Check hardware compatibility lists and kernel documentation.
  2. Software Compatibility: Software running on your system may have specific kernel dependencies. Make sure to verify the compatibility of your applications with the kernel version you're building.
  3. Kernel Configuration: The kernel configuration file determines what features are included in your custom kernel. You need to understand these options and configure them appropriately. You can start from the existing configuration file (/boot/config-$(uname -r)) and modify it to suit your needs.
  4. Building Process: Building a custom kernel is a resource-intensive task. Make sure your system has enough memory and processing power to handle the build process.
  5. Backup: Always keep a backup of your current working kernel and configuration. In the event of a failure with your new kernel, you'll need a way to restore the system to a working state.
  6. Testing: Once the kernel is built and installed, you'll need to reboot the system to use the new kernel. This can be risky if the system is serving production traffic. Consider testing your custom kernel on a non-production system first.
  7. Documentation: Keep detailed notes and documentation on the changes you make. This will be helpful when troubleshooting and also in the future when you might need to replicate or reverse the process.
  8. Troubleshooting: Be prepared for problems and have a strategy in place to troubleshoot. Common tools include boot logs, dmesg, and the system logs.
  9. Updates and Maintenance: Custom kernels won't receive updates from your distribution's package manager. You'll need to manage updates manually. Keep in mind the impact this might have on your system's security and stability
  10. Grub Configuration: Be cautious while configuring GRUB (GRand Unified Bootloader). A misconfiguration can prevent the system from booting.

Here's a general guideline for the process:
  1. Install the necessary packages to build the kernel (gcc, make, ncurses-dev, bison, flex, libssl-dev).
  2. Download the source code for the kernel you want to build.
  3. Extract the source code and navigate to the directory.
  4. Configure the kernel features (using 'make menuconfig' or similar).
  5. Build the kernel and modules.
  6. Install the new kernel and modules.
  7. Update the bootloader to include the new kernel.
  8. Reboot and select the new kernel from the bootloader.

Building and Installing the Kernel and Modules

1) Linux compiles the kernel source code
1) When you type this command, Linux compiles the kernel source code. Because you configured and created the dependencies, the new kernel will incorporate your preferences automatically into the build. The more monolithic your kernel is, the longer this command will take to execute.

2) building modules is a separate step from building the kernel
2) Because building modules is a separate step from building the kernel, you must perform a make modules now. The more modular your kernel, the longer this command will take to execute.

3) copy the kernel and system map into the /boot partition
3) Once the kernel is built, you need to copy the kernel and system map into the /boot partition. In this example, we are copying our 2.2.14 kernel, extra version 686v1.

4) make modules_install places the newly compiled modules into the /lib/modules directory hierarchy
4) Finally, make modules_install places the newly compiled modules into the /lib/modules directory hierarchy. Your new Linux kernel will load these modules when you reboot the system.

Red Hat Enterprise Linux