[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ next ]
The booting in Debian is a two-stage process, involving the initial RAM filesystem (initramfs for short, sometimes it is also referred to as initrd, which stands for initial RAM disk). First, the bootloader loads the kernel and initramfs into memory, and passes the execution control to the kernel. After basic initialization the kernel extracts the initramfs archive and mounts it as a temporary root filesystem. initramfs contains kernel modules and userspace programs required to initialize the physical or logical device(s) containing the real root filesystem. The init script on the initramfs loads modules and performs other neccessary initialization steps. At the end of this stage run-init deletes the initramfs from memory, mounts the real root filesystem and passes control to the /sbin/init program on it.
Two major goals are achieved with such setup: the kernel size is kept under control by allowing most of the drivers to be compiled as modules (in a initramfs-less setup the drivers neccessary for the boot-time initialization of the root device must be compiled into it) and allow the setups which require initialization which cannot be done in-kernel, but is performed by userspace utilities.
Since initramfs usually needs to be customized for the particular
hardware/device configuration and kernel version, they are not included as a
part of any package, but are generated on the fly at kernel installation time.
Currently there are two tools in Debian, capable of creating an initramfs for
kernels 2.6.13 and newer: update-initramfs provided by
initramfs-tools (default) and mkinitrd.yaird provided
by the yaird package. The strategies these utilities use for
initramfs creation are quite different. initramfs-tools includes
most of the controller drivers, as well as the tools to do automatic hardware
detection from the initramfs during boot. yaird, on the other
hand, performs a scan of the machine configuration at the kernel installation
time and includes only the modules and programs which are required to
initialize the device containing the real root filesystem. The resulting
initramfs is typically a few times smaller than the one generated by
yaird, but it has less flexibility. For example, a disk
containing a kernel and initramfs generated by initramfs-tools may
be moved to another partition or machine and is likely to successfully boot
there (attached to a different disk controller, let's say), than the one
containing a yaird-generated initramfs. A detailed comparison of
the features of two package is available on the Debian Wiki
page InitrdReplacementOptions
.
You can also consult the manual pages of the individual tools by runnning the
commands man update-initramfs and man mkinitrd.yaird.
At the end of the kernel package installation a script is automatically invoked to determine the availability of the initramfs-generating tools and run one of them. This script contains the list of all such tools available in Debian. If the tool is installed (and the dependencies of the linux-image package ensure that at least one of them is installed), it will be queried (by running it with --supported-host-version and --supported-target-version) to determine whether it can be used to generate the initramfs for the new kernel version when running on a system with a current kernel version. The first tool which is found to satisfy the criteria is going to be invoked, generating the new initramfs image and placing it into /boot directory. See the documentation of the individual tools for the supported ranges of kernel versions.
The list of tools to be considered and the order in which they are tested may be controlled by placing a space-separated list of the executables into the ramdisk variable in /etc/kernel-img.conf.
The ramdisk setting mentioned above will only take effect when implemented before the kernel image installation. If the changes are desired after the corresponding linux-image has been installed, the initramfs needs to be regenerated. This is achieved by the command
# dpkg-reconfigure linux-image-2.6.18-3-686
where linux-image-2.6.18-3-686 is the name of the kernel package for which the initramfs regeneration is requested.
Occasionally it is useful to examine the contents of initramfs to diagnose a problem or for educational purposes. They are compressed cpio archives, which may be extracted using the command
$ zcat /boot/initrd.img-2.6.18-3-686 | cpio -i
It will unpack the contents of the initramfs into the current directory.
[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ next ]
Debian Linux Kernel Handbook
version 1.0.9, Tue Nov 23 17:56:29 GMT 2010