Search code examples
redhatrhel7cpioinitramfs

How can I repack initramfs image on RHEL7?


On RHEL 7 the initramfs image file format changed. To unpack the image the skipcpio is needed. for example

/usr/lib/dracut/skipcpio /boot/initramfs-3.10.0-957.el7.x86_64.img | gunzip -c | cpio -idmv

I succeeded to unpack the image with the command above but I cannot pack it back. The old way (like it was on RHEL 6) is not working (

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

Is it possible to pack the image back on RHEL7?

Thanks


Solution

  • The packing is the same as old Red Hat Enterprise Linux (RHEL) versions:

    find . | cpio -o -H newc > ../initramfsFile

    gzip -c ../initramfsFile > initramfsFils.img