mkinitrd - make an initrd image


mkinitrd [__-k__? [__-d__ ''confdir''? [__-m__ ''command''? [__-o__ ''outfile''? [__-r__ ''root''? moduledir


The mkinitrd script constructs a directory structure that can serve as an initrd root file system. It then generates an image containing that directory structure using mkcramfs(8), which can be loaded using the initrd mechanism. The kernel modules placed in the directory structure will be taken from moduledir. This is usually of the form /lib/modules/your-kernel-version.

The directory structure can be customised by placing scripts into confdir/scripts. They will be run using run-parts(8) just before the directory is fed to mkcramfs(8). You can also specify modules to load by putting them in confdir/modules, whose format is identical to that of /etc/modules, which is described in __modules(5)?__.

When the system boots using an initrd image created by mkinitrd(8), the linuxrc will wait for an amount of time which is configured through mkinitrd.conf(5), during which it may be interrupted by pressing ENTER. After that, the modules specified in confdir/modules (and possibly others if ROOT is not null) will be loaded, followed by any actions generated when ROOT is not null. Finally any scripts or executables in /scripts will be run in alphabetical order.


-d confdir

By default mkinitrd looks for its configuration files in /etc/mkinitrd. Use this option to override that.


Do not delete the temporary working directory that mkinitrd uses. This is useful for debugging.

-m command

This option overrides the setting of MKIMAGE in mkinitrd.conf.

-o outfile

This option causes mkinitrd to write the image to outfile instead of the standard output.

-r root

This option overrides the setting of ROOT in mkinitrd.conf.



This file contains full paths to shared executables that should be included in the initrd image. mkinitrd will include them as well as any shared libraries that they are linked with.


This file contains full paths to files that should be included in the initrd image.


The default configuration file for the script.


All modules specified in this file will be loaded when the system boots using the generated image. However, they are not automatically included on the image. You will either have to use the appropriate MODULES setting, or copy them in using a script in /etc/mkinitrd/scripts.


Scripts in this directory are run just before the image is generated from.


mkcramfs(8), mkinitrd.conf(5)


Herbert Xu

This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.