mkinitfs
Create initial ramdisk (initrd) image
TLDR
Generate an initramfs with the features specified in /etc/mkinitfs/mkinitfs.conf
Use a different configuration file
Compress the initramfs using the specified compression algorithm (default: gzip)
List files that will be included in the initramfs image
List all available features
SYNOPSIS
mkinitfs [options] [image]
PARAMETERS
-k
Specify the kernel version for which to build the initrd.
-o
Specify the output image filename. If not specified, a default name is used.
-m
Specify kernel modules to include in the initrd. Can be a comma-separated list.
-f
Force overwrite the output file if it already exists.
-c
Specify the compression type for the initrd image (e.g., gzip, bzip2, lzma, xz). It is important to know that this parameter varies in syntax across distributions.
-A
Add all kernel modules to the initrd. Use with caution: may significantly increase image size.
DESCRIPTION
The `mkinitfs` command is a tool used to create an initial ramdisk (initrd) or initial RAM filesystem (initramfs) image. This image is a small, bootable filesystem that is loaded into memory by the bootloader before the main root filesystem is mounted. It contains essential files, device drivers, and scripts necessary to initialize the hardware, mount the root filesystem (which might be on a separate partition, LVM, or network location), and start the boot process. `mkinitfs` simplifies the process of creating these crucial boot images, often automating the inclusion of necessary kernel modules and configuration files based on the current system's hardware and setup. The resulting initrd/initramfs allows the kernel to access the root filesystem and proceed with the normal boot process, even if the root filesystem requires specific drivers or configurations not directly available in the kernel itself. Different distributions implement this command and it can vary in syntax, dependencies and functionalities. It is important to refer to your distribution's documentation for the most accurate information.
CAVEATS
The exact syntax and features of `mkinitfs` can vary significantly between different Linux distributions. Always consult your distribution's documentation for the most accurate and up-to-date information. Incorrect usage of `mkinitfs` can result in an unbootable system.
BOOT PROCESS INTEGRATION
The initrd/initramfs image created by `mkinitfs` is a crucial part of the Linux boot process.
It's loaded by the bootloader (e.g., GRUB or LILO) into memory. The kernel then executes the `init` script within the initrd/initramfs. This script is responsible for initializing the system sufficiently to mount the actual root filesystem. This often involves loading device drivers, setting up network connections, or performing other necessary initialization steps.
EXAMPLE USAGE
Simple example to create initrd: mkinitfs -o /boot/initrd.img
Example creating with specific kernel modules: mkinitfs -o /boot/initrd.img -m pata_amd,ext4
HISTORY
The concept of an initial ramdisk/ramfs has been around for a long time in Linux, evolving alongside the kernel and boot processes. Early versions were often more rudimentary, manually created, and focused primarily on mounting the root filesystem. As hardware and software complexities increased, the need for more automated and flexible tools became apparent. Tools like `mkinitfs`, `mkinitrd`, and `dracut` emerged to address these challenges, providing more robust and configurable ways to generate initrd/initramfs images. Over time, these tools have gained features like module autoloading, support for different compression algorithms, and integration with system configuration tools. The specific implementation of `mkinitfs` varies across distributions, each tailored to the particular distribution's needs and design choices.
SEE ALSO
dracut(8), mkinitrd(8), update-initramfs(8), init(8)