The Linux kernel‘s open source nature lets everyday users modify it to their needs. Some users may need to add in driver support for a new piece of hardware, while others may want to strip out extraneous options.
How does the Linux kernel work?
Linux is a monolithic kernel, encompassing hardware drivers, file systems, system calls, and inter-process communications. Hardware and file systems essentially have super user access to the system. This can be modified by turning on and off internal options, as well as loading kernel modules which add additional driver support.
The Linux kernel file name begins with “vmlinuz,” showing it was compressed with Zlib and supports virtual memory. At the end of the file name will be a string of numbers showing the version and patches. For example, “3.0.0-12-generic” is Linux 3.0.0 version 12 with no patches. There will also be a file starting with “config” that lists which options should be enabled when the Linux kernel is compiled. Kernel module files end in “.ko,” and are typically stored in the /lib/modules directory.
Why would someone want to modify their system’s Linux kernel?
With Linux’s massive driver and platform support, there are bound to be several things enabled in the kernel by default that aren’t necessary for a particular system. Many distributions disable non-free drives by default, while brand new devices may not have had drivers added to the kernel yet. These can be enabled by patching.
How can the Linux kernel be patched?
Each distro will have its own idiosyncrasies when it comes to compiling a new kernel, but there are a few basic steps shared by all distributions:
- Download the Linux kernel source code
- Use a utility to tweak the settings of the config file. Nconfig and menuconfig are the most common, and are usually included with the kernel source code package.
- Compile the kernel
- Change the boot loader settings to use the newly-patched Linux kernel
If driver support is built into the kernel, how can video and printer drivers be enabled and disabled without recompiling?
Linux is based around the terminal, which only requires text output. Graphics are handled by an X Windows system, usually X.org or XFree86. When changing driver settings, it’s altering the configuration of X, not the kernel. Likewise, printer support is handled externally by CUPS.