man mkinitrd (Administration système) - make an initrd image

NAME

mkinitrd - make an initrd image

SYNOPSIS

mkinitrd [-k] [-d confdir] [-m command] -o outfile [-r root] [version]

mkinitrd [--supported-host-version= hversion] [--supported-target-version= tversion]

DESCRIPTION

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 in confdir.

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.

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 time.

OPTIONS

-d confdir 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.
-m command This option overrides the setting of MKIMAGE in mkinitrd.conf.
-o outfile This option causes mkinitrd to write the image to outfile.
-r root This option overrides the setting of ROOT in mkinitrd.conf.
--supported-host-version=hversion This option queries if mkinitrd can create ramdisks on a running kernel of version hversion.
--supported-target-version=tversion This option queries if mkinitrd can create ramdisks for kernel version tversion.

FILES

/etc/mkinitrd/exe
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.
/etc/mkinitrd/files
This file contains full paths to files that should be included in the initrd image.
/etc/mkinitrd/mkinitrd.conf
The default configuration file for the script.
/etc/mkinitrd/modules
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.
/etc/mkinitrd/scripts
Scripts in this directory matching the run-parts(8) naming convention are run just before the image is generated from. INITRDDIR, 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.
/etc/mkinitrd/DSDT
If this file exists, it will be appended to the initrd in a way that causes it to be loaded by ACPI.

NOTES

By default mkinitrd will generate a CRAMFS image. You can generate an initrd image of another type by changing the MKIMAGE setting in mkinitrd.conf.

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 generating 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.

SEE ALSO

AUTHOR

Herbert Xu <herbert@debian.org>