If you’ve ever looked into recompiling your Linux kernel, you’ve probably seen advice to include critical boot drivers (for your hard disk controller and root partition’s filesystem) in the kernel itself. Omitting the boot drivers is likely to result in an inability to boot the computer. The kernel loads and begins doing some checks, but then stops because it can’t read the root filesystem.
The kernels provided by most Linux distributions, however, lack the drivers for most disk hardware. These same distributions can install and boot on all of this hardware, though. How is that possible? The answer is that the kernels use an initial RAM disk (initrd for short) to hold the relevant drivers as modules. When the computer boots, the boot loader passes the initrd to the kernel, which loads it into RAM and treats it like a disk. The kernel can then load modules stored in the RAM disk, keeping the kernel size small while still providing a wide variety of drivers.
When you compile your own kernel, it’s usually easier to bypass the initrd and instead build the relevant drivers into your main kernel file. Sometimes, though, you might want to build your own initrd. Let’s see how.
Why Use initrd?
The average desktop or server system running a custom kernel doesn’t need initrd. However, it can be useful in several situations:
*Most distributions use initrd because the distributions’ designers can’t predict what…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: