Add cpio format to create an initramfs #48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
I'd love to see a
cpiooutput format inmmdebstrap. It shouldn't go throughtarfirst, but produce thecpioarchive directly.Use case is to build a system that I can easily
kexecinto.Current workaround is use the
taroutput, and inside afakerootuntar it again into a temporary location and runfind . -print0 | cpio -o -0 --format=newc. The output I pipe intozstd.I think direct cpio output would be a nice feature!
Do you happen to know about a cpio archiver which is able to accept a tarball on standard input and then produce the cpio on standard output without having to unpack everything first?
In the worst case, I can also write that myself. cpio is not a very complicated format.
I looked for one and couldn't find any.
Would it be so much more effort to not use tar if cpio output is used?
Usually the bsdtar utility from the libarchive-tools package contains surprising amounts of functionality. Can you test if this works for your use-case:
Nice, didn't know this tool existed.
Format needs to be
newcto work.cpiois some other format the kernel doesn't like.There's a small caveat though. Hard linked files are missing after extraction.
When I extract the archive manally with
cpio -iI get:I don't really care about those two files. But it might break in other cases.
Bsdtar manpage states:
I could add a hook to replace any hard links. Alternatively
tar -c --hard-dereferencewould work.Right, throwing in a
--hard-dereferenceon the tar side of things is easy. Would you be fine for mmdebstrap to require bsdtar for this functionality?I also wonder how the format should be called given the format differences between cpio and newc. Should it just be --format=newc and should the auto-detect filename extension be
*.newc?I changed by build script to pipe the output of mmdebstrap through bsdtar. So I'm not sure if it would be a big benefit if mmdebstrap did the piping for me. Might save a few bytes in my script and other users might not know about bsdtar either if they need cpio output, so perhaps there is some benefit for this approach.
My original idea was to somehow use the cpio command instead of tar. Either implemented directly, or by allowing a hook which is executed inside the namespace/fakeroot/etc.
I wouldn't mind, I already use it anyway. But imo it should be an optional dependency.
*.newclooks awkward to me. I don't think anyone would need a different flavour of cpio other thanSVR4with (cpio -H crc) or without (cpio -H newc) checksum. The linux kernel supports only those two.rpmseems to use some derivation of thecrcformat,paxseems to support multiple formats. With some luck nobody else uses cpio.bsdtardoesn't appear to support writing thecrcformat, which leaves us withnewcas the only useful thing forbsdtarto output whencpiois chosen.