Minimal initramfs Modification

Rick Tillery
2015-07-23T19:08:21Z

I need to make a small modification to an existing initramfs image
file (to add driver and executable that need to run before main system
drives are mounted), but I want to do so with minimal changes to the
existing image, in order to avoid incompatibilities with any other
customization that may have been added to the initramfs before.

dracut seems to create initramfs from scratch, using the currently
running environment. But I would prefer to unarchive the image, make
my small modification, re-archive the tree, and then replace the
existing initramfs file (backing up the old one) to be used on the
next reboot. The goal is as small a change as possible from what was
there originally.

I tried using cpio, but it doesn't handle the device directories when
unarchiving without generating errors. And I'm not sure how to use
this to reconstruct the archive, especially with the compression and
early CPIO portions restored correctly.

Is it possible to use dracut or another tool (or tools) to make
minimally invasive changes to the initramfs?

Thanks!
Rick