slackware-current/source/a/mkinitrd
Patrick J Volkerding 1ced63dfd3 Fri Nov 15 21:35:55 UTC 2024
ap/vim-9.1.0867-x86_64-1.txz:  Upgraded.
l/aom-3.11.0-x86_64-1.txz:  Upgraded.
l/libnvme-1.11.1-x86_64-1.txz:  Upgraded.
xap/vim-gvim-9.1.0867-x86_64-1.txz:  Upgraded.
2024-11-15 22:59:31 +01:00
..
_initrd-tree Fri Mar 31 18:01:09 UTC 2023 2023-03-31 21:43:36 +02:00
0001-Fix-LUKSTRIM-with-C-T-and-UUID.patch Sun Dec 15 18:20:57 UTC 2019 2019-12-16 08:59:48 +01:00
0002-bail-if-temp-dir-is-not-created.patch Fri Jul 16 18:53:33 UTC 2021 2021-07-17 08:59:52 +02:00
0003-blacklist.40-usb_modeswitch.rules.patch Tue Oct 12 19:22:20 UTC 2021 2021-10-13 08:59:43 +02:00
0004-check-if-BASEDEV-is-a-partition-of-a-RAID-volume.patch Tue Jan 25 06:16:36 UTC 2022 2022-01-25 12:00:01 +01:00
0005-support-modules-compressed-with-xz.patch Wed Jan 26 20:46:44 UTC 2022 2022-01-27 08:59:55 +01:00
0006-coreutils-9.1-ensure-target-dir-exists.patch Tue Apr 26 19:45:46 UTC 2022 2022-04-27 06:59:51 +02:00
0007-kmod30.patch Sat Jul 9 18:50:24 UTC 2022 2022-07-10 01:00:16 +02:00
0008-fix-check-if-BASEDEV-is-a-partition-of-a-RAID-volume.patch Tue Feb 28 21:33:32 UTC 2023 2023-02-28 23:45:27 +01:00
0009-exclude-99-nfs.rules.patch Thu Aug 10 05:48:31 UTC 2023 2023-08-10 08:29:19 +02:00
0010-fix-test-for-jfs-xfs-repair-tools.patch Tue Nov 21 21:15:30 UTC 2023 2023-11-21 23:50:07 +01:00
busybox-dot-config Sat Oct 5 21:24:49 UTC 2024 2024-10-06 00:04:43 +02:00
doinst.sh Thu Jul 25 20:22:54 UTC 2024 2024-07-25 23:16:46 +02:00
geninitrd Fri Nov 15 21:35:55 UTC 2024 2024-11-15 22:59:31 +01:00
geninitrd.default Thu Nov 7 21:46:13 UTC 2024 2024-11-07 23:42:38 +01:00
init Tue Apr 26 19:45:46 UTC 2022 2022-04-27 06:59:51 +02:00
mkinitrd Tue Apr 26 19:45:46 UTC 2022 2022-04-27 06:59:51 +02:00
mkinitrd.8 Tue Apr 26 19:45:46 UTC 2022 2022-04-27 06:59:51 +02:00
mkinitrd.conf.5 Tue Apr 26 19:45:46 UTC 2022 2022-04-27 06:59:51 +02:00
mkinitrd.conf.sample Mon May 28 19:12:29 UTC 2018 2018-05-31 23:39:35 +02:00
mkinitrd.SlackBuild Fri Nov 8 22:17:50 UTC 2024 2024-11-09 00:53:08 +01:00
mkinitrd.tempfile.to.mktemp.patch Mon Apr 27 20:27:30 UTC 2020 2020-04-28 08:59:53 +02:00
mkinitrd_command_generator.8 Sun Mar 3 22:03:39 UTC 2019 2019-03-04 08:59:47 +01:00
mkinitrd_command_generator.sh Fri Nov 8 22:17:50 UTC 2024 2024-11-09 00:53:08 +01:00
README.initrd Thu Jul 25 20:22:54 UTC 2024 2024-07-25 23:16:46 +02:00
remove-orphaned-initrds Mon Oct 28 21:22:48 UTC 2024 2024-10-28 23:11:58 +01:00
setup.01.mkinitrd Fri Nov 8 22:17:50 UTC 2024 2024-11-09 00:53:08 +01:00
slack-desc Mon May 28 19:12:29 UTC 2018 2018-05-31 23:39:35 +02:00

Slackware initrd mini HOWTO
by Patrick Volkerding, volkerdi@slackware.com
@DATE@

This document describes how to create and install an initrd, which may be 
required to use some features of the kernel.  Also see "man mkinitrd".

1.  What is an initrd?
2.  Why do I need an initrd?
3.  How do I build the initrd?
4.  Now that I've built an initrd, how do I use it?


1.  What is an initrd?

Initrd stands for "initial ramdisk".  An initial ramdisk is a very small 
Linux filesystem that is loaded into RAM and mounted as the kernel boots, 
and before the main root filesystem is mounted.

2.  Why do I need an initrd?

The usual reason to use an initrd is because you need to load kernel 
modules before mounting the root partition.  Usually these modules are 
required to support the filesystem used by the root partition (ext3, 
reiserfs, xfs), or perhaps the controller that the hard drive is attached 
to (SCSI, RAID, etc).  Essentially, there are so many different options 
available in modern Linux kernels that it isn't practical to try to ship 
many different kernels to try to cover everyone's needs.  It's a lot more 
flexible to ship a generic kernel and a set of kernel modules for it.

3.  How do I build the initrd?

The easiest way to make the initrd is to use the mkinitrd script included 
in Slackware's mkinitrd package.  We'll walk through the process of 
upgrading to the generic @KERNEL_VERSION@ Linux kernel using the packages
found in Slackware's slackware/a/ directory.

First, make sure the kernel, kernel modules, and mkinitrd package are 
installed (the current version numbers might be a little different, so 
this is just an example):

  installpkg kernel-generic-@KERNEL_VERSION@-@ARCH@-@BUILD@.tgz
  installpkg kernel-modules-@KERNEL_VERSION@-@ARCH@-@BUILD@.tgz
  installpkg mkinitrd-@MKINITRD_VERSION@-@ARCH@-@BUILD@.tgz

Change into the /boot directory:

  cd /boot

Now you'll want to run "mkinitrd".  I'm using ext4 for my root
filesystem, and since mkinitrd should figure out any other modules
it requires, I shouldn't need to specify any others:

  mkinitrd -c -k @KERNEL_VERSION@ -m ext4

This should do two things.  First, it will create a directory
/boot/initrd-tree containing the initrd's filesystem.  Then it will
create an initrd (/boot/initrd.gz) from this tree.  If you wanted to,
you could make some additional changes in /boot/initrd-tree/ and
then run mkinitrd again without options to rebuild the image.  That's
optional, though, and only advanced users will need to think about that.

Here's another example:  Build an initrd image using Linux @KERNEL_VERSION@
kernel modules for a system with an ext3 root partition on /dev/sdb3:

  mkinitrd -c -k @KERNEL_VERSION@ -m ext3 -f ext3 -r /dev/sdb3


4.  Now that I've built an initrd, how do I use it?

Now that you've got an initrd (/boot/initrd.gz), you'll want to load
it along with the kernel at boot time.  If you use LILO for your boot
loader you'll need to edit /etc/lilo.conf and add a line to load the
initrd.  Here's an example section of lilo.conf showing how this is
done:

# Linux bootable partition config begins
image = /boot/vmlinuz-@KERNEL_VERSION@-generic
  initrd = /boot/initrd.gz
  root = /dev/sda6
  label = @LILO_KERNEL_NAME@
  read-only
# Linux bootable partition config ends

The initrd is loaded by the "initrd = /boot/initrd.gz" line.
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.

Other bootloaders such as syslinux also support the use of an initrd.
See the documentation for those programs for details on using an
initrd with them.

Some, such as GRUB, require the initrd to be named similarly to the
kernel. So, for this kernel:

/boot/vmlinuz-@KERNEL_VERSION@-generic

You would want to rename your initrd to this:

/boot/initrd-@KERNEL_VERSION@-generic.img

In fact, if you use the geninitrd script to make your initrd (which it
will pretty much do automatically for the generic kernel) it will name
it this way, and will make a compatibilty symlink initrd.gz.


---------

Have fun!