]>
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 | |
fea681da MK |
37 | .SH DESCRIPTION |
38 | The special file | |
8478ee02 | 39 | .I /dev/initrd |
fea681da MK |
40 | is a read-only block device. |
41 | Device | |
8478ee02 | 42 | .I /dev/initrd |
fea681da MK |
43 | is a RAM disk that is initialized (e.g. loaded) by the boot loader before |
44 | the kernel is started. | |
61f4934a | 45 | The kernel then can use the block device |
8478ee02 | 46 | .IR /dev/initrd "'s " |
fea681da MK |
47 | contents for a two phased system boot-up. |
48 | .PP | |
49 | In the first boot-up phase, the kernel starts up | |
50 | and mounts an initial root file-system from the contents | |
51 | of | |
8478ee02 | 52 | .I /dev/initrd |
fea681da MK |
53 | (e.g. RAM disk initialized by the boot loader). |
54 | In the second phase, additional drivers or other modules | |
55 | are loaded from the initial root device's contents. | |
56 | After loading the additional modules, a new root file system | |
57 | (i.e. the normal root file system) is mounted from a | |
58 | different device. | |
59 | .\" | |
60 | .\" | |
61 | .\" | |
62 | .SH "BOOT-UP OPERATION" | |
63 | When booting up with | |
64 | .BR initrd ", the system boots as follows:" | |
65 | .RS 0.2i | |
66 | .PP | |
67 | 1. The boot loader loads the kernel program and | |
8478ee02 | 68 | .IR /dev/initrd "'s contents into memory." |
fea681da | 69 | .PP |
8478ee02 MK |
70 | 2. On kernel startup, |
71 | the kernel uncompresses and copies the contents of the device | |
72 | .I /dev/initrd | |
fea681da | 73 | onto device |
8478ee02 | 74 | .I /dev/ram0 |
fea681da | 75 | and then frees the memory used by |
8478ee02 | 76 | .IR /dev/initrd "." |
fea681da MK |
77 | .PP |
78 | 3. The kernel then read-write mounts device | |
8478ee02 | 79 | .I /dev/ram0 |
fea681da MK |
80 | as the initial root file system. |
81 | .PP | |
82 | 4. If the indicated normal root file system is also the initial root file-system | |
83 | (e.g. | |
8478ee02 | 84 | .I /dev/ram0 |
fea681da MK |
85 | ) then the kernel skips to the last step for the usual boot sequence. |
86 | .PP | |
87 | 5. If the executable file | |
8478ee02 | 88 | .IR /linuxrc " is present in the initial root file-system, " /linuxrc |
fdc196f5 | 89 | is executed with UID 0. |
fea681da | 90 | (The file |
8478ee02 | 91 | .I /linuxrc |
fea681da MK |
92 | must have executable permission. |
93 | The file | |
8478ee02 | 94 | .I /linuxrc |
fea681da MK |
95 | can be any valid executable, including a shell script.) |
96 | .PP | |
97 | 6. If | |
8478ee02 | 98 | .I /linuxrc |
fea681da | 99 | is not executed or when |
8478ee02 | 100 | .I /linuxrc |
fea681da MK |
101 | terminates, the normal root file system is mounted. |
102 | (If | |
8478ee02 | 103 | .IR /linuxrc |
fea681da MK |
104 | exits with any file-systems mounted on the initial root |
105 | file-system, then the behavior of the kernel is | |
106 | .BR UNSPECIFIED "." | |
107 | See the | |
108 | .BR NOTES | |
109 | section for the current kernel behavior.) | |
110 | .PP | |
111 | 7. If the normal root file has directory | |
8478ee02 MK |
112 | .IR /initrd ", device" |
113 | .I /dev/ram0 | |
fea681da | 114 | is moved from |
8478ee02 | 115 | .IR / " to " /initrd "." |
fea681da | 116 | Otherwise if directory |
8478ee02 | 117 | .IR /initrd " does not exist device " /dev/ram0 " is unmounted." |
fea681da | 118 | (When moved from |
8478ee02 | 119 | .IR / " to " /initrd ", " /dev/ram0 |
fea681da | 120 | is not unmounted and therefore processes can remain running from |
8478ee02 | 121 | .IR /dev/ram0 "." |
fea681da | 122 | If directory |
8478ee02 | 123 | .IR /initrd |
fea681da MK |
124 | does not exist on the normal root file-system |
125 | and any processes remain running from | |
8478ee02 | 126 | .IR /dev/ram0 " when " /linuxrc |
fea681da MK |
127 | exits, the behavior of the kernel is |
128 | .BR UNSPECIFIED "." | |
129 | See the | |
130 | .BR NOTES | |
131 | section for the current kernel behavior.) | |
132 | .PP | |
133 | 8. The usual boot sequence (e.g. invocation of | |
8478ee02 MK |
134 | .IR /sbin/init ) |
135 | is performed on the normal root file system. | |
fea681da MK |
136 | .\" |
137 | .\" | |
138 | .\" | |
139 | .SH OPTIONS | |
140 | The following boot loader options when used with | |
141 | .BR initrd ", affect the kernel's boot-up operation:" | |
142 | .TP | |
143 | .BI initrd= "filename" | |
144 | Specifies the file to load as the contents of | |
8478ee02 | 145 | .IR /dev/initrd "." |
c10859eb MK |
146 | For |
147 | .B LOADLIN | |
fea681da | 148 | this is a command line option. |
c10859eb MK |
149 | For |
150 | .B LILO | |
151 | you have to use this command in the | |
152 | .B LILO | |
8478ee02 MK |
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 | 228 | .nf |
7295b7ed MK |
229 | |
230 | echo 0x365 >/proc/sys/kernel/real-root-dev | |
231 | ||
fea681da MK |
232 | .fi |
233 | For a NFS example, the following shell command lines would change the | |
234 | normal root device to the NFS directory | |
8478ee02 | 235 | .IR /var/nfsroot |
fea681da MK |
236 | on a local networked NFS server with IP number 193.8.232.7 for a system with |
237 | IP number 193.8.232.7 and named 'idefix': | |
238 | .nf | |
7295b7ed MK |
239 | |
240 | echo /var/nfsroot >/proc/sys/kernel/nfs-root-name | |
241 | echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\ | |
242 | >/proc/sys/kernel/nfs-root-addrs | |
243 | echo 255 >/proc/sys/kernel/real-root-dev | |
fea681da | 244 | .fi |
1a57baf2 MK |
245 | |
246 | .BR Note : | |
247 | The use of | |
8478ee02 | 248 | .IR /proc/sys/kernel/real-root-dev |
1a57baf2 MK |
249 | to change the root file system is obsolete. |
250 | See the kernel source file | |
251 | .I Documentation/initrd.txt | |
252 | as well as | |
253 | .BR pivot_root (2) | |
254 | and | |
255 | .BR pivot_root (8) | |
256 | for information on the modern method of changing the root file system. | |
257 | .\" FIXME the manual page should describe the pivot_root mechanism. | |
fea681da MK |
258 | .\" |
259 | .\" | |
260 | .\" | |
261 | .SH USAGE | |
262 | The main motivation for implementing | |
263 | .BR initrd | |
264 | was to allow for modular kernel configuration at system installation. | |
265 | .PP | |
266 | A possible system installation scenario is as follows: | |
267 | .RS 0.2i | |
268 | .PP | |
269 | 1. The loader program boots from floppy or other media with a minimal kernel | |
270 | (e.g. support for | |
8478ee02 MK |
271 | .IR /dev/ram ", " /dev/initrd ", and the ext2 file-system) and loads " |
272 | .IR /dev/initrd " with a gzipped version of the initial file-system. | |
fea681da MK |
273 | .PP |
274 | 2. The executable | |
8478ee02 | 275 | .IR /linuxrc |
fea681da MK |
276 | determines what is needed to (1) mount the normal root file-system |
277 | (i.e. device type, device drivers, file system) and (2) the | |
278 | distribution media (e.g. CD-ROM, network, tape, ...). This can be | |
279 | done by asking the user, by auto-probing, or by using a hybrid | |
280 | approach. | |
281 | .PP | |
282 | 3. The executable | |
8478ee02 | 283 | .IR /linuxrc |
fea681da MK |
284 | loads the necessary modules from the initial root file-system. |
285 | .PP | |
286 | 4. The executable | |
8478ee02 | 287 | .IR /linuxrc |
fea681da MK |
288 | creates and populates the root file system. (At this stage the normal |
289 | root file system does not have to be a | |
290 | completed system yet.) | |
291 | .PP | |
292 | 5. The executable | |
8478ee02 | 293 | .IR /linuxrc " sets " /proc/sys/kernel/real-root-dev, |
fea681da | 294 | unmount |
8478ee02 | 295 | .IR /proc ", " |
fea681da MK |
296 | the normal root file system and any other file |
297 | systems it has mounted, and then terminates. | |
298 | .PP | |
299 | 6. The kernel then mounts the normal root file system. | |
300 | .PP | |
301 | 7. Now that the file system is accessible and intact, | |
302 | the boot loader can be installed. | |
303 | .PP | |
304 | 8. The boot loader is configured to load into | |
8478ee02 | 305 | .IR /dev/initrd |
fea681da MK |
306 | a file system with the set of modules that was used to bring up the system. |
307 | (e.g. Device | |
8478ee02 | 308 | .IR /dev/ram0 |
fea681da | 309 | can be modified, then unmounted, and finally, the image is written from |
8478ee02 | 310 | .IR /dev/ram0 |
fea681da MK |
311 | to a file.) |
312 | .PP | |
313 | 9. The system is now bootable and additional installation tasks can be | |
314 | performed. | |
315 | .RE | |
316 | .PP | |
317 | The key role of | |
8478ee02 | 318 | .IR /dev/initrd |
fea681da MK |
319 | in the above is to re-use the configuration data during normal system operation |
320 | without requiring initial kernel selection, a large generic kernel or, | |
321 | recompiling the kernel. | |
322 | .PP | |
323 | A second scenario is for installations where Linux runs on systems with | |
324 | different hardware configurations in a single administrative network. | |
325 | In such cases, it may be desirable to use only a small set of kernels | |
326 | (ideally only one) and to keep the system-specific part of configuration | |
327 | information as small as possible. | |
328 | In this case, create a common file | |
329 | with all needed modules. | |
fba59d25 | 330 | Then, only the |
8478ee02 | 331 | .I /linuxrc |
fea681da | 332 | file or a file executed by |
8478ee02 | 333 | .I /linuxrc |
fea681da MK |
334 | would be different. |
335 | .PP | |
336 | A third scenario is more convenient recovery disks. | |
337 | Because information like the location of the root file-system | |
338 | partition is not needed at boot time, the system loaded from | |
8478ee02 | 339 | .I /dev/initrd |
fea681da MK |
340 | can use a dialog and/or auto-detection followed by a |
341 | possible sanity check. | |
342 | .PP | |
343 | Last but not least, Linux distributions on CD-ROM may use | |
344 | .BR initrd | |
345 | for easy installation from the CD-ROM. | |
346 | The distribution can use | |
347 | .BR LOADLIN | |
348 | to directly load | |
8478ee02 | 349 | .IR /dev/initrd |
fea681da MK |
350 | from CD-ROM without the need of any floppies. |
351 | The distribution could also use a | |
352 | .BR LILO | |
353 | boot floppy and then bootstrap a bigger ram disk via | |
8478ee02 | 354 | .IR /dev/initrd " from the CD-ROM." |
fea681da MK |
355 | .\" |
356 | .\" | |
357 | .\" | |
358 | .SH CONFIGURATION | |
359 | The | |
8478ee02 | 360 | .I /dev/initrd |
fea681da MK |
361 | is a read-only block device assigned |
362 | major number 1 and minor number 250. | |
363 | Typically | |
8478ee02 | 364 | .I /dev/initrd |
fea681da | 365 | is owned by |
8478ee02 | 366 | .I root.disk |
fea681da MK |
367 | with mode 0400 (read access by root only). |
368 | If the Linux system does not have | |
8478ee02 | 369 | .I /dev/initrd |
fea681da MK |
370 | already created, it can be created with the following commands: |
371 | .nf | |
372 | \fB | |
2bc2f479 | 373 | mknod \-m 400 /dev/initrd b 1 250 |
fea681da MK |
374 | chown root:disk /dev/initrd |
375 | \fP | |
376 | .fi | |
377 | Also, support for both "RAM disk" and "Initial RAM disk" | |
378 | (e.g. | |
379 | .BR CONFIG_BLK_DEV_RAM=y " and " CONFIG_BLK_DEV_INITRD=y | |
380 | ) support must be compiled directly into the Linux kernel to use | |
8478ee02 | 381 | .IR /dev/initrd "." |
fea681da | 382 | When using |
8478ee02 | 383 | .IR /dev/initrd ", " |
fea681da MK |
384 | the RAM disk driver cannot be loaded as a module. |
385 | .\" | |
386 | .\" | |
387 | .\" | |
388 | .SH FILES | |
389 | .I /dev/initrd | |
390 | .br | |
391 | .I /dev/ram0 | |
392 | .br | |
393 | .I /linuxrc | |
394 | .br | |
395 | .I /initrd | |
396 | .SH "SEE ALSO" | |
397 | .BR chown (1), | |
398 | .BR mknod (1), | |
399 | .BR ram (4), | |
400 | .BR freeramdisk (8), | |
401 | .BR rdev (8) | |
402 | ||
403 | The documentation file | |
404 | .I initrd.txt | |
405 | in the kernel source package, the LILO documentation, | |
406 | the LOADLIN documentation, the SYSLINUX documentation. | |
407 | .\" | |
408 | .\" | |
409 | .\" | |
410 | .SH NOTES | |
411 | 1. With the current kernel, any file systems that remain mounted when | |
8478ee02 | 412 | .IR /dev/ram0 " is moved from " / " to " /initrd |
fea681da | 413 | continue to be accessible. However, the |
8478ee02 | 414 | .IR /proc/mounts |
fea681da MK |
415 | entries are not updated. |
416 | .PP | |
417 | 2. With the current kernel, if directory | |
8478ee02 MK |
418 | .IR /initrd " does not exist, then " |
419 | .I /dev/ram0 | |
fea681da | 420 | will NOT be fully unmounted if |
8478ee02 | 421 | .IR /dev/ram0 |
fea681da MK |
422 | is used by any process or has any file-system mounted on it. |
423 | If | |
8478ee02 | 424 | .IR /dev/ram0 " is NOT fully unmounted, " |
fea681da | 425 | then |
8478ee02 | 426 | .IR /dev/ram0 |
fea681da MK |
427 | will remain in memory. |
428 | .PP | |
429 | 3. Users of | |
8478ee02 | 430 | .IR /dev/initrd |
fea681da MK |
431 | should not depend on the behavior give in the above notes. |
432 | The behavior may change in future versions of the Linux kernel. | |
433 | .\" | |
434 | .\" | |
435 | .\" | |
436 | .SH AUTHOR | |
437 | The kernel code for device | |
438 | .BR initrd | |
439 | was written by Werner Almesberger <almesber@lrc.epfl.ch> and | |
440 | Hans Lermen <lermen@elserv.ffm.fgan.de>. | |
441 | The code for | |
442 | .BR initrd | |
443 | was added to the baseline Linux kernel in development version 1.3.73. |