Pages

How to modify and repack an initrd image file

Create a temporary Directory 

#mkdir /root/initrd
#cd /root/initrd

Then uncompress and extract the initrd

#zcat /boot/initrd-2.6.18-164.6.1.el5.img | cpio -idmv

Modify the initrd and repack the intrd as new image

# find . | cpio -o -c | gzip -9 > /boot/test.img


For Redhat-7 use the below mentioned Procedure

Create a temporary Directory 

#mkdir /root/initrd
#cd /root/initrd

Then uncompress and extract the initrd

# xz -dc < initrd.img | cpio --quiet -i --make-directories

Modify the initrd and repack the intrd as new image

find . 2>/dev/null | cpio --quiet -c -o | xz -9 --format=lzma >"new-initrd.img"


No comments:

Post a Comment