summaryrefslogtreecommitdiff
path: root/patches/source/mkinitrd/mkinitrd.8
blob: 64dad3f43cbb45f9666e9ce39c968d17d7c5ea01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
.\" -*- nroff -*-
.ds g \" empty
.ds G \" empty
.\" Like TP, but if specified indent is more than half
.\" the current line-length - indent, use the default indent.
.de Tp
.ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
.el .TP "\\$1"
..
.TH MKINITRD 8 "27 March 2010" "Slackware Version 13.1"
.SH NAME
mkinitrd \- create or rebuilt an initrd (initial ramdisk) using initramfs (simple cpio+gzip).
.SH SYNOPSIS
.B mkinitrd
[
.B \-F
]
[
.B \-c
]
[
.B \-f filesystem
]
[
.B \-h hibernate_partition
]
[
.B \-k kernel_version
]
[
.B \-m module1:module2:module3...
]
[
.B \-o output_file
]
[
.B \-r root_device
]
[
.B \-s source_tree
]
[
.B \-u
]
[
.B \-w wait_time
]
[
.B \-C device1:device2:device3...
]
[
.B \-K luks_keyfile
]
[
.B \-P microcode_archive
]
[
.B \-B
]
[
.B \-L
]
[
.B \-R
]
[
.B \-V
]
.SH DESCRIPTION
.B mkinitrd
is used to build an initial ramdisk.  An initial ramdisk is a very small
set of files that are loaded into RAM and "mounted" (as initramfs doesn't
actually use a filesystem) as the kernel boots (before the main root
filesystem is mounted).  The usual reason to use an initrd is because
you need to load kernel modules before mounting the root partition.
Usually these modules are required to support the filesystem used by the
root partition (ext3, reiserfs, xfs), or perhaps the controller that the
hard drive is attached to (SCSI, RAID, etc).  Essentially, there are so many
different options available in modern Linux kernels that it isn't practical
to try to ship many different kernels to try to cover everyone's needs.
It's a lot more flexible to ship a generic kernel and a set of kernel
modules for it.
.SH OPTIONS
.TP
.B \-F
Use the contents of /etc/mkinitrd.conf as options to mkinitrd (optional).
If this is used in conjunction with any other options passed on the command 
line, the command-line options will override the config file options.  
.br
See mkinitrd.conf(5) for details.
.TP
.B \-c
Clear the existing initrd tree (by default in /boot/initrd-tree/) first.
If this is not done, running mkinitrd will add additional modules to the
existing initrd.
.TP
.B \-f filesystem
Specify the filesystem to use for the root partition.  If this isn't given,
mount will usually figure it out.  This option must be used together with the
\-r option in order to be beneficial.
.TP
.B \--help
Display a help summary.
.TP
.B \-h hibernate_partition
Specify the swap partition holding the hibernation image.
.TP
.B \-k kernel version
Use kernel modules from the specified kernel version.  mkinitrd will look
for them in /lib/modules/(kernel version).
.TP
.B \-l keymap
Load an alternative keyboard mapping. All supported keyboard mappings
can be found in /usr/share/mkinitrd/keymaps.tar.gz
Leave the '.bmap' out when you supply this parameter. E.g. '-l nl' will 
add support for dutch keyboard mapping to the initrd.
.TP
.B \-m module list
This is a list of colon-delimited modules to build into the initrd.
Any dependencies of requested modules will also be added to the initrd.
Additional options may be added to use when loading the kernel modules
(but in this case the entire list must be wrapped with double quotes). 
.TP
.B \-o output image
The file to write the initrd to.  (default: /boot/initrd.gz)
.TP
.B \-r root partition
Specify the device to be used as the root partition.  If this isn't given, the
kernel default will be used (which is usually fine).  This option must be used
together with the \-f option in order to be beneficial.
.TP
.B \-s source tree
The directory to use as the source for the initrd.  (default: /boot/initrd-tree/)
.TP
.B \-u
Include udev in the initrd.
.TP
.B \-w
The -w option specifies how long to wait in seconds before assuming that all the
drives are spun up and ready to go.
.TP
.B \-C device list
A colon (:) delimited list of luks encrypted block devices to be unlocked by
the initrd using cryptsetup.  All devices that must be unlocked in order to
access the root filesystem must be specified. e.g.

  -C /dev/sda2:/dev/sda3

Each unlocked device will be assigned an automatically generated luks device
name of the form luks<device> where '<device>' will be the basename of the
encrypted device.  e.g.

  /dev/mapper/lukssda2

As a convenience to users, where -r specifies one of the device names listed
on the -C option it will be automatically adjusted to use the correct luks
device name. i.e.

  "-C /dev/sda2 -r /dev/sda2" and
  "-C /dev/sda2 -r /dev/mapper/lukssda2"

are equivalent.
.br
(Use with '-r' option).
.TP
.B \-K luks_keyfile
When using cryptsetup to encrypt your partition, you can use a keyfile instead
of a passphrase to unlock the LUKS volume.  The LUKSKEY variable holds the
filename of a keyfile, as well as the label (or uuid) of the partition this
file is on.  This way, you can unlock your computer automatically if you have a
USB stick with your LUKS key inserted at boot. A passphrase will still be asked
if the LUKS key can not be found.
.br
For example, if your USB thumb drive has a FAT partition with label
"TRAVELSTICK" and the actual keyfile is called "/keys/alien.luks", then
you need to set:

  -K LABEL=TRAVELSTICK:/keys/alien.luks
.TP
.B \-T device list
A colon (:) delimited list of luks encrypted block devices to be passed the
"--allow-discards" option when unlocked by the initrd using cryptsetup, e.g.

  -T /dev/sda2:/dev/sda4

This has the effect of allowing TRIM on SSD drives. Be sure your SSD supports 
this feature (correctly) before enabling it.  See fstrim(8) for more information.
.TP
.B \-P microcode_archive
This option specifies a cpio archive containing updated microcode for your CPU.
CPU manufacturers occasionally release such updates to fix bugs in the microcode
currently embedded in the CPU. The microcode archive will be prepended to the
output initrd, where the kernel will find it for early patching:

  -P /boot/intel-ucode.cpio

.TP
.B \-B
This option adds the btrfs utility to the initrd so that multi-device filesystems
will be picked up by a scan (/sbin/btrfs device scan).  This is needed if the
root filesystem is a Btrfs multi-device filesystem.
.TP
.B \-L
This option adds LVM support to the initrd, if the tools are
available on the system.
.TP
.B \-R
This option adds RAID support to the initrd, if a static mdadm binary is
available on the system.
.TP
.B \-V
Display version information and exit.
.SH EXAMPLES
A simple example:  Build an initrd for a reiserfs root partition:

  mkinitrd -c -m reiserfs

Another example:  Build an initrd image using Linux 2.6.33.1 kernel
modules for a system with an ext3 root partition on /dev/sdb3:

  mkinitrd -c -k 2.6.33.1 -m ext3 -f ext3 -r /dev/sdb3

An example of a single encrypted partition setup:
.br
As a user convenience, the value for the "-r" option may also be specified as
"/dev/sda2" in this example:

  mkinitrd -c -k 2.6.33.1 \\
           -m ext4:ehci-hcd:uhci-hcd:usbhid \\
           -f ext4 -r /dev/mapper/lukssda2 \\
           -C /dev/sda2 \\
           -l uk

Finally, A more complex example:
.br
This one is for a LVM Volume Group (rootvg) comprising of two LVM Physical
Volumes, each of which is on a LUKS encrypted partition that will need to be
unlocked before the root filesystem (/dev/rootvg/lvroot) can be accessed.

  mkinitrd -c -k 2.6.29.6 \\
           -m ext4:ehci-hcd:uhci-hcd:usbhid \\
           -f ext4 -r /dev/rootvg/lvroot \\
           -L -C /dev/sda2:/dev/sdb2 \\
           -l uk

If run without options, mkinitrd will rebuild an initrd image using
the contents of the $SOURCE_TREE directory, or, if that directory
does not exist it will be created and populated, and then mkinitrd
will exit.  These options are handy for building an initrd mostly
by hand.  After creating /boot/initrd-tree/, you can add modules and
edit files by hand, and then rerun mkinitrd to create the initrd.

Once the initrd is created, you'll need to tell your boot loader
to load it.  If you boot with LILO, you will need to add an initrd
line to /etc/lilo.conf.  Here's a section of lilo.conf that shows
how to set this up:

 # Linux bootable partition config begins
 image = /boot/vmlinuz-generic-2.6.33.1
   initrd = /boot/initrd.gz
   root = /dev/sda3
   label = Linux26331
   read-only
 # Linux bootable partition config ends

Note that the line "root = /dev/sda3" is not needed if the root device
has been configured in the initrd image.

Once you've created the initrd and editing /etc/lilo.conf, you will
need to run 'lilo' to write out the changed boot block.  The next
time you reboot the initrd should be loaded along with the kernel.

Have fun!

.SH SEE ALSO
mkinitrd.conf (5)

.SH AUTHOR
Patrick J. Volkerding <volkerdi@slackware.com>