2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
Slackware initrd mini HOWTO
|
|
|
|
by Patrick Volkerding, volkerdi@slackware.com
|
2024-11-14 21:00:55 +01:00
|
|
|
Thu Nov 14 19:43:44 UTC 2024
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2024-11-08 23:17:50 +01:00
|
|
|
This document describes how to create and install an initrd.
|
|
|
|
Also see "man mkinitrd".
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
1. What is an initrd?
|
|
|
|
2. Why to I need an initrd?
|
|
|
|
3. How do I build the initrd?
|
|
|
|
4. Now that I've built an initrd, how do I use it?
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
1. What is an initrd?
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
Initrd stands for "initial ramdisk". An initial ramdisk is a very small
|
2009-08-26 17:00:38 +02:00
|
|
|
Linux filesystem that is loaded into RAM and mounted as the kernel boots,
|
|
|
|
and before the main root filesystem is mounted.
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
2. Why do I need an initrd?
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
The usual reason to use an initrd is because you need to load kernel
|
2024-11-08 23:17:50 +01:00
|
|
|
modules before mounting the root partition, or because you need additional
|
|
|
|
userspace support for doing so (as with LVM). Modern Linux is practically
|
|
|
|
expected to be using an initrd, so even in cases where it *works* to boot
|
|
|
|
without one, you're probably less likely to run into bugs by using one.
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
3. How do I build the initrd?
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2024-11-08 23:17:50 +01:00
|
|
|
Just installing the kernel package will automatically run the geninitrd
|
|
|
|
script to produce an initrd, so normally you won't need to build one --
|
|
|
|
it will be done for you. However, if you need to generate an initrd you
|
|
|
|
can do so by just running "geninitrd" which will build an initrd for the
|
|
|
|
newest kernel in /boot. You can also specify the kernel to build an initrd
|
|
|
|
for on the command line, like this:
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2024-11-08 23:17:50 +01:00
|
|
|
geninitrd /boot/vmlinuz-6.11.7
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2024-11-08 23:17:50 +01:00
|
|
|
If you need specific modules, or you'd like to use a different initrd
|
|
|
|
generator than Slackware's mkinitrd, or to make other adjustments, see
|
|
|
|
the /etc/default/geninitrd configuration file. You can also disable
|
|
|
|
automatic initrd generation if you don't want it.
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
4. Now that I've built an initrd, how do I use it?
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
Now that you've got an initrd (/boot/initrd.gz), you'll want to load
|
2018-05-28 21:12:29 +02:00
|
|
|
it along with the kernel at boot time. If you use LILO for your boot
|
2009-08-26 17:00:38 +02:00
|
|
|
loader you'll need to edit /etc/lilo.conf and add a line to load the
|
2018-05-28 21:12:29 +02:00
|
|
|
initrd. Here's an example section of lilo.conf showing how this is
|
2009-08-26 17:00:38 +02:00
|
|
|
done:
|
|
|
|
|
|
|
|
# Linux bootable partition config begins
|
2018-05-28 21:12:29 +02:00
|
|
|
image = /boot/vmlinuz-generic
|
2024-11-08 23:17:50 +01:00
|
|
|
initrd = /boot/initrd-generic.img
|
2010-05-19 10:58:23 +02:00
|
|
|
root = /dev/sda6
|
2018-05-28 21:12:29 +02:00
|
|
|
label = Slackware
|
2009-08-26 17:00:38 +02:00
|
|
|
read-only
|
|
|
|
# Linux bootable partition config ends
|
|
|
|
|
2024-11-08 23:17:50 +01:00
|
|
|
The initrd is loaded by the "initrd = /boot/initrd-generic.img" line.
|
2009-08-26 17:00:38 +02:00
|
|
|
Just add the line right below the line for the kernel image you use.
|
|
|
|
Save the file, and then run LILO again ('lilo' at the command line).
|
|
|
|
You'll need to run lilo every time you edit lilo.conf or rebuild the
|
|
|
|
initrd.
|
|
|
|
|
2024-11-08 23:17:50 +01:00
|
|
|
Other bootloaders also support the use of an initrd.
|
2009-08-26 17:00:38 +02:00
|
|
|
See the documentation for those programs for details on using an
|
|
|
|
initrd with them.
|
|
|
|
|
|
|
|
|
|
|
|
---------
|
|
|
|
|
|
|
|
Have fun!
|