qubes-installer-qubes-os/anaconda/dracut
Marek Marczykowski-Górecki b024e93e40 lorax: remove network support from UEFI initrd
Reduce its size to have efiboot.img under 32MB.
This needs rebuilding initrd and we need kernel version for that - so pass it
down from x86.tmpl.
2015-09-25 16:24:53 +02:00
..
anaconda-copy-cmdline.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
anaconda-copy-ks.sh anaconda: import unmodified 18.37.11 version from fc18 2013-01-24 01:45:53 +01:00
anaconda-depmod.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
anaconda-diskroot Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
anaconda-ks-sendheaders.sh anaconda: import unmodified 18.37.11 version from fc18 2013-01-24 01:45:53 +01:00
anaconda-lib.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
anaconda-modprobe.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
anaconda-netroot.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
anaconda-pre-shutdown.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
driver-updates Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
driver-updates-net.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
driver-updates-net@.service Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
driver-updates.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
driver-updates@.service Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
fetch-driver-net.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
fetch-kickstart-disk Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
fetch-kickstart-net.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
fetch-updates-disk anaconda: import unmodified 18.37.11 version from fc18 2013-01-24 01:45:53 +01:00
kickstart-genrules.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
Makefile.am Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
Makefile.in anaconda: import unmodified 18.37.11 version from fc18 2013-01-24 01:45:53 +01:00
module-setup.sh lorax: remove network support from UEFI initrd 2015-09-25 16:24:53 +02:00
parse-anaconda-dd.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
parse-anaconda-kickstart.sh anaconda: import unmodified 18.37.11 version from fc18 2013-01-24 01:45:53 +01:00
parse-anaconda-net.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
parse-anaconda-options.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
parse-anaconda-repo.sh anaconda: import unmodified 18.37.11 version from fc18 2013-01-24 01:45:53 +01:00
parse-kickstart Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
python-deps Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
README anaconda: import unmodified 18.37.11 version from fc18 2013-01-24 01:45:53 +01:00
README-dd Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
repo-genrules.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
save-initramfs.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00
updates-genrules.sh Update anaconda to 20.25.16 2014-04-08 05:50:31 +02:00

SOME IMPORTANT NOTES ABOUT HOW DRACUT WORKS
===========================================
Will Woods <wwoods@redhat.com>
v1.0, August 2012
// vim: set syntax=asciidoc textwidth=78:



File locations / installation
-----------------------------

The files are installed into the initramfs according to the instructions in
`module-setup.sh`. So this line:

  inst_hook cmdline 25 "$moddir/parse-anaconda-options.sh"

means that the file `parse-anaconda-options.sh` will be installed at priority
`25` in the `cmdline` hook. In practice, this means that it will be located at

  /lib/dracut/hooks/cmdline/25-parse-anaconda-options.sh

inside the initramfs.



Hooks and script ordering
-------------------------

The hooks run in the following order:

cmdline::
    This is where you parse (and _only_ parse) the boot commandline. Just
    set up config files and do sanity checks; the real action is later.

pre-udev::
    This is where you write out udev rules (before udev starts).

pre-trigger::
    At this point udev is running but *kernel modules haven't been loaded*.
    If you need to set udev environment variables, set them here.

initqueue::
    This is the mainloop, where initramfs tries to find/fetch rootfs.
    Scripts in this hook will run _repeatedly_ until finished or timeout (see
    below). Runs at 0.5-second intervals.

initqueue/settled::
    This part of the mainloop only runs once _udev is settled_, i.e. once all
    devices have been found.

initqueue/online::
    This hook runs _every time a network device goes online_.

initqueue/finished::
    If all the scripts here return success dracut exits the mainloop, _even if
    some initqueue scripts have not yet run_.
    To put it another way, if you want dracut to wait for something to happen,
    you need a script in `initqueue/finished` that returns non-zero _until_
    the thing you're waiting for happens.

pre-mount::
    Runs _once_ before trying to mount rootfs.

mount::
    Each script in this hook runs in order, until one of them mounts rootfs at
    `$NEWROOT`. May run multiple times.

pre-pivot::
    This is where you (e.g.) copy files into `$NEWROOT` before switching over.

cleanup::
    Clean up after your other hooks.

The scripts _within_ each hook run according to the numeric priority given in
the `inst_hook` lines in `module-setup.sh`.



Variables, scope, sharing data between scripts
----------------------------------------------

Each script in a hook gets sourced by the same `bash` interpreter. If you
define a function or variable in a script, each subsequent script _in the same
hook_ can see and use it, but *it won't be visible to other hooks.*

If you export a variable, it will be available to all subsequent scripts. You
can, of course, also share data by writing files to `/tmp`.

*NOTE:* You can break _other_ modules by accidentally overwriting their
variables. Avoid the following variable names in your own code.

Exported Variables
~~~~~~~~~~~~~~~~~~

==== Special dracut variables ====
$root:: The root device. Must be set by the end of the `cmdline` hook.
        Might not actually be a device (e.g. "nfs").
$rflags:: Mount flags for the root device.
$fstype:: The fstype of the root filesystem. Usually `auto`.
$netroot:: The network root location. Syntax depends on type of network root.

==== Read-only dracut variables ====
$NEWROOT:: Mountpoint for the root filesystem. Usually `/sysroot`.
$hookdir:: Location of the dracut hooks. Usually `/lib/dracut/hooks`.
$RDRETRY:: Number of loops to try before giving up. Usually *60* (=30 seconds).
$main_loop:: Counter for the current mainloop iteration.
$DRACUT_QUIET:: Whether dracut should operate quietly; `yes` or `no`.
                (Don't worry about this; just use `info()` or `warn()` instead)
$UDEVVERSION:: Self-explanatory.

==== Variables from other modules ====
$resume, $splash:: Used by `95resume`.
$CURL_HOME:: Exported by `45url-lib`.

==== Anaconda ====
$kickstart:: Anaconda-style URL for the kickstart.
$anac_updates:: Anaconda-style URL for `updates.img`.
$ksdevice:: Network device to use for fetching kickstart/stage2/etc.



Further Reading
---------------
Dracut documentation:
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html

My other set of dracut notes:
http://wwoods.fedorapeople.org/doc/dracut-notes.html