]> git.ipfire.org Git - thirdparty/dracut.git/blob - README.modules
dracut.spec: version for module-init-tools requirement
[thirdparty/dracut.git] / README.modules
1 Most of the functionality that dracut implements are actually implemented
2 by dracut modules. Dracut modules live in modules.d, and have the following
3 structure:
4
5 dracut_install_dir/modules.d/
6 00modname/
7 install
8 check
9 <other files as needed by the hook>
10
11 00modname: The name of the module prefixed by a two-digit numeric sort code.
12 The numeric code must be present and in the range of 00 - 99.
13 Modules with lower numbers are installed first. This is important
14 because the dracut install functions (which install files onto
15 the initrd) refuse to overwrite already installed files. This makes
16 it easy for an earlier module to override the functionality of a
17 later module, so that you can have a distro or system specific
18 module override or modify the functionality of a generic module
19 without having to patch the more generic module.
20
21 install: dracut sources this script to install the functionality that a
22 module implements onto the initrd. For the most part, this amounts
23 to copying files from the host system onto the initrd in a controlled
24 manner. dracut supplies several install functions that are
25 specialized for different file types. Browse through dracut-functions
26 fore more details. dracut also provides a $moddir variable if you
27 need to install a file from the module directory, such as an initrd
28 hook, a udev rule, or a specialized executable.
29
30 check: Dracut calls this program to check and see if a module can be installed
31 on the initrd.
32
33 When called without options, check should check to make sure that
34 any files it needs to install into the initrd from the host system
35 are present. It should exit with a 0 if they are, and a 1 if they are
36 not.
37
38 When called with -H, it should perform the same check that it would
39 without any options, and it should also check to see if the
40 functionality the module implements is being used on the host system.
41 For example, if this module handles installing support for LUKS
42 encrypted volumes, it should return 0 if all the tools to handle
43 encrpted volumes are available and the host system has the root
44 partition on an encrypted volume, 1 otherwise.
45
46 Check may take additional options in the future.
47 We will most likely grow a module dependency checking system in the
48 near future, and check will need to handle a -d option when we do.
49
50 Any other files in the module will not be touched by dracut directly.
51
52 You are encouraged to provide a README that describes what the module is for.
53
54
55 HOOKS
56 =====
57
58 init has the following hook points to inject scripts:
59
60 /cmdline/*.sh
61 scripts for command line parsing
62
63 /pre-udev/*.sh
64 scripts to run before udev is started
65
66 /pre-trigger/*.sh
67 scripts to run before the main udev trigger is pulled
68
69 /initqueue/*.sh
70 runs in parallel to the udev trigger
71 Udev events can add scripts here with /sbin/initqueue.
72 If /sbin/initqueue is called with the "--onetime" option, the script
73 will be removed after it was run.
74 If /initqueue/work is created and udev >= 143 then this loop can
75 process the jobs in parallel to the udevtrigger.
76 If the udev queue is empty and no root device is found or no root
77 filesystem was mounted, the user will be dropped to a shell after
78 a timeout.
79 Scripts can remove themselves from the initqueue by "rm $job".
80
81 /pre-mount/*.sh
82 scripts to run before the root filesystem is mounted
83 Network filesystems like NFS that do not use device files are an
84 exception. Root can be mounted already at this point.
85
86 /mount/*.sh
87 scripts to mount the root filesystem
88 If the udev queue is empty and no root device is found or no root
89 filesystem was mounted, the user will be dropped to a shell after
90 a timeout.
91
92 /pre-pivot/*.sh
93 scripts to run before the real init is executed and the initramfs
94 disappears
95 All processes started before should be killed here.
96