mkinitrd
This is an older tool used to manually create an initrd.img file necessary to load Linux drives prior to mounting the root file system. The basic syntax is:
mkinitrd [OPTIONS] <initrd-image> <kernel-version>This allows us to modify compression settings and other module options. For example, we can use the --preload option to ensure that specified modules are loaded early in the boot process, while --with=<module> explicitly adds a specific module to initrd.
Example
To generate a non-compressed image with the USB-storage module enabled and early ext4 support based on the 5.15.0 Linux kernel we might write the following:
mkinitrd --preload=ext4 --with=usb-storage -f --nocompress /boot/initrd-5.15.0.img 5.15.0
dracut
dracut is a mode modern initrd management tool that can automate the creating of RAM images as well as provide better dependency management. Part of the process is to use initramfs, which, unlike mkinitrd, dracut dynamically includes only the necessary drivers required for its build.