mirror of
https://salsa.debian.org/kernel-team/kernel-handbook.git
synced 2026-01-16 23:12:12 +00:00
Instead of just <screen> and <literal>, use these elements as appropriate:
<command>
<computeroutput>
<envar>
<filename>
<lineannotation>
<literallayout>
<package>,
<prompt>
<symbol>
<userinput>
Also use <email> for the single email address.
78 lines
3.3 KiB
XML
78 lines
3.3 KiB
XML
<?xml version='1.0' encoding='utf-8'?>
|
|
<!-- -*- DocBook -*- -->
|
|
<chapter id="ch-initramfs">
|
|
<?dbhtml filename="ch-initramfs.html" ?>
|
|
<title>Managing the initial ramfs (initramfs) archive</title>
|
|
<para>
|
|
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 <command>init</command> script on the initramfs
|
|
loads modules and performs other neccessary initialization steps. At the end
|
|
of this stage <command>run-init</command> deletes the initramfs from memory,
|
|
mounts the real root filesystem and passes control to the
|
|
<command>/sbin/init</command> program on it.
|
|
</para>
|
|
<para>
|
|
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.
|
|
</para>
|
|
<section id="s-initramfs-gen-tools"><title>Initramfs generation tools</title>
|
|
<para>
|
|
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 generating an initramfs:
|
|
<command>update-initramfs</command> provided by
|
|
<package>initramfs-tools</package> (default) and
|
|
<command>dracut-update-initramfs</command> provided by the
|
|
<package>dracut</package> package (experimental).
|
|
</para>
|
|
</section>
|
|
|
|
<section id="s-initramfs-regen"><title>Regenerating the initramfs</title>
|
|
<para>
|
|
If changes are desired after the corresponding <package>linux-image</package>
|
|
has been installed, the initramfs needs to be regenerated. This is achieved by
|
|
the command
|
|
</para>
|
|
<screen>
|
|
<prompt>#</prompt> <userinput>dpkg-reconfigure linux-image-3.2.0-2-686-pae</userinput>
|
|
</screen>
|
|
<para>
|
|
where <package>linux-image-3.2.0-2-686-pae</package> is the name of the kernel
|
|
package for which the initramfs regeneration is requested.
|
|
</para>
|
|
</section>
|
|
|
|
<section id="s-initramfs-exam"><title>Examining the initramfs contents</title>
|
|
<para>
|
|
Occasionally it is useful to examine the contents of initramfs to diagnose a
|
|
problem or for educational purposes. They are compressed
|
|
<literal>cpio</literal> archives, which may be extracted using the command
|
|
</para>
|
|
<screen>
|
|
<prompt>$</prompt> <userinput>zcat /boot/initrd.img-3.2.0-2-686-pae | cpio -i</userinput>
|
|
</screen>
|
|
<para>
|
|
It will unpack the contents of the initramfs into the current directory.
|
|
</para>
|
|
<para>
|
|
It is also possible to list the contents of an initramfs using the
|
|
<command>cpio</command> <option>-t</option> option or the command
|
|
</para>
|
|
<screen>
|
|
<prompt>$</prompt> <userinput>lsinitramfs /boot/initrd.img-3.2.0-2-686-pae</userinput>
|
|
</screen>
|
|
</section>
|
|
|
|
</chapter>
|
|
|