-   Red Hat (
-   -   How to rebuild RedHat 6.2 isolinux/initrd.img? (

xiebiwu 01-10-2012 04:54 AM

How to rebuild RedHat 6.2 isolinux/initrd.img?
I want to modify isolinux/initrd.img, which in RedHat 6.2 DVD. I tried many command(gunzip,cpio...), but failed. I run "file initrd.img", and it shows "initrd.img: data". Could anybody help to extract and rebuild it?

John VV 01-10-2012 10:09 PM

did you install RHEL 6 first ?

or are you trying to modify the data that is burned on the install dvd ?

your first step will be to update the system ( otherwise your modified image will be replaced with a kernel update )

su -
yum update

xiebiwu 01-10-2012 10:24 PM

Actually I install RedHat 6.2 and copy isolinux/initrd.img from DVD to local floder. Currently I can mount it and type "mount -t sysfs initrd.img /mnt/initrd". Now I want to add a file to initrd.img. I don't know how to do it.

xiebiwu 01-11-2012 03:25 AM

I find the solution:

1) Extract
mv initrd.img initrd.img.xz
xz --format=lzma initrd.img.xz --decompress
mkdir initrd-new
cd initrd-new
cpio -ivdum < ../initrd.img

2) Add/delete/modify files

3) Build
find . -print |cpio -o -H newc | xz --format=lzma > ../initrd.img

All times are GMT -5. The time now is 02:58 PM.