How do I uncompress an initrd image?

How do I uncompress an initrd image?

How to extract the contents of an initrd. img file?

  1. Step 1: Copy the initrd.
  2. Step 2: initrd.
  3. Step 3: The output of the above gunzip command is a file named ‘ initrd ‘ located in /tmp/initrd folder.
  4. Step 4: Create a folder where you prefer to save and later modify the contents of initrd .
  5. Resources:

How do you modify initrd?

Modify the initrd

  1. Extract the contents of the initrd: mkdir initrd-tmp cd initrd-tmp gzip -dc /mnt/casper/initrd.gz | cpio -id or for Ubuntu 9.10 and later: lzma -dc -S .lz /mnt/casper/initrd.lz | cpio -id.
  2. Modify the files.
  3. Repack them into a new initrd: find .

How do you repack an initrd image?

To keep the same folder hierarchy three steps are needed:

  1. Make CPIO file system archive with simple -o option without newc format in created before eg. base folder:
  2. Make proper archive with newc format containing kernel/x86/microcode/GenuineIntel.bin:
  3. Add gzipped filesystem archive to the proper new_initrd.img:

What is difference between initrd and Initramfs?

Both initrd and ramfs are zipped at compile time, but the difference is, initrd is a block device unpacked to be mounted by the kernel at booting, while ramfs is unpacked via cpio into memory.

How do you inspect initrd?

How to inspect initramfs

  1. extract the microcode by cd path/to/initrd/; cpio -i
  2. extract the basic initrd by cd path/to/initrad/; dd if=/initrd. img of=initrd. img bs=512 skip=48; zcat initrd. img |cpio -i (adjust skip values matching the cpio STDERR output).

What is difference between initrd and initramfs?

How do I view contents of initrd?

lsinitramfs is a command that lists the contents of the initramfs/initrd file with out unzipping it. It only gives a list of the files and can not help in look into the contents of the file. We can also view the long listing using the option “-l” with the command.

What is initrd image in Linux?

The initrd image contains the necessary executables and system files to support the second-stage boot of a Linux system. Depending on which version of Linux you’re running, the method for creating the initial RAM disk can vary. Prior to Fedora Core 3, the initrd is constructed using the loop device.

The initrd image is present under /boot directory and is owned by kernel package. The version of the running kernel on the system will be used to identify the current initrd image used during booting process.

Can I modify the initrd image in production environment?

Modifying initrd in production environment is not recommended, if you have a valid subscription then you should get in touch with your support team to handle any issue which requires initrd modification. Rather than modifying the initrd image, you can also opt to create an updates.img file which is called at a later stage of the BOOT UP.

How to rebuild initrd image after extracting it?

If you perform extract initrd using Method 2 then follow this procedure to rebuild initrd image, navigate to your temporary directory where you did extract initrd image. Remove the initrd file which was already extracted is in the same directory.

Where do I find the initrd file?

The initrd files are usually in /boot directory, named /boot/initrd.img-kversion with a /initrd.img being a symbolic link to the latest installed initrd. The typical Debian user should not care about the initrd because it is created automatically at kernel image’d post-installation time.

author

Back to Top