Next: , Previous: , Up: Loader commands   [Contents][Index]


17.2.2 initrd

Command: initrd file [file …]

Load, in order, all initrds for a Linux kernel image, and set the appropriate parameters in the Linux setup area in memory. This may only be used after the linux command (see linux) has been run. See GNU/Linux for more info on booting GNU/Linux. For more information on initrds see the GNU/Linux kernel documentation.

A new-style initrd (for kernels newer than 2.6) containing one file with leading path components can also be generated at run time. This can be done by prefixing an argument with newc: followed by the path of the file in the new initrd, a :, and then the GRUB file path to the file data to be be included.

For example:

initrd newc:/etc/ssh/config:(hd0,2)/home/user/.ssh/config \
       newc:/etc/ssh/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key \
       /boot/initrd.gz \
       newc:/init:/home/user/init.fixed

This command will generate two new-style initrds on the fly. The first contains the path ‘/etc/ssh/config’ with the contents of ‘(hd0,2)/home/user/.ssh/config’ and the path ‘/etc/ssh/ssh_host_rsa_key’ with the contents of ‘/etc/ssh/ssh_host_rsa_key’ on the root device. Parent directory paths will automatically be generated as needed. This first generated initrd will then have ‘/boot/initrd.gz’ concatenated after it. Next, another new-style archive will be generated with the contents of ‘/home/user/init.fixed’ in the path ‘/init’ and appended to the previous concatenation. Finally, the result will be sent to the kernel when booted.

Keep in mind that paths that come later will take precedence. So in the example above, the generated path ‘/init’ will overwrite any ‘/init’ in ‘/boot/initrd.gz’. This can be useful when changing the main initrd is undesirable or difficult.


Next: , Previous: , Up: Loader commands   [Contents][Index]