Merge branch 'vendor/OPENSSL'
[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 March 3, 2015
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 c Ar contentsdir
41 .Op Fl t Ar tmpdir
42 .Sh DESCRIPTION
43 The
44 .Nm
45 script builds a ramdisk (md) image based on the UFS filesystem containing
46 only the most basic tools, such as a minimal
47 .Xr init 8 ,
48 .Xr sh 1
49 as well as many
50 .Xr mount 8
51 utilities.
52 .Pp
53 It will also copy the contents of
54 .Pa /usr/share/initrd
55 onto the ramdisk, maintaining the same hierarchy.
56 This directory can be changed with the
57 .Fl c
58 option.
59 .Pp
60 On completion, the final image will be copied to
61 .Pa /boot/kernel/initrd.img.gz ,
62 ready to be used as an early userland.
63 The base directory for
64 .Pa kernel/initrd.img.gz
65 can be changed with the
66 .Fl b
67 option to an optional
68 .Ar bootdir (the default is
69 .Pa /boot ) .
70 The temporary directory to be used for setting up the image can be specified
71 using the
72 .Fl t
73 option (the default is
74 .Pa /tmp ) .
75 .Pp
76 The
77 .Nm
78 script will read
79 .Pa /etc/mkinitrd.conf
80 if it exists and use the configuration from this file to override the
81 following variables (defaults are in
82 .Pa /etc/defaults/mkinitrd.conf ) :
83 .Bd -literal -offset indent
84 BUILD_DIR
85 INITRD_SIZE
86 INITRD_DIRS
87 CONTENT_DIRS
88 .Ed
89 .Pp
90 Adding the following lines to
91 .Pa /boot/loader.conf
92 will enable the use of the created initrd image:
93 .Bd -literal -offset indent
94 initrd.img_load="YES"
95 initrd.img_type="md_image"
96 vfs.root.mountfrom="ufs:md0s0"
97 .Ed
98 .Pp
99 The format for vfs.root.realroot in
100 .Pa /boot/loader.conf
101 that allows the user to specify what system to mount as the
102 new root in the initrd is specified in its general form below:
103 .Bd -literal -offset indent
104 vfs.root.realroot="<type>:[arg1[:arg2[:argN]]]"
105 .Ed
106 .Pp
107 Currently, three types of real root are supported,
108 .Pa local ,
109 .Pa tcplay
110 and
111 .Pa crypt .
112 The
113 .Pa local
114 type allows to mount any local file system that does not require any
115 special setup apart from the initial discovery and calling the
116 .Pa mount
117 program. The general format is as follows:
118 .Bd -literal -offset indent
119 vfs.root.realroot="local:<FS TYPE>:<DEVICE PATH>[:<OPTIONS>]"
120 .Ed
121 .Pp
122 The
123 .Pa crypt
124 type allows to mount volumes supported by cryptsetup. The device will
125 be set up by prompting the user for his key, and this volume will then
126 be mounted as the new root.
127 .Bd -literal -offset indent
128 vfs.root.realroot="crypt:<FS TYPE>:<DEVICE PATH>:<VOLUME NAME>[:<OPTIONS>]"
129 .Ed
130 .Pp
131 The
132 .Pa tcplay
133 type allows to mount volumes supported by
134 .Xr tcplay 8 .
135 The device will be set up by prompting the user for his key, and this
136 volume will then be mounted as the new root.
137 .Bd -literal -offset indent
138 vfs.root.realroot="tcplay:<FS TYPE>:<DEVICE PATH>:<VOLUME NAME>[:<OPTIONS>]"
139 .Ed
140 .Sh EXAMPLES
141 .Bd -literal -offset indent
142 vfs.root.realroot="local:ufs:/dev/vg00/lv0[:OPTIONS]"
143 .Ed
144 .Bd -literal -offset indent
145 vfs.root.realroot="crypt:ufs:/dev/ad0s0a:secvolume[:OPTIONS]"
146 .Ed
147 .Sh SEE ALSO
148 .Xr md 4 ,
149 .Xr loader.conf 5
150 .Sh HISTORY
151 The
152 .Nm
153 command first appeared in
154 .Dx 2.7 .
155 .Sh AUTHORS
156 .Nm
157 was written by
158 .An Alex Hornung Aq Mt ahornung@gmail.com .