]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" -*- nroff -*- |
2 | .\" This man-page is Copyright (C) 1997 John S. Kallal | |
3 | .\" | |
4 | .\" Permission is granted to make and distribute verbatim copies of this | |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
12 | .\" | |
13 | .\" Since the Linux kernel and libraries are constantly changing, this | |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
20 | .\" | |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
22 | .\" the source, must acknowledge the copyright and author(s) of this work. | |
23 | .\" | |
24 | .\" If the you wish to distribute versions of this work under other | |
25 | .\" conditions than the above, please contact the author(s) at the following | |
26 | .\" for permission: | |
27 | .\" | |
28 | .\" John S. Kallal - | |
29 | .\" email: <kallal@voicenet.com> | |
30 | .\" mail: 518 Kerfoot Farm RD, Wilmington, DE 19803-2444, USA | |
31 | .\" phone: (302)654-5478 | |
32 | .\" | |
33 | .\" $Id: initrd.4,v 0.9 1997/11/07 05:05:32 kallal Exp kallal $ | |
34 | .TH INITRD 4 1997-11-06 "Linux 2.0" "Linux Programmer's Manual" | |
35 | .SH NAME | |
36 | initrd \- boot loader initialized RAM disk | |
37 | .\" | |
38 | .\" | |
39 | .\" | |
40 | .SH DESCRIPTION | |
41 | The special file | |
8478ee02 | 42 | .I /dev/initrd |
fea681da MK |
43 | is a read-only block device. |
44 | Device | |
8478ee02 | 45 | .I /dev/initrd |
fea681da MK |
46 | is a RAM disk that is initialized (e.g. loaded) by the boot loader before |
47 | the kernel is started. | |
61f4934a | 48 | The kernel then can use the block device |
8478ee02 | 49 | .IR /dev/initrd "'s " |
fea681da MK |
50 | contents for a two phased system boot-up. |
51 | .PP | |
52 | In the first boot-up phase, the kernel starts up | |
53 | and mounts an initial root file-system from the contents | |
54 | of | |
8478ee02 | 55 | .I /dev/initrd |
fea681da MK |
56 | (e.g. RAM disk initialized by the boot loader). |
57 | In the second phase, additional drivers or other modules | |
58 | are loaded from the initial root device's contents. | |
59 | After loading the additional modules, a new root file system | |
60 | (i.e. the normal root file system) is mounted from a | |
61 | different device. | |
62 | .\" | |
63 | .\" | |
64 | .\" | |
65 | .SH "BOOT-UP OPERATION" | |
66 | When booting up with | |
67 | .BR initrd ", the system boots as follows:" | |
68 | .RS 0.2i | |
69 | .PP | |
70 | 1. The boot loader loads the kernel program and | |
8478ee02 | 71 | .IR /dev/initrd "'s contents into memory." |
fea681da | 72 | .PP |
8478ee02 MK |
73 | 2. On kernel startup, |
74 | the kernel uncompresses and copies the contents of the device | |
75 | .I /dev/initrd | |
fea681da | 76 | onto device |
8478ee02 | 77 | .I /dev/ram0 |
fea681da | 78 | and then frees the memory used by |
8478ee02 | 79 | .IR /dev/initrd "." |
fea681da MK |
80 | .PP |
81 | 3. The kernel then read-write mounts device | |
8478ee02 | 82 | .I /dev/ram0 |
fea681da MK |
83 | as the initial root file system. |
84 | .PP | |
85 | 4. If the indicated normal root file system is also the initial root file-system | |
86 | (e.g. | |
8478ee02 | 87 | .I /dev/ram0 |
fea681da MK |
88 | ) then the kernel skips to the last step for the usual boot sequence. |
89 | .PP | |
90 | 5. If the executable file | |
8478ee02 | 91 | .IR /linuxrc " is present in the initial root file-system, " /linuxrc |
fdc196f5 | 92 | is executed with UID 0. |
fea681da | 93 | (The file |
8478ee02 | 94 | .I /linuxrc |
fea681da MK |
95 | must have executable permission. |
96 | The file | |
8478ee02 | 97 | .I /linuxrc |
fea681da MK |
98 | can be any valid executable, including a shell script.) |
99 | .PP | |
100 | 6. If | |
8478ee02 | 101 | .I /linuxrc |
fea681da | 102 | is not executed or when |
8478ee02 | 103 | .I /linuxrc |
fea681da MK |
104 | terminates, the normal root file system is mounted. |
105 | (If | |
8478ee02 | 106 | .IR /linuxrc |
fea681da MK |
107 | exits with any file-systems mounted on the initial root |
108 | file-system, then the behavior of the kernel is | |
109 | .BR UNSPECIFIED "." | |
110 | See the | |
111 | .BR NOTES | |
112 | section for the current kernel behavior.) | |
113 | .PP | |
114 | 7. If the normal root file has directory | |
8478ee02 MK |
115 | .IR /initrd ", device" |
116 | .I /dev/ram0 | |
fea681da | 117 | is moved from |
8478ee02 | 118 | .IR / " to " /initrd "." |
fea681da | 119 | Otherwise if directory |
8478ee02 | 120 | .IR /initrd " does not exist device " /dev/ram0 " is unmounted." |
fea681da | 121 | (When moved from |
8478ee02 | 122 | .IR / " to " /initrd ", " /dev/ram0 |
fea681da | 123 | is not unmounted and therefore processes can remain running from |
8478ee02 | 124 | .IR /dev/ram0 "." |
fea681da | 125 | If directory |
8478ee02 | 126 | .IR /initrd |
fea681da MK |
127 | does not exist on the normal root file-system |
128 | and any processes remain running from | |
8478ee02 | 129 | .IR /dev/ram0 " when " /linuxrc |
fea681da MK |
130 | exits, the behavior of the kernel is |
131 | .BR UNSPECIFIED "." | |
132 | See the | |
133 | .BR NOTES | |
134 | section for the current kernel behavior.) | |
135 | .PP | |
136 | 8. The usual boot sequence (e.g. invocation of | |
8478ee02 MK |
137 | .IR /sbin/init ) |
138 | is performed on the normal root file system. | |
fea681da MK |
139 | .\" |
140 | .\" | |
141 | .\" | |
142 | .SH OPTIONS | |
143 | The following boot loader options when used with | |
144 | .BR initrd ", affect the kernel's boot-up operation:" | |
145 | .TP | |
146 | .BI initrd= "filename" | |
147 | Specifies the file to load as the contents of | |
8478ee02 | 148 | .IR /dev/initrd "." |
fea681da MK |
149 | .RB "For " LOADLIN |
150 | this is a command line option. | |
151 | .RB "For " LILO " you have to use this command in the | |
8478ee02 MK |
152 | .BR LILO |
153 | configuration file | |
154 | .IR /etc/lilo.config . | |
fea681da MK |
155 | The filename specified with this |
156 | option will typically be a gzipped file-system image. | |
157 | .TP | |
8478ee02 | 158 | .I noinitrd |
fea681da MK |
159 | This boot time option disables the two phase boot-up operation. |
160 | The kernel performs the usual boot sequence as if | |
8478ee02 | 161 | .I /dev/initrd |
fea681da MK |
162 | was not initialized. |
163 | With this option, any contents of | |
8478ee02 | 164 | .I /dev/initrd |
fea681da MK |
165 | loaded into memory by the boot loader contents are preserved. |
166 | This option permits the contents of | |
8478ee02 | 167 | .I /dev/initrd |
fea681da MK |
168 | to be any data and need not be limited to a file system image. |
169 | However, device | |
8478ee02 | 170 | .I /dev/initrd |
fea681da MK |
171 | is read-only and can be read only one time after system startup. |
172 | .TP | |
173 | .BI root= "device-name" | |
174 | Specifies the device to be used as the normal root file system. | |
175 | .RB "For " LOADLIN | |
176 | this is a command line option. | |
177 | .RB "For " LILO " this is a boot time option or | |
178 | can be used as an option line in the | |
179 | .BR LILO " configuration file " /etc/lilo.config "." | |
180 | The device specified by the this option must be a mountable | |
181 | device having a suitable root file-system. | |
182 | .\" | |
183 | .\" | |
184 | .\" | |
185 | .SH "CHANGING THE NORMAL ROOT FILE SYSTEM" | |
186 | By default, | |
187 | the kernel's settings | |
188 | (e.g. set in the kernel file with | |
8478ee02 | 189 | .BR rdev (8) |
fea681da MK |
190 | or compiled into the kernel file), |
191 | or the boot loader option setting | |
192 | is used for the normal root file systems. | |
193 | For a NFS-mounted normal root file system, one has to use the | |
194 | .BR nfs_root_name " and " nfs_root_addrs | |
195 | boot options to give the NFS settings. | |
196 | For more information on NFS-mounted root see the kernel documentation file | |
197 | .BR nfsroot.txt "." | |
198 | For more information on setting the root file system also see the | |
199 | .BR LILO " and " LOADLIN " documentation." | |
200 | .PP | |
201 | It is also possible for the | |
8478ee02 | 202 | .IR /linuxrc |
fea681da MK |
203 | executable to change the normal root device. |
204 | For | |
8478ee02 | 205 | .IR /linuxrc |
fea681da | 206 | to change the normal root device, |
8478ee02 | 207 | .IR /proc " must be mounted." |
fea681da | 208 | After mounting |
8478ee02 | 209 | .IR /proc ", " /linuxrc |
fea681da | 210 | changes the normal root device by writing into the proc files |
8478ee02 MK |
211 | .IR /proc/sys/kernel/real-root-dev ", " |
212 | .IR /proc/sys/kernel/nfs-root-name ", and " | |
213 | .IR /proc/sys/kernel/nfs-root-addrs "." | |
fea681da | 214 | For a physical root device, the root device is changed by having |
8478ee02 | 215 | .IR /linuxrc |
fea681da | 216 | write the new root file system device number into |
8478ee02 | 217 | .IR /proc/sys/kernel/real-root-dev "." |
fea681da | 218 | For a NFS root file system, the root device is changed by having |
8478ee02 | 219 | .IR /linuxrc |
fea681da | 220 | write the NFS setting into files |
8478ee02 MK |
221 | .IR /proc/sys/kernel/nfs-root-name " and " |
222 | .IR /proc/sys/kernel/nfs-root-addrs | |
fea681da | 223 | and then writing 0xff (e.g. the pseudo-NFS-device number) into file |
8478ee02 | 224 | .IR /proc/sys/kernel/real-root-dev "." |
fea681da MK |
225 | For example, the following shell command line would change |
226 | the normal root device to | |
8478ee02 | 227 | .IR /dev/hdb1 : |
fea681da MK |
228 | .nf |
229 | echo 0x365 >/proc/sys/kernel/real-root-dev | |
230 | .fi | |
231 | For a NFS example, the following shell command lines would change the | |
232 | normal root device to the NFS directory | |
8478ee02 | 233 | .IR /var/nfsroot |
fea681da MK |
234 | on a local networked NFS server with IP number 193.8.232.7 for a system with |
235 | IP number 193.8.232.7 and named 'idefix': | |
236 | .nf | |
237 | echo /var/nfsroot >/proc/sys/kernel/nfs-root-name | |
238 | echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\ | |
239 | >/proc/sys/kernel/nfs-root-addrs | |
240 | echo 255 >/proc/sys/kernel/real-root-dev | |
241 | .fi | |
1a57baf2 MK |
242 | |
243 | .BR Note : | |
244 | The use of | |
8478ee02 | 245 | .IR /proc/sys/kernel/real-root-dev |
1a57baf2 MK |
246 | to change the root file system is obsolete. |
247 | See the kernel source file | |
248 | .I Documentation/initrd.txt | |
249 | as well as | |
250 | .BR pivot_root (2) | |
251 | and | |
252 | .BR pivot_root (8) | |
253 | for information on the modern method of changing the root file system. | |
254 | .\" FIXME the manual page should describe the pivot_root mechanism. | |
fea681da MK |
255 | .\" |
256 | .\" | |
257 | .\" | |
258 | .SH USAGE | |
259 | The main motivation for implementing | |
260 | .BR initrd | |
261 | was to allow for modular kernel configuration at system installation. | |
262 | .PP | |
263 | A possible system installation scenario is as follows: | |
264 | .RS 0.2i | |
265 | .PP | |
266 | 1. The loader program boots from floppy or other media with a minimal kernel | |
267 | (e.g. support for | |
8478ee02 MK |
268 | .IR /dev/ram ", " /dev/initrd ", and the ext2 file-system) and loads " |
269 | .IR /dev/initrd " with a gzipped version of the initial file-system. | |
fea681da MK |
270 | .PP |
271 | 2. The executable | |
8478ee02 | 272 | .IR /linuxrc |
fea681da MK |
273 | determines what is needed to (1) mount the normal root file-system |
274 | (i.e. device type, device drivers, file system) and (2) the | |
275 | distribution media (e.g. CD-ROM, network, tape, ...). This can be | |
276 | done by asking the user, by auto-probing, or by using a hybrid | |
277 | approach. | |
278 | .PP | |
279 | 3. The executable | |
8478ee02 | 280 | .IR /linuxrc |
fea681da MK |
281 | loads the necessary modules from the initial root file-system. |
282 | .PP | |
283 | 4. The executable | |
8478ee02 | 284 | .IR /linuxrc |
fea681da MK |
285 | creates and populates the root file system. (At this stage the normal |
286 | root file system does not have to be a | |
287 | completed system yet.) | |
288 | .PP | |
289 | 5. The executable | |
8478ee02 | 290 | .IR /linuxrc " sets " /proc/sys/kernel/real-root-dev, |
fea681da | 291 | unmount |
8478ee02 | 292 | .IR /proc ", " |
fea681da MK |
293 | the normal root file system and any other file |
294 | systems it has mounted, and then terminates. | |
295 | .PP | |
296 | 6. The kernel then mounts the normal root file system. | |
297 | .PP | |
298 | 7. Now that the file system is accessible and intact, | |
299 | the boot loader can be installed. | |
300 | .PP | |
301 | 8. The boot loader is configured to load into | |
8478ee02 | 302 | .IR /dev/initrd |
fea681da MK |
303 | a file system with the set of modules that was used to bring up the system. |
304 | (e.g. Device | |
8478ee02 | 305 | .IR /dev/ram0 |
fea681da | 306 | can be modified, then unmounted, and finally, the image is written from |
8478ee02 | 307 | .IR /dev/ram0 |
fea681da MK |
308 | to a file.) |
309 | .PP | |
310 | 9. The system is now bootable and additional installation tasks can be | |
311 | performed. | |
312 | .RE | |
313 | .PP | |
314 | The key role of | |
8478ee02 | 315 | .IR /dev/initrd |
fea681da MK |
316 | in the above is to re-use the configuration data during normal system operation |
317 | without requiring initial kernel selection, a large generic kernel or, | |
318 | recompiling the kernel. | |
319 | .PP | |
320 | A second scenario is for installations where Linux runs on systems with | |
321 | different hardware configurations in a single administrative network. | |
322 | In such cases, it may be desirable to use only a small set of kernels | |
323 | (ideally only one) and to keep the system-specific part of configuration | |
324 | information as small as possible. | |
325 | In this case, create a common file | |
326 | with all needed modules. | |
fba59d25 | 327 | Then, only the |
8478ee02 | 328 | .I /linuxrc |
fea681da | 329 | file or a file executed by |
8478ee02 | 330 | .I /linuxrc |
fea681da MK |
331 | would be different. |
332 | .PP | |
333 | A third scenario is more convenient recovery disks. | |
334 | Because information like the location of the root file-system | |
335 | partition is not needed at boot time, the system loaded from | |
8478ee02 | 336 | .I /dev/initrd |
fea681da MK |
337 | can use a dialog and/or auto-detection followed by a |
338 | possible sanity check. | |
339 | .PP | |
340 | Last but not least, Linux distributions on CD-ROM may use | |
341 | .BR initrd | |
342 | for easy installation from the CD-ROM. | |
343 | The distribution can use | |
344 | .BR LOADLIN | |
345 | to directly load | |
8478ee02 | 346 | .IR /dev/initrd |
fea681da MK |
347 | from CD-ROM without the need of any floppies. |
348 | The distribution could also use a | |
349 | .BR LILO | |
350 | boot floppy and then bootstrap a bigger ram disk via | |
8478ee02 | 351 | .IR /dev/initrd " from the CD-ROM." |
fea681da MK |
352 | .\" |
353 | .\" | |
354 | .\" | |
355 | .SH CONFIGURATION | |
356 | The | |
8478ee02 | 357 | .I /dev/initrd |
fea681da MK |
358 | is a read-only block device assigned |
359 | major number 1 and minor number 250. | |
360 | Typically | |
8478ee02 | 361 | .I /dev/initrd |
fea681da | 362 | is owned by |
8478ee02 | 363 | .I root.disk |
fea681da MK |
364 | with mode 0400 (read access by root only). |
365 | If the Linux system does not have | |
8478ee02 | 366 | .I /dev/initrd |
fea681da MK |
367 | already created, it can be created with the following commands: |
368 | .nf | |
369 | \fB | |
2bc2f479 | 370 | mknod \-m 400 /dev/initrd b 1 250 |
fea681da MK |
371 | chown root:disk /dev/initrd |
372 | \fP | |
373 | .fi | |
374 | Also, support for both "RAM disk" and "Initial RAM disk" | |
375 | (e.g. | |
376 | .BR CONFIG_BLK_DEV_RAM=y " and " CONFIG_BLK_DEV_INITRD=y | |
377 | ) support must be compiled directly into the Linux kernel to use | |
8478ee02 | 378 | .IR /dev/initrd "." |
fea681da | 379 | When using |
8478ee02 | 380 | .IR /dev/initrd ", " |
fea681da MK |
381 | the RAM disk driver cannot be loaded as a module. |
382 | .\" | |
383 | .\" | |
384 | .\" | |
385 | .SH FILES | |
386 | .I /dev/initrd | |
387 | .br | |
388 | .I /dev/ram0 | |
389 | .br | |
390 | .I /linuxrc | |
391 | .br | |
392 | .I /initrd | |
393 | .SH "SEE ALSO" | |
394 | .BR chown (1), | |
395 | .BR mknod (1), | |
396 | .BR ram (4), | |
397 | .BR freeramdisk (8), | |
398 | .BR rdev (8) | |
399 | ||
400 | The documentation file | |
401 | .I initrd.txt | |
402 | in the kernel source package, the LILO documentation, | |
403 | the LOADLIN documentation, the SYSLINUX documentation. | |
404 | .\" | |
405 | .\" | |
406 | .\" | |
407 | .SH NOTES | |
408 | 1. With the current kernel, any file systems that remain mounted when | |
8478ee02 | 409 | .IR /dev/ram0 " is moved from " / " to " /initrd |
fea681da | 410 | continue to be accessible. However, the |
8478ee02 | 411 | .IR /proc/mounts |
fea681da MK |
412 | entries are not updated. |
413 | .PP | |
414 | 2. With the current kernel, if directory | |
8478ee02 MK |
415 | .IR /initrd " does not exist, then " |
416 | .I /dev/ram0 | |
fea681da | 417 | will NOT be fully unmounted if |
8478ee02 | 418 | .IR /dev/ram0 |
fea681da MK |
419 | is used by any process or has any file-system mounted on it. |
420 | If | |
8478ee02 | 421 | .IR /dev/ram0 " is NOT fully unmounted, " |
fea681da | 422 | then |
8478ee02 | 423 | .IR /dev/ram0 |
fea681da MK |
424 | will remain in memory. |
425 | .PP | |
426 | 3. Users of | |
8478ee02 | 427 | .IR /dev/initrd |
fea681da MK |
428 | should not depend on the behavior give in the above notes. |
429 | The behavior may change in future versions of the Linux kernel. | |
430 | .\" | |
431 | .\" | |
432 | .\" | |
433 | .SH AUTHOR | |
434 | The kernel code for device | |
435 | .BR initrd | |
436 | was written by Werner Almesberger <almesber@lrc.epfl.ch> and | |
437 | Hans Lermen <lermen@elserv.ffm.fgan.de>. | |
438 | The code for | |
439 | .BR initrd | |
440 | was added to the baseline Linux kernel in development version 1.3.73. |