LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   How to rebuild RedHat 6.2 isolinux/initrd.img? (http://www.linuxquestions.org/questions/red-hat-31/how-to-rebuild-redhat-6-2-isolinux-initrd-img-923000/)

xiebiwu 01-10-2012 03: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 09: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 )
Code:

su -
yum update


xiebiwu 01-10-2012 09: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 02: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 03:36 PM.