Add cpio format to create an initramfs #48
Loading…
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
cpio
output format inmmdebstrap
. It shouldn't go throughtar
first, but produce thecpio
archive directly.Use case is to build a system that I can easily
kexec
into.Current workaround is use the
tar
output, and inside afakeroot
untar 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
newc
to work.cpio
is 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 -i
I 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-dereference
would work.Right, throwing in a
--hard-dereference
on 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.
*.newc
looks awkward to me. I don't think anyone would need a different flavour of cpio other thanSVR4
with (cpio -H crc
) or without (cpio -H newc
) checksum. The linux kernel supports only those two.rpm
seems to use some derivation of thecrc
format,pax
seems to support multiple formats. With some luck nobody else uses cpio.bsdtar
doesn't appear to support writing thecrc
format, which leaves us withnewc
as the only useful thing forbsdtar
to output whencpio
is chosen.