mkinitrd - make an initrd image
mkinitrd [-k] [-d confdir] [-m command] -o outfile [-r root] [version]
mkinitrd [--supported-host-version= hversion] [--supported-target-ver
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 for the specified kernel version
will be placed in the directory structure. If version is omitted, it
defaults to the version of the kernel that is currently running.
The second syntax returns 0 if mkinitrd can create a ramdisk running on
a kernel of the given host version ( hversion ) and for a kernel of the
given target version ( tversions ), and 2 otherwise.
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). If there are scripts in
/usr/share/initrd-tools/scripts, they will be run prior to the scripts
You can also specify modules to load by putting them in confdir/mod
ules, 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 oth
ers if ROOT is not null) will be loaded, followed by any actions gener
ated when ROOT is not null. Finally any scripts or executables in
/scripts will be run in alphabetical order.
If the directory /lib/modules/version/initrd exists, the modules in it
will be included on the initrd image. They will be loaded at boot
By default mkinitrd looks for its configuration files in
/etc/mkinitrd. Use this option to override that.
-k Do not delete the temporary working directory that mkinitrd
uses. This is useful for debugging.
This option overrides the setting of MKIMAGE in mkinitrd.conf.
This option causes mkinitrd to write the image to outfile.
This option overrides the setting of ROOT in mkinitrd.conf.
This option queries if mkinitrd can create ramdisks on a running
kernel of version hversion.
This option queries if mkinitrd can create ramdisks for kernel
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 sys
tem 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 matching the run-parts(8) naming con
vention are run just before the image is generated from. INI
TRDDIR, MODULEDIR and VERSION are available to the scripts.
They contain the path to the initrd directory structure under
construction, the value of /lib/modules/version, and the value
of version respectively.
If this file exists, it will be appended to the initrd in a way
that causes it to be loaded by ACPI.
By default mkinitrd will generate a CRAMFS image. You can generate an
initrd image of another type by changing the MKIMAGE setting in mkini
If both mdadm(8) and raidtools2 are installed, the former is preferred.
At the moment, mkinitrd uses the -D option of mdadm(8) to discover the
constituent devices. This means that only devices that are part of the
array at the time that mkinitrd is run will be used later on. This
problem does not exist when raidtools2 is used.
Because lvm10 and lvm2 cannot coexist currently, we do not support gen
erating an initrd image for lvm10 while the system is running lvm2.
The converse is supported.
Shell scripts may be placed in /usr/share/initrd-tools/probe.d to add
new methods for probing root devices. These scripts will be sourced
when mkinitrd runs. They should define a shell function that assigns
the value 1 to the variable ok if and only if it is able to handle the
device given to it. The function will be called with the major and
minor numbers of the device in decimal form. The script should call
the function register_probe with the name of that function. These
scripts must defer any real work to scripts in /usr/share/initrd-
tools/scripts so that they do not interfere with mkinitrd itself.
mkcramfs(8), mkinitrd.conf(5), run-parts(8)
Initrd Tools $Date: 2004/04/08 11:27:00 $ MKINITRD(8)