Differences between current version and previous revision of initrd(4).
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 4 | Last edited on Monday, December 29, 2003 11:35:43 am | by CraigBox | |
Older page: | version 3 | Last edited on Monday, December 29, 2003 9:13:52 am | by UserIde | Revert |
@@ -1,329 +1,93 @@
-INITRD
-!!!INITRD
-NAME
-DESCRIPTION
-BOOT-UP OPERATION
-OPTIONS
-CHANGING THE NORMAL ROOT FILE SYSTEM
-USAGE
-CONFIGURATION
-FILES
-SEE ALSO
-NOTES
-AUTHOR
-----
!!NAME
+initrd - boot loader initialized RAM disk
-
-initrd - boot loader initialized RAM disk
!!DESCRIPTION
+The special file __/dev/initrd __ is a read-only block device. Device __/dev/initrd__ is a RAM disk that is initialized (e.g. loaded) by the boot loader before the [Kernel] is started. The kernel then can use the the block device __/dev/initrd__ 's contents for a two phased system boot-up.
+In the first boot-up phase, the kernel starts up and mounts an initial root FileSystem from the contents of __/dev/initrd __ (e.g. RAM disk initialized by the BootLoader). In the second phase, additional drivers or other modules are loaded from the initial root device's contents. After loading the additional modules, a new root file system (i.e. the normal root file system) is [Mount]ed from a different device.
-The special file __/dev/initrd__ is a read-only block
-device. Device __/dev/initrd__ is a RAM disk that is
-initialized (e.g. loaded) by the [boot loader] before the
-[kernel] is started. The kernel then can use the the block
-device __/dev/initrd__'s contents for a two phased system
-boot-up.
-
-In the first boot-up phase, the kernel starts up and mounts
-an initial root file-system from the contents of
-__/dev/initrd__ (e.g. RAM disk initialized by the boot
-loader). In the second phase, additional drivers or other
-modules are loaded from the initial root device's contents.
-After loading the additional modules, a new root file system
-(i.e. the normal root file system) is mounted from a
-different device.
!!BOOT-UP OPERATION
+When booting up with __initrd__ , the system boots as follows:
+# The boot loader loads the kernel program and __/dev/initrd__ 's contents into memory.
+# On kernel startup, the kernel uncompresses and copies the contents of the device __/dev/initrd__ onto device __/dev/ram0 __ and then frees the memory used by __/dev/initrd__ .
+# The kernel then read-write mounts device __/dev/ram0 __ as the initial root file system.
+# If the indicated normal root file system is also the initial root file-system (e.g. __/dev/ram0__ ) then the kernel skips to the last step for the usual boot sequence.
+# If the executable file __/linuxrc__ is present in the initial root file-system, __/linuxrc__ is executed with uid 0. (The file __/linuxrc__ must have executable permission. The file __/linuxrc__ can be any valid executable, including a shell script.)
+# If __/linuxrc__ is not executed or when __/linuxrc__ terminates, the normal root file system is mounted. (If __/linuxrc__ exits with any file-systems mounted on the initial root file-system, then the behavior of the kernel is __UNSPECIFIED__ . See the __NOTES__ section for the current kernel behavior.)
+# If the normal root file has directory __/initrd__ , device __/dev/ram0__ is moved from __/__ to __/initrd__ . Otherwise if directory __/initrd__ does not exist device __/dev/ram0__ is unmounted. (When moved from __/__ to __/initrd__ , __/dev/ram0__ is not unmounted and therefore processes can remain running from __/dev/ram0__ . If directory __/initrd__ does not exist on the normal root file-system and any processes remain running from __/dev/ram0__ when __/linuxrc__ exits, the behavior of the kernel is __UNSPECIFIED__ . See the __NOTES__ section for the current kernel behavior.)
+# The usual boot sequence (e.g. invocation of __/sbin/init__ ) is performed on the normal root file system.
-When booting up with __initrd__, the system boots as
-follows:
-
-
-1. The boot loader loads the kernel program and
-__/dev/initrd__'s contents into memory.
-
-
-2. On kernel startup, the kernel uncompresses and copies the
-contents of the device __/dev/initrd__ onto device
-__/dev/ram0__ and then frees the memory used by
-__/dev/initrd__.
-
-
-3. The kernel then read-write mounts device __/dev/ram0__
-as the initial root file system.
-
-
-4. If the indicated normal root file system is also the
-initial root file-system (e.g. __/dev/ram0__ ) then the
-kernel skips to the last step for the usual boot
-sequence.
-
-
-5. If the executable file __/linuxrc__ is present in the
-initial root file-system, __/linuxrc__ is executed with
-uid 0. (The file __/linuxrc__ must have executable
-permission. The file __/linuxrc__ can be any valid
-executable, including a shell script.)
-
-
-6. If __/linuxrc__ is not executed or when
-__/linuxrc__ terminates, the normal root file system is
-mounted. (If __/linuxrc__ exits with any file-systems
-mounted on the initial root file-system, then the behavior
-of the kernel is __UNSPECIFIED__. See the __NOTES__
-section for the current kernel behavior.)
-
-
-7. If the normal root file has directory __/initrd__,
-device __/dev/ram0__ is moved from __/__ to
-__/initrd__. Otherwise if directory __/initrd__ does
-not exist device __/dev/ram0__ is unmounted. (When moved
-from __/__ to __/initrd__, __/dev/ram0__ is not
-unmounted and therefore processes can remain running from
-__/dev/ram0__. If directory __/initrd__ does not exist
-on the normal root file-system and any processes remain
-running from __/dev/ram0__ when __/linuxrc__ exits,
-the behavior of the kernel is __UNSPECIFIED__. See the
-__NOTES__ section for the current kernel
-behavior.)
-
-
-8. The usual boot sequence (e.g. invocation of
-__/sbin/init__) is performed on the normal root file
-system.
!!OPTIONS
+ The following boot loader options when used with __initrd__ , affect the kernel's boot-up operation:
+;__initrd=__ ''filename'' : Specifies the file to load as the contents of __/dev/initrd__ . For __LOADLIN__ this is a command line option. For __LILO__ __you__ have __to__ use __this__ command __in__ the __LILO__ configuration file __/etc/lilo.config__ . The filename specified with this option will typically be a gzipped file-system image.
+;__noinitrd__ : This boot time option disables the two phase boot-up operation. The kernel performs the usual boot sequence as if __/dev/initrd __ was not initialized. With this option, any contents of __/dev/initrd __ loaded into memory by the boot loader contents are preserved. This option permits the contents of __/dev/initrd__ to be any data and need not be limited to a file system image. However, device __/dev/initrd __ is read-only and can be read only one time after system startup.
+;__root=__ ''device-name'' : Specifies the device to be used as the normal root file system. For __LOADLIN__ this is a command line option. For __LILO__ __this__ is __a__ boot __time__ option __or__ can be used as an option line in the __LILO__ configuration file __/etc/lilo.config__ . The device specified by the this option must be a mountable device having a suitable root file-system.
-
-The following boot loader options when used with
-__initrd__, affect the kernel's boot-up
-operation:
-
-
-__initrd=__''filename''
-
-
-Specifies the file to load as the contents of
-__/dev/initrd__. For __LOADLIN__ this is a command
-line option. For __LILO__ you have to use this command in
-the __LILO__ configuration file __/etc/lilo.config__.
-The filename specified with this option will typically be a
-gzipped file-system image.
-
-
-__noinitrd__
-
-
-This boot time option disables the two phase boot-up
-operation. The kernel performs the usual boot sequence as if
-__/dev/initrd__ was not initialized. With this option,
-any contents of __/dev/initrd__ loaded into memory by the
-boot loader contents are preserved. This option permits the
-contents of __/dev/initrd__ to be any data and need not
-be limited to a file system image. However, device
-__/dev/initrd__ is read-only and can be read only one
-time after system startup.
-
-
-__root=__''device-name''
-
-
-Specifies the device to be used as the normal root file
-system. For __LOADLIN__ this is a command line option.
-For __LILO__ this is a boot time option or can be used as
-an option line in the __LILO__ configuration file
-__/etc/lilo.config__. The device specified by the this
-option must be a mountable device having a suitable root
-file-system.
!!CHANGING THE NORMAL ROOT FILE SYSTEM
+By default, the kernel's settings (e.g. set in the kernel file with __rdev__ or compiled into the kernel file), or the boot loader option setting is used for the normal root file systems. For a NFS-mounted normal root file system, one has to use the __nfs_root_name__ and __nfs_root_addrs__ boot options to give the NFS settings. For more information on NFS-mounted root see the kernel documentation file __nfsroot.txt__ . For more information on setting the root file system also see the __LILO__ and __LOADLIN__ documentation.
+It is also possible for the __/linuxrc__ executable to change the normal root device. For __/linuxrc__ to change the normal root device, __/proc__ must be mounted. After mounting __/proc__ , __/linuxrc__ changes the normal root device by writing into the proc files __/proc/sys/kernel/real-root-dev__ , __/proc/sys/kernel/nfs-root-name__ , and __/proc/sys/kernel/nfs-root-addrs__ . For a physical root device, the root device is changed by having __/linuxrc__ write the new root file system device number into __/proc/sys/kernel/real-root-dev__ . For a NFS root file system, the root device is changed by having __/linuxrc__ write the NFS setting into files __/proc/sys/kernel/nfs-root-name__ and __/proc/sys/kernel/nfs-root-addrs__ and then writing 0xff (e.g. the pseudo-NFS-device number) into file __/proc/sys/kernel/real-root-dev__ . For example, the following shell command line would change the normal root device to __/dev/hdb1__ :
-By default, the
kernel's settings (e.g. set in the kernel
-file with __rdev__ or compiled into the kernel file), or
-the boot loader option setting is used for the normal root
-file systems. For a NFS
-mounted normal
root file system, one
-has to use the __nfs_root_name__ and
-__nfs_root_addrs__ boot options to give the NFS settings.
-For more information on NFS
-mounted root see the kernel
-documentation file __nfsroot.txt__. For more information
-on setting the root file system also see the __LILO__ and
-__LOADLIN__ documentation.
+ echo 0x365 >/proc/sys/
kernel/real
-root-dev
+For a NFS example, the following shell command lines would change the normal root device to the NFS directory __/var/nfsroot__ on a local networked NFS server with IP number 193.8.232.7 for a system with IP number 193.8.232.7 and named 'idefix':
+ echo /var/nfsroot >/proc/sys/kernel/nfs-root-name
+ echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \
+ >/proc/sys/kernel/nfs-root-addrs
+ echo 255 >/proc/sys/kernel/real-root-dev
-It is also possible for the __/linuxrc__ executable to
-change the normal root device. For __/linuxrc__ to change
-the normal root device, __/proc__ must be mounted. After
-mounting __/proc__, __/linuxrc__ changes the normal
-root device by writing into the proc files
-__/proc/sys/kernel/real-root-dev__,
-__/proc/sys/kernel/nfs-root-name__, and
-__/proc/sys/kernel/nfs-root-addrs__. For a physical root
-device, the root device is changed by having __/linuxrc__
-write the new root file system device number into
-__/proc/sys/kernel/real-root-dev__. For a NFS root file
-system, the root device is changed by having __/linuxrc__
-write the NFS setting into files
-__/proc/sys/kernel/nfs-root-name__ and
-__/proc/sys/kernel/nfs-root-addrs__ and then writing 0xff
-(e.g. the pseudo-NFS-device number) into file
-__/proc/sys/kernel/real-root-dev__. For example, the
-following shell command line would change the normal root
-device to __/dev/hdb1__:
- echo 0x365
-For a NFS example, the following shell command lines would change the normal root device to the NFS directory __/var/nfsroot__ on a local networked NFS server with IP number 193.8.232.7 for a system with IP number 193.8.232.7 and named 'idefix':
-
-
- echo /var/nfsroot
!!USAGE
+The main motivation for implementing __initrd__ was to allow for modular kernel configuration at system installation.
+A possible system installation scenario is as follows:
-The main motivation
for implementing
__initrd__ was
to
-allow for modular
kernel configuration at
system
-installation.
+#
The loader program boots from floppy or other media with a minimal kernel (e.g. support
for
__/dev/ram__ , __/dev/
initrd__ , and the ext2 file-system) and loads __/dev/initrd__ __with__ a __gzipped__ version __of__ the __initial__ file-system.
+# The executable __/linuxrc__ determines what is needed
to (1) mount the normal root file-system (i.e. device type, device drivers, file system) and (2) the distribution media (e.g. CD-ROM, network, tape, ...). This can be done by asking the user, by auto-probing, or by using a hybrid approach.
+# The executable __/linuxrc__ loads the necessary modules from the initial root file-system.
+# The executable __/linuxrc__ creates and populates the root file system. (At this stage the normal root file system does not have to be a completed system yet.)
+# The executable __/linuxrc__ sets __/proc/sys/
kernel/real-root-dev,__ unmount __/proc__ , the normal root file
system and any other file systems it has mounted, and then terminates.
+# The kernel then mounts the normal root file system.
+# Now that the file system is accessible and intact, the boot loader can be installed.
+# The boot loader is configured to load into __/dev/initrd__ a file system with the set of modules that was used to bring up the system. (e.g. Device __/dev/ram0__ can be modified, then unmounted, and finally, the image is written from __/dev/ram0__ to a file.)
+# The system is now bootable and additional
installation tasks can be performed
.
-A possible system installation scenario
is as
-follows:
+The key role of __/dev/initrd__ in the above
is to re-use the configuration data during normal system operation without requiring initial kernel selection, a large generic kernel or, recompiling the kernel.
+A second scenario is for installations where Linux runs on systems with different hardware configurations in a single administrative network. In such cases, it may be desirable to use only a small set of kernels (ideally only one) and to keep the system-specific part of configuration information as small as possible. In this case, create a common file with all needed modules. Then, only the the __/linuxrc__ file or a file executed by __/linuxrc__ would be different.
-1
. The loader program boots from floppy or other media with
-a minimal kernel (e.g. support for __/dev/ram__,
-__/dev/initrd__, and
the ext2
file-system) and loads
-
__/dev/initrd__ with
a gzipped version of the initial
-file
-system
.
+A third scenario is more convenient recovery disks
. Because information like the location of
the root
file-system partition is not needed at boot time, the system loaded from
__/dev/initrd __ can use
a dialog and/or auto
-detection followed by a possible sanity check
.
+Last but not least, Linux distributions on CD-ROM may use __initrd__ for easy installation from the CD-ROM. The distribution can use __LOADLIN__ to directly load __/dev/initrd__ from CD-ROM without the need of any floppies. The distribution could also use a __LILO__ boot floppy and then bootstrap a bigger ram disk via __/dev/initrd__ from the CD-ROM.
-2. The executable __/linuxrc__ determines what is needed
-to (1) mount the normal root file-system (i.e. device type,
-device drivers, file system) and (2) the distribution media
-(e.g. CD-ROM, network, tape, ...). This can be done by
-asking the user, by auto-probing, or by using a hybrid
-approach.
-
-
-3. The executable __/linuxrc__ loads the necessary
-modules from the initial root file-system.
-
-
-4. The executable __/linuxrc__ creates and populates the
-root file system. (At this stage the normal root file system
-does not have to be a completed system yet.)
-
-
-5. The executable __/linuxrc__ sets
-__/proc/sys/kernel/real-root-dev,__ unmount __/proc__,
-the normal root file system and any other file systems it
-has mounted, and then terminates.
-
-
-6. The kernel then mounts the normal root file
-system.
-
-
-7. Now that the file system is accessible and intact, the
-boot loader can be installed.
-
-
-8. The boot loader is configured to load into
-__/dev/initrd__ a file system with the set of modules
-that was used to bring up the system. (e.g. Device
-__/dev/ram0__ can be modified, then unmounted, and
-finally, the image is written from __/dev/ram0__ to a
-file.)
-
-
-9. The system is now bootable and additional installation
-tasks can be performed.
-
-
-The key role of __/dev/initrd__ in the above is to re-use
-the configuration data during normal system operation
-without requiring initial kernel selection, a large generic
-kernel or, recompiling the kernel.
-
-
-A second scenario is for installations where Linux runs on
-systems with different hardware configurations in a single
-administrative network. In such cases, it may be desirable
-to use only a small set of kernels (ideally only one) and to
-keep the system-specific part of configuration information
-as small as possible. In this case, create a common file
-with all needed modules. Then, only the the __/linuxrc__
-file or a file executed by __/linuxrc__ would be
-different.
-
-
-A third scenario is more convenient recovery disks. Because
-information like the location of the root file-system
-partition is not needed at boot time, the system loaded from
-__/dev/initrd__ can use a dialog and/or auto-detection
-followed by a possible sanity check.
-
-
-Last but not least, Linux distributions on CD-ROM may use
-__initrd__ for easy installation from the CD-ROM. The
-distribution can use __LOADLIN__ to directly load
-__/dev/initrd__ from CD-ROM without the need of any
-floppies. The distribution could also use a __LILO__ boot
-floppy and then bootstrap a bigger ram disk via
-__/dev/initrd__ from the CD-ROM.
!!CONFIGURATION
+The __/dev/initrd __ is a read-only block device assigned major number 1 and minor number 250. Typically __/dev/initrd__ is owned by __root.disk __ with mode 0400 (read access by root only). If the Linux system does not have __/dev/initrd__ already created, it can be created with the following commands:
+__
+ mknod -m 400 /dev/initrd b 1 250
-The __/dev/initrd__ is a read-only block device assigned
-major number 1 and minor number 250. Typically
-__/dev/initrd__ is owned by __
root.
disk__ with mode
-0400 (read access by root only). If the Linux system does
-not have __
/dev/initrd__ already created, it can be
-created with the following commands:
+ chown
root:
disk /dev/initrd
+Also, support for both "RAM disk" and "Initial RAM disk" (e.g. __CONFIG_BLK_DEV_RAM=y__ and __CONFIG_BLK_DEV_INITRD=y__ ) support must be compiled directly into the Linux kernel to use __/dev/initrd__ . When using __/dev/initrd__ , the RAM disk driver cannot be loaded as a module.
-__ mknod -m 400 /dev/initrd b 1 250
-chown root:disk /dev/initrd
-__Also, support for both CONFIG_BLK_DEV_RAM=y__ and __CONFIG_BLK_DEV_INITRD=y__ ) support must be compiled directly into the Linux kernel to use __/dev/initrd__. When using __/dev/initrd__, the RAM disk driver cannot be loaded as a module.
!!FILES
+''/dev/initrd''
+''/dev/ram0''
+''/linuxrc''
+''/initrd''
-
-''/dev/initrd
-/dev/ram0
-/linuxrc
-/initrd''
!!SEE ALSO
+chown(1), mknod(1), __/dev/ram__ (4), freeramdisk(8), rdev(8), The documentation file ''initrd.txt'' in the kernel source package, the LILO documentation, the LOADLIN documentation, the SYSLINUX documentation.
-
-chown(1), mknod(1), /dev/ram(4),
-freeramdisk(8), rdev(8), The documentation
-file ''initrd.txt'' in the kernel source package, the
-LILO documentation, the LOADLIN documentation, the SYSLINUX
-documentation.
!!NOTES
+1. With the current kernel, any file systems that remain mounted when __/dev/ram0__ is moved from __/__ to __/initrd__ continue to be accessible. However, the __/proc/mounts__ entries are not updated.
+2. With the current kernel, if directory __/initrd__ does not exist, then __/dev/ram0__ will NOT be fully unmounted if __/dev/ram0__ is used by any process or has any file-system mounted on it. If __/dev/ram0__ is NOT fully unmounted, then __/dev/ram0__ will remain in memory.
-1
. With the current kernel, any file systems that remain
-mounted when
__/dev/ram0__ is moved from __/__ to
-__
/initrd__ continue to be accessible
. However,
the
-__/proc/mounts__ entries are not updated
.
+3
. Users of
__/dev/initrd__ should not depend on the behavior give in the above notes
. The behavior may change in future versions of
the Linux kernel
.
-
-2. With the current kernel, if directory __/initrd__ does
-not exist, then __/dev/ram0__ will NOT be fully unmounted
-if __/dev/ram0__ is used by any process or has any
-file-system mounted on it. If __/dev/ram0__ is NOT fully
-unmounted, then __/dev/ram0__ will remain in
-memory.
-
-
-3. Users of __/dev/initrd__ should not depend on the
-behavior give in the above notes. The behavior may change in
-future versions of the Linux kernel.
!!AUTHOR
-
-
-
The kernel code for device __initrd__ was written by
-
Werner Almesberger
-
__initrd__ was added to the baseline Linux kernel in
-
development version 1.3.73.
-----
+The kernel code for device
__initrd__ was written by Werner Almesberger <almesber@lrc.epfl.ch> and Hans Lermen <lermen@elserv.ffm.fgan.de>. The code for
__initrd__ was added to the baseline Linux kernel in development version 1.3.73.