How do I make an initrd image?

How do I make an initrd image?

Creating initrd initrd can be created with “mkinitrd” command. The location of initrd is /boot directory. The kernel version for which the initrd image is being created needs to be passed as an argument to the mkinitrd command. The current kernel version can be checked with uname command.

How do I create a ramdisk image?

Making a generic ram disk

  1. Make sure ram disk support is compiled in your kernel.
  2. Create a ramdisk device if one does not already exist in /dev:
  3. Zero out the space you need on the ramdisk device:
  4. Make a file system on the ram disk, specifying the size:
  5. Mount the ram disk as you would a regular device:

How do I edit Initramfs?

To modify an initramfs:

  1. Extract the contents of the cpio. gz archive. mkdir tmp_mnt/ gunzip -c initramfs.cpio.gz | sh -c ‘cd tmp_mnt/ && cpio -i’ cd tmp_mnt/
  2. Make changes to the filesystem.
  3. Repack the filesystem into a cpio. gz archive.

How is initrd used in the Linux kernel?

The previous root (from initrd) is then moved to a directory and can be subsequently unmounted. initrd is mainly designed to allow system startup to occur in two phases, where the kernel comes up with a minimum set of compiled-in drivers, and where additional modules are loaded from initrd. This document gives a brief overview of the use of initrd.

What is the special file / dev / initrd?

The special file /dev/initrd is a read-only block device. This device is a RAM disk that is initialized (e.g., loaded) by the boot loader before the kernel is started. The kernel then can use /dev/initrd ‘s contents for a two-phase system boot-up.

How to write to the initrd file system?

(rw is only necessary if writing to the initrd file system.) With LILO, you add the option INITRD= to either the global section or to the section of the respective kernel in /etc/lilo.conf, and pass the options using APPEND, e.g.: For other boot loaders, please refer to the respective documentation.

How does the boot loader work with initrd?

When using initrd, the system typically boots as follows: the boot loader loads the kernel and the initial RAM disk the kernel converts initrd into a “normal” RAM disk and frees the memory used by initrd