How is initrd.img packed and compressed?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi,

In order to work around a known upstream bug I needed to add a udev
rule to pxeboot initrd.img on CentOS 7.

The process is straightforward:
1 - extract the pxeboot initrd.img  to a new directory
2 - add the udev rule needed to fix the bug
3 - pack and compress it back in initrd.img format

The resulting updated image works, it fixes the upstream bug and life
is good. But although it works, it's not 
 the same format as the original initrd.img that ships with the distro.
I would like to know the proper incantation 
used to package initrd.img

Now for the specifics. The original image: http://mirror.steadfast.net/
centos/7.4.1708/os/x86_64/isolinux/initrd.img
is extracted: /usr/lib/dracut/skipcpio  initrd.img | xzcat | cpio -i -d
and after adding the needed udev rule, it gets packed and compressed as
follows:

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

Now for the difference. FIrst the original distro image:
# file initrd.img
initrd.img: xz compressed data

# file patched-initrd.img
patched-initrd.img: LZMA compressed data, streamed
Without the --format=lzma  flag it fails to boot. 

Does anyone know how this is done properly ?

Thanks,
-Mike

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux