Find the answer to your Linux question:
Results 1 to 3 of 3
I copy isolinux/initrd.img from RedHat 6.2 DVD to local floder. I want to add a file to initrd.img. I tried many command(gunzip,cpio...), but failed. I run "file initrd.img" and it ...
  1. #1
    Just Joined!
    Join Date
    Jan 2012
    Posts
    2

    Question How to rebuild RedHat 6.2 isolinux/initrd.img?

    I copy isolinux/initrd.img from RedHat 6.2 DVD to local floder. I want to add a file to initrd.img. I tried many command(gunzip,cpio...), but failed. I run "file initrd.img" and it shows "initrd.img: data". But I can mount it with command "mount -t sysfs initrd.img /mnt/initrd", but I can not add file to it. Could anybody help?

  2. #2
    Just Joined!
    Join Date
    Jan 2012
    Posts
    2
    I found 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

  3. #3
    Just Joined!
    Join Date
    Jan 2012
    Location
    Rowlett, TX
    Posts
    4
    Extract:
    Code:
    mkdir initrd && cd initrd
    gzip -cd < ../initrd.img | cpio -id
    Compress:
    Code:
    find . -print0 | cpio --null -o --format=newc | gzip -9 > ../initrd.img

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...