mkinitrd(8): Move the defaults to /etc/defaults/mkinitrd.conf.
[dragonfly.git] / sbin / mkinitrd / mkinitrd.8
1 .\"
2 .\" Copyright (c) 2010 The DragonFly Project.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\"
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in
12 .\"    the documentation and/or other materials provided with the
13 .\"    distribution.
14 .\" 3. Neither the name of The DragonFly Project nor the names of its
15 .\"    contributors may be used to endorse or promote products derived
16 .\"    from this software without specific, prior written permission.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
22 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
28 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .Dd December 12, 2011
32 .Dt MKINITRD 8
33 .Os
34 .Sh NAME
35 .Nm mkinitrd
36 .Nd build an initial ramdisk image for use as early userland
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl b Ar bootdir
40 .Op Fl t Ar tmpdir
41 .Sh DESCRIPTION
42 The
43 .Nm
44 script builds a ramdisk (md) image based on the UFS filesystem containing
45 only the most basic tools, such as a minimal
46 .Xr init 8 ,
47 .Xr sh 1
48 as well as many
49 .Xr mount 8
50 utilities.
51 .Pp
52 It will also copy the contents of
53 .Pa /usr/share/initrd
54 onto the ramdisk, maintaining the same hierarchy.
55 .Pp
56 On completion, the final image will be copied to
57 .Pa /boot/kernel/initrd.img ,
58 ready to be used as an early userland.
59 The base directory for
60 .Pa kernel/initrd.img
61 can be changed with the
62 .Fl b
63 option to an optional
64 .Ar bootdir (the default is
65 .Pa /boot ) .
66 The temporary directory to be used for setting up the image can be specified
67 using the
68 .Fl t
69 option (the default is
70 .Pa /tmp ) .
71 .Pp
72 The
73 .Nm
74 script will read
75 .Pa /etc/mkinitrd.conf
76 if it exists and use the configuration from this file to override the
77 following variables (defaults are in
78 .Pa /etc/defaults/mkinitrd.conf ) :
79 .Bd -literal -offset indent
80 BUILD_DIR
81 INITRD_SIZE
82 BIN_TOOLS
83 SBIN_TOOLS
84 INITRD_DIRS
85 CONTENT_DIRS
86 .Ed
87 .Pp
88 Adding the following lines to
89 .Pa /boot/loader.conf
90 will enable the use of the created initrd image:
91 .Bd -literal -offset indent
92 initrd.img_load="YES"
93 initrd.img_type="md_image"
94 vfs.root.mountfrom="ufs:md0s0"
95 .Ed
96 .Pp
97 The format for vfs.root.realroot in
98 .Pa /boot/loader.conf
99 that allows the user to specify what system to mount as the
100 new root in the initrd is specified in its general form below:
101 .Bd -literal -offset indent
102 vfs.root.realroot="<type>:[arg1[:arg2[:argN]]]"
103 .Ed
104 .Pp
105 Currently, three types of real root are supported,
106 .Pa local ,
107 .Pa tcplay
108 and
109 .Pa crypt .
110 The
111 .Pa local
112 type allows to mount any local file system that does not require any
113 special setup apart from the initial discovery and calling the
114 .Pa mount
115 program. The general format is as follows:
116 .Bd -literal -offset indent
117 vfs.root.realroot="local:<FS TYPE>:<DEVICE PATH>[:<OPTIONS>]"
118 .Ed
119 .Pp
120 The
121 .Pa crypt
122 type allows to mount volumes supported by cryptsetup. The device will
123 be set up by prompting the user for his key, and this volume will then
124 be mounted as the new root.
125 .Bd -literal -offset indent
126 vfs.root.realroot="crypt:<FS TYPE>:<DEVICE PATH>:<VOLUME NAME>[:<OPTIONS>]"
127 .Ed
128 .Pp
129 The
130 .Pa tcplay
131 type allows to mount volumes supported by
132 .Xr tcplay 8 .
133 The device will be set up by prompting the user for his key, and this
134 volume will then be mounted as the new root.
135 .Bd -literal -offset indent
136 vfs.root.realroot="tcplay:<FS TYPE>:<DEVICE PATH>:<VOLUME NAME>[:<OPTIONS>]"
137 .Ed
138 .Sh EXAMPLES
139 .Bd -literal -offset indent
140 vfs.root.realroot="local:ufs:/dev/vg00/lv0[:OPTIONS]"
141 .Ed
142 .Bd -literal -offset indent
143 vfs.root.realroot="crypt:ufs:/dev/ad0s0a:secvolume[:OPTIONS]"
144 .Ed
145 .Sh SEE ALSO
146 .Xr md 4 ,
147 .Xr loader.conf 5
148 .Sh HISTORY
149 The
150 .Nm
151 command first appeared in
152 .Dx 2.7 .
153 .Sh AUTHORS
154 .Nm
155 was written by
156 .An Alex Hornung Aq ahornung@gmail.com .