initramfs archives on Linux can consist of a series of concatenated, gzipped cpio files.
Given such an archive, how can one extract all the embedded archives, as opposed to only the first one?
The following is an example of a pattern which, while it appears to have potential to work, extracts only the first archive:
while gunzip -c | cpio -i; do :; done <input.cgz
I've also tried the skipcpio helper from dracut to move the file pointer past the first cpio image, but the following results in a corrupt stream (not at the correct point in the input) being sent to cpio:
# this isn't ideal -- presumably would need to rerun with an extra skipcpio in the pipeline # ...until all files in the archive have been reached. gunzip -c <input.cgz | skipcpio /dev/stdin | cpio -i