How to Remaster the Linux Ram Disks - The Advanced Method

  • 7022610
  • 29-Jan-2018
  • 20-Feb-2018


PlateSpin Migrate


This document describes the process of breaking down an Linux RAM Disk (LRD) for remastering so it may be customized to provide extra functionality as required in a specific environment.


This article will not go into the details on making specific modifications to the LRD. It will however, provide the steps to extract the contents of the initrd.gz files found in the x86_64 or i586 directories to make changes and remaster the ISO.

Modification of the LRD requires a Linux system. Root access is required along mkisofs and mkinitrd. There is no distribution preference for the host system.

These instructions assume that you are logged in as a regular user and can "su" to root to run the commands documented below.

1. Extracting the desired LRD
2. Mount the desired ISO image:
mount -o loop bootofx.x2p.iso /mnt
3. Create an image directory. This will be used for the disc build.
mkdir cdimg
4. Copy the contents of the ISO to the image directory
cp -R /mnt/* cdimg/
5. Extract the initrd.gz file and delete the original. The example given uses the x86_64 directory.  Substitute i586 for x86_64 if modification of the 32 bit portion of the LRD is required.

cd cdimg/x86_64
zcat initrd.gz |cpio -idmv

rm initrd.gz

6. Make the desired modifications.

7. Recreate the initrd.gz file after moving the vmlinuz file. Run the following commands from the cdimg/x86_64 directory:
mv vmlinuz  ../
find . | cpio --create --format='newc' > ../initrd

The first command moves the vmlinuz file from the current directory to the parent.
The second builds the new uncompressed initrd file in the parent directory.

8. Remove the files from the cdimg/x86_64 directory.  The required files are now in the initrd file with the exception of the vmlinuz that was moved to the parent directory.
rm -Rf *
9. Move the initrd and vmlinuz files back into the proper directory. Compress the initrd file during the move.
mv ../initrd . && gzip initrd
mv ../vmlinuz .

The first command moves the initrd file back into the proper directory and compresses it.
The second moves the vmlinuz file back into the proper directory. This file is a compressed Linux kernel. 

Following this example, the vmlinuz file and initrd.gz file should now be in cdimg/x86_64. No other files should be in this directory. 

NOTE:  It is critical that both these files are back in the proper directory.  The disc will fail without them.
10. Create the disk image.
cd ../../
mkisofs -o newboot.iso -b isolinux/isolinux.bin -c isolinux/ -no-emul-boot -boot-load-size 4 -boot-info-table -joliet-long cdimg

The first command moves you up to the parent of directory of cdimg. The second builds the new ISO image.  The ISO image filename will be newboot.iso. The last parameter is the directory where the new ISO contents are located. Refer to the mkisofs (8) man page for details of the other parameters.

The new iso will be found in the current directory.

Additional Information

If you are simply wanting to add an answer file to the LRD please see article 7013485 - How to perform an unattended registration of a target physical machine . See article 7018432 - How To build the Linux RAM Disk for injecting drivers into the LRD.