-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkinitramfs.8
173 lines (173 loc) · 5.13 KB
/
mkinitramfs.8
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
.\" mkinitramfs(8) manual page
.\" See COPYING and COPYRIGHT files for corresponding information.
.Dd May 22, 2023
.Dt MKINITRAMFS 8
.Os
.\" ==================================================================
.Sh NAME
.Nm mkinitramfs
.Nd create an initial ramdisk environment
.\" ==================================================================
.Sh SYNOPSIS
.Nm mkinitramfs
.Op Fl fhv
.Op Fl D Ar helperfile
.Op Fl H Ar hooksdir
.Op Fl I Ar initfile
.Op Fl c Ar conffile
.Op Fl k Ar kernelversion
.Op Fl m Ar modulesdir
.Op Fl o Ar initramfs
.\" ==================================================================
.Sh DESCRIPTION
The
.Nm
utility creates an initial ramdisk environment for booting the Linux
kernel.
The initial ramdisk is in essence a very small environment (early
userspace) which loads various kernel modules and sets up necessary
things before handing over control to init.
This makes it possible to have, for example, encrypted root file
systems and root file systems on a software RAID array.
.Nm
can be extended with custom hooks.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl D Ar helperfile , Fl \-helper Ns = Ns Ar helperfile
Specify an alternate device helper file instead of the default
.Pa /usr/share/mkinitramfs/device-helper .
.It Fl H Ar hooksdir , Fl \-hooks Ns = Ns Ar hooksdir
Specify additional directory for hooks.
By default,
.Nm
uses
.Pa /usr/share/mkinitramfs/hooks
and
.Pa /etc/mkinitramfs/hooks .
.It Fl I Ar initfile , Fl \-init Ns = Ns Ar initfile
Specify an alternate init script instead of the default
.Pa /usr/share/mkinitramfs/init .
.It Fl c Ar conffile , Fl \-config Ns = Ns Em conffile
Specify an alternate configuration file instead of the default
.Pa /etc/mkinitramfs/config .
.It Fl f , Fl \-force
Forcefully overwrite initramfs image.
.It Fl k Ar kernelversion , Fl \-kernel Ns = Ns Ar kernelversion
Specify kernel version instead of using the version of current running
kernel
.Po
.Dq uname -r
.Pc .
Useful for bootstrapping future system with modular kernel.
.It Fl m Ar modulesdir , Fl \-modules Ns = Ns Ar modulesdir
Specify an alternate directory where where kernel modules stored
instead of the default
.Pa /lib/modules .
.Pp
This option has no effect if
.Sy monolith
or
.Sy hostonly
were enabled in configuration file.
.It Fl o Ar initramfs , Fl \-output Ns = Ns Ar initramfs
Specify an alternate output file where initramfs image will be stored
instead of the default
.Pa mkinitramfs- Ns Qo Li kernelversion Qc
directory, created in
.Ev TMPDIR
or (if unavailable) in
.Pa /tmp
directory.
.It Fl v , Fl \-version
Print version and exit.
.It Fl h , Fl \-help
Print help and exit.
.El
.\" ==================================================================
.Sh ENVIRONMENT
.Nm
uses the
.Ev TMPDIR
environment variable.
If set, it uses subdirectories in the given directory to create its
temporary working directories.
Else it uses
.Pa /tmp
as default value for that purpose.
The given directory should be on a filesystem which allows the
execution of files stored there, i.e. should not be mounted with the
.Sy noexec
mount option.
.\" ==================================================================
.Sh FILES
.Bl -tag -width Ds -compact
.It Pa /etc/mkinitramfs/config
The default configuration file.
See
.Xr mkinitramfs.config 5
for a description of the available configuration parameters.
.Pp
.It Pa /usr/share/mkinitramfs/hooks/ ,
.It Pa /etc/mkinitramfs/hooks/
Hooks directories.
.Pp
.It Pa /usr/share/mkinitramfs/init
Init.
.Pp
.It Pa /usr/share/mkinitramfs/device-helper
Device-helper.
.El
.\" ==================================================================
.Sh EXAMPLES
Create an initramfs for current running kernel:
.Bd -literal -offset indent
mkinitramfs -o /tmp/initramfs-`uname -r`.img
.Ed
.Pp
Create an initramfs for specific kernel:
.Bd -literal -offset indent
mkinitramfs -o /tmp/initramfs-5.4.224.img -k 5.4.224
.Ed
.Pp
Debug initramfs creation (check out written logfile):
.Bd -literal -offset indent
sh -x `which mkinitramfs` -o /tmp/initramfs-`uname -r` 2>/tmp/log
.Ed
.\" ==================================================================
.Sh NOTES
If you have modular kernel and you use
.Sy busybox' modprobe
to handle modules, you must note that
.Sy busybox' modprobe
doesn't have ability to install soft dependencies of modules (i.e.
.Pa modules.softdep Ns ).
You must install them yourself using hooks.
See
.Xr mkinitramfs.hooks 7
how to do it.
.\" ==================================================================
.Sh SEE ALSO
.Xr mkinitramfs.config 5 ,
.Xr mkinitramfs.cmdline 7 ,
.Xr mkinitramfs.hooks 7
.Pp
.Lk https://docs.kernel.org/filesystems/ramfs\-rootfs\-initramfs.html \
"Kernel subsystem documentation: Ramfs, rootfs and initramfs" .
.Pp
.Lk https://docs.kernel.org/admin\-guide/initrd.html \
"The Linux kernel user's and administrator's guide: Using the initial RAM disk (initrd)" .
.\" ==================================================================
.Sh AUTHORS
Originally written by
.An illiliti Aq Mt illiliti@protonmail.com
as
.Dq Sy tinyramfs
tool.
.Pp
This implementation was re-worked for
.Lk https://zeppe\-lin.github.io "Zeppe-Lin"
by
.An Alexandr Savca Aq Mt alexandr.savca89@gmail.com .
.\" vim: cc=72 tw=70
.\" End of file.