Harald Hoyer f8c4a0
From 89f7217954231dc11307cc481f1e3ca8ad3ad001 Mon Sep 17 00:00:00 2001
Harald Hoyer f8c4a0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer f8c4a0
Date: Mon, 5 Aug 2013 11:22:55 +0200
Harald Hoyer f8c4a0
Subject: [PATCH] dracut.asc: small corrections
Harald Hoyer f8c4a0
Harald Hoyer f8c4a0
---
Harald Hoyer f8c4a0
 dracut.asc | 75 ++++++++++++++------------------------------------------------
Harald Hoyer f8c4a0
 1 file changed, 16 insertions(+), 59 deletions(-)
Harald Hoyer f8c4a0
Harald Hoyer f8c4a0
diff --git a/dracut.asc b/dracut.asc
Harald Hoyer f8c4a0
index 4de3dbf..dfad67e 100644
Harald Hoyer f8c4a0
--- a/dracut.asc
Harald Hoyer f8c4a0
+++ b/dracut.asc
Harald Hoyer f8c4a0
@@ -777,25 +777,12 @@ scripts and udev rules.
Harald Hoyer f8c4a0
 [[stages]]
Harald Hoyer f8c4a0
 == Boot Process Stages
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-The init script in _99base_ is the main script, which prepares the root file
Harald Hoyer f8c4a0
-system for usage, runs udev, mounts the real root device, kills the remaining
Harald Hoyer f8c4a0
-processes, and switches to the real root device for further booting. dracut
Harald Hoyer f8c4a0
-modules can insert custom script at various points, to control the boot process.
Harald Hoyer f8c4a0
+dracut modules can insert custom script at various points, to control the boot
Harald Hoyer f8c4a0
+process.
Harald Hoyer f8c4a0
 These hooks are plain directories containing shell scripts ending with ".sh",
Harald Hoyer f8c4a0
 which are sourced by init.
Harald Hoyer f8c4a0
 Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-=== Basic Setup
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-The first thing init does, is to mount _/proc_ and _/sys_ and manually create
Harald Hoyer f8c4a0
-the basic device nodes and symbolic links in _/dev_ needed to execute basic
Harald Hoyer f8c4a0
-commands. Then logging is setup according to kernel command line arguments.
Harald Hoyer f8c4a0
-_/dev/pts_ and _/dev/shm_ are mounted and the first hook is sourced.
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 === Hook: cmdline
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 The _cmdline_ hook is a place to insert scripts to parse the kernel command line
Harald Hoyer f8c4a0
@@ -813,63 +800,49 @@ This hook is executed right after the cmdline hook and a check if root and
Harald Hoyer f8c4a0
 rootok were set. Here modules can take action with the final root, and before
Harald Hoyer f8c4a0
 udev has been run.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 === Start Udev
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 Now udev is started and the logging for udev is setup.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 === Hook: pre-trigger
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 In this hook, you can set udev environment variables with **udevadm control
Harald Hoyer f8c4a0
 --property=KEY=_value_** or control the further execution of udev with
Harald Hoyer f8c4a0
 udevadm.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 === Trigger Udev
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 udev is triggered by calling udevadm trigger, which sends add events for all
Harald Hoyer f8c4a0
 devices and subsystems.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 === Main Loop
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-Now the main loop of 99base/init begins. Here we loop until udev has settled and
Harald Hoyer f8c4a0
-all scripts in _initqueue/finished_ returned true. In this loop there are three
Harald Hoyer f8c4a0
-hooks, where scripts can be inserted by calling /sbin/initqueue. 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
+In the main loop of dracut loops until udev has settled and
Harald Hoyer f8c4a0
+all scripts in _initqueue/finished_ returned true.
Harald Hoyer f8c4a0
+In this loop there are three hooks, where scripts can be inserted
Harald Hoyer f8c4a0
+by calling /sbin/initqueue.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 ==== Initqueue
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 This hook gets executed every time a script is inserted here, regardless of the
Harald Hoyer f8c4a0
 udev state.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 ==== Initqueue settled
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-This hooks gets executed every time udev has settled.
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
+This hooks (initqueue/settled) gets executed every time udev has settled.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 ==== Initqueue timeout
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-This hooks gets executed, when the main loop counter becomes half of the
Harald Hoyer f8c4a0
+This hooks (initqueue/timeout) gets executed, when the main loop counter becomes half of the
Harald Hoyer f8c4a0
 rd.retry counter.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 ==== Initqueue finished
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-This hook is called after udev has settled and if all scripts herein return 0
Harald Hoyer f8c4a0
-the main loop will be ended.
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
+This hook (initqueue/finished) is called after udev has settled and
Harald Hoyer f8c4a0
+if all scripts herein return 0 the main loop will be ended.
Harald Hoyer f8c4a0
+Abritary scripts can be added here, to loop in the
Harald Hoyer f8c4a0
+initqueue until something happens, which a dracut module wants to wait for.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 === Hook: pre-mount
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
@@ -877,20 +850,15 @@ Before the root device is mounted all scripts in the hook pre-mount are
Harald Hoyer f8c4a0
 executed. In some cases (e.g. NFS) the real root device is already mounted,
Harald Hoyer f8c4a0
 though.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 === Hook: mount
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 This hook is mainly to mount the real root device.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 === Hook: pre-pivot
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 This hook is called before cleanup hook, This is a good place for
Harald Hoyer f8c4a0
 actions other than cleanups which need to be called before pivot.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 === Hook: cleanup
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 This hook is the last hook and is called before init finally switches root to
Harald Hoyer f8c4a0
@@ -900,21 +868,18 @@ needed anymore.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 === Cleanup and switch_root
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-Init kills all udev processes, cleans up the environment, sets up the arguments
Harald Hoyer f8c4a0
-for the real init process and finally calls switch_root. switch_root removes the
Harald Hoyer f8c4a0
-whole filesystem hierarchy of the initramfs, chroot()s to the real root device
Harald Hoyer f8c4a0
-and calls /sbin/init with the specified arguments.
Harald Hoyer f8c4a0
+Init (or systemd) kills all udev processes, cleans up the environment,
Harald Hoyer f8c4a0
+sets up the arguments for the real init process and finally calls switch_root.
Harald Hoyer f8c4a0
+switch_root removes the whole filesystem hierarchy of the initramfs,
Harald Hoyer f8c4a0
+chroot()s to the real root device and calls /sbin/init with the specified arguments.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 To ensure all files in the initramfs hierarchy can be removed, all processes
Harald Hoyer f8c4a0
 still running from the initramfs should not have any open file descriptors left.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 == Network Infrastructure
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 FIXME
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 == Writing a Module
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 A simple example module is _96insmodpost_, which modprobes a kernel module after
Harald Hoyer f8c4a0
@@ -926,8 +891,6 @@ First we create a check() function, which just exits with 0 indicating that this
Harald Hoyer f8c4a0
 module should be included by default.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 check():
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 ----
Harald Hoyer f8c4a0
 return 0
Harald Hoyer f8c4a0
 ----
Harald Hoyer f8c4a0
@@ -937,8 +900,6 @@ priority number 20 called _parse-insmodpost.sh_. It also installs the
Harald Hoyer f8c4a0
 _insmodpost.sh_ script in _/sbin_.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 install():
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 ----
Harald Hoyer f8c4a0
 inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
Harald Hoyer f8c4a0
 inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
Harald Hoyer f8c4a0
@@ -949,8 +910,6 @@ rd.driver.post, blacklists the module from being autoloaded and installs the
Harald Hoyer f8c4a0
 hook _insmodpost.sh_ in the _initqueue/settled_.
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 _parse-insmodpost.sh_:
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 ----
Harald Hoyer f8c4a0
 for p in $(getargs rd.driver.post=); do
Harald Hoyer f8c4a0
     echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
Harald Hoyer f8c4a0
@@ -967,8 +926,6 @@ modprobe the kernel modules specified in all rd.driver.post kernel command line
Harald Hoyer f8c4a0
 parameters. It runs after udev has settled and is only called once (--onetime).
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 _insmodpost.sh_:
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 ----
Harald Hoyer f8c4a0
 . /lib/dracut-lib.sh
Harald Hoyer f8c4a0