dracut.asc: small corrections

master
Harald Hoyer 2013-08-05 11:22:55 +02:00
parent 283c34fc2b
commit 89f7217954
1 changed files with 16 additions and 59 deletions

View File

@ -777,25 +777,12 @@ scripts and udev rules.
[[stages]]
== Boot Process Stages

The init script in _99base_ is the main script, which prepares the root file
system for usage, runs udev, mounts the real root device, kills the remaining
processes, and switches to the real root device for further booting. dracut
modules can insert custom script at various points, to control the boot process.
dracut modules can insert custom script at various points, to control the boot
process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.



=== Basic Setup

The first thing init does, is to mount _/proc_ and _/sys_ and manually create
the basic device nodes and symbolic links in _/dev_ needed to execute basic
commands. Then logging is setup according to kernel command line arguments.
_/dev/pts_ and _/dev/shm_ are mounted and the first hook is sourced.



=== Hook: cmdline

The _cmdline_ hook is a place to insert scripts to parse the kernel command line
@ -813,63 +800,49 @@ This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.



=== Start Udev

Now udev is started and the logging for udev is setup.



=== Hook: pre-trigger

In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.



=== Trigger Udev

udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.



=== Main Loop

Now the main loop of 99base/init begins. Here we loop until udev has settled and
all scripts in _initqueue/finished_ returned true. In this loop there are three
hooks, where scripts can be inserted by calling /sbin/initqueue.


In the main loop of dracut loops until udev has settled and
all scripts in _initqueue/finished_ returned true.
In this loop there are three hooks, where scripts can be inserted
by calling /sbin/initqueue.

==== Initqueue

This hook gets executed every time a script is inserted here, regardless of the
udev state.



==== Initqueue settled

This hooks gets executed every time udev has settled.

This hooks (initqueue/settled) gets executed every time udev has settled.


==== Initqueue timeout

This hooks gets executed, when the main loop counter becomes half of the
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes half of the
rd.retry counter.



==== Initqueue finished

This hook is called after udev has settled and if all scripts herein return 0
the main loop will be ended.


This hook (initqueue/finished) is called after udev has settled and
if all scripts herein return 0 the main loop will be ended.
Abritary scripts can be added here, to loop in the
initqueue until something happens, which a dracut module wants to wait for.

=== Hook: pre-mount

@ -877,20 +850,15 @@ Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.



=== Hook: mount

This hook is mainly to mount the real root device.



=== Hook: pre-pivot

This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.


=== Hook: cleanup

This hook is the last hook and is called before init finally switches root to
@ -900,21 +868,18 @@ needed anymore.

=== Cleanup and switch_root

Init kills all udev processes, cleans up the environment, sets up the arguments
for the real init process and finally calls switch_root. switch_root removes the
whole filesystem hierarchy of the initramfs, chroot()s to the real root device
and calls /sbin/init with the specified arguments.
Init (or systemd) kills all udev processes, cleans up the environment,
sets up the arguments for the real init process and finally calls switch_root.
switch_root removes the whole filesystem hierarchy of the initramfs,
chroot()s to the real root device and calls /sbin/init with the specified arguments.

To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.



== Network Infrastructure

FIXME


== Writing a Module

A simple example module is _96insmodpost_, which modprobes a kernel module after
@ -926,8 +891,6 @@ First we create a check() function, which just exits with 0 indicating that this
module should be included by default.

check():


----
return 0
----
@ -937,8 +900,6 @@ priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.

install():


----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
@ -949,8 +910,6 @@ rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.

_parse-insmodpost.sh_:


----
for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
@ -967,8 +926,6 @@ modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).

_insmodpost.sh_:


----
. /lib/dracut-lib.sh