Help with Linux Kernel Compile

The Linux kernel is the part of the operating system that communicates between applications, devices and computer components, such as the CPU or memory. Most Linux users won’t need to compile a kernel, but compiling a custom kernel can free system resources, since many kernels installed by distributions contain information and drivers for many types of hardware. But compiling your own kernel is complicated, and a mistake can make your computer not boot. Preventing common mistakes increases your chances of successfully compiling a custom kernel.

  1. Meet Dependencies

    • Do your homework before compiling a new kernel. Like any piece of software, new kernels have dependencies that must be met. These are listed in the Documentation directory of the kernel source directory in the “Changes” file. If you’re compiling a kernel a few patches away from your current one, there probably won’t be much to upgrade. But if you’re moving up a major revision, you will need to upgrade much of your distribution before compiling a new kernel. Read the “README” in the top level of the kernel source directory, as well, since it contains important information specific to the kernel you’re building.

    Old Kernel and Modules

    • Until you know that your new kernel works, keep your old kernel and modules on your computer. Having a working kernel as a reserve also means that you can recover, in case your new kernel won’t boot. Modern hard drives are large and kernels are comparatively small, so there’s no need to delete an old kernel. Also, keep the old kernel source on your hard drive. When configuring the new kernel, select “Automatically Append Version Information” under “General Setup,” and the old modules won’t be overwritten by the new ones.

    Using the Old Configuration

    • If you have a working kernel, use the old configuration as a basis for the new one. These configurations are usually stored in “/boot.” To use the old configuration, use the command “make oldconfig” in the new source directory. This will take your old configurations and apply them to the new source. Using an old configuration means you’re less likely to forget something important. Remember that some things, such as ext3 and other file systems, should be built into the kernel, rather than compiled as modules. When choosing things to include into your kernel, the default choices are designed to be safe.

    Recovering

    • If something should go wrong, be sure to have a working boot disk. This will allow you to boot safely and fix what went wrong. If you didn’t keep your old modules around, in the old source directory, execute “make modules” and “make modules_install.” These commands will also work in the new source, if you forgot to build your new kernel’s modules. If both the old and new kernel’s configurations are irrevocably changed, your only option might be to reinstall the system software. Always back up your computer before booting a new kernel.

Related Searches:

References

Resources

Comments

Related Ads

Featured