Skip to content

Commit a9c6704

Browse files
ddissharaldh
authored andcommitted
feat(cpio): add newc archive creation utility
dracut-cpio is a minimal cpio archive creation utility written in Rust. It provides support for a minimal set of features needed to create performant and space-efficient initramfs archives: - "newc" archive format only - reproducible; inode numbers, uid/gid and mtime can be explicitly set - data segment copy-on-write reflinks + using Rust io::copy()'s native copy_file_range() support[1] + optional archive data segment alignment for optimal reflink use[2] - hardlink support - comprehensive tests asserting GNU cpio binary output compatibility 1. Rust io::copy() copy_file_range() rust-lang/rust#75272 2. Data segment alignment We're bending the newc spec a bit to inject zeros after the file path to provide data segment alignment. These zeros are accounted for in the namesize, but some applications may only expect a single zero-terminator (and 4 byte alignment). GNU cpio and Linux initramfs handle this fine as long as PATH_MAX isn't exceeded. Signed-off-by: David Disseldorp <ddiss@suse.de>
1 parent 94fc502 commit a9c6704

File tree

3 files changed

+1740
-0
lines changed

3 files changed

+1740
-0
lines changed

src/dracut-cpio/Cargo.lock

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dracut-cpio/Cargo.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "dracut-cpio"
3+
description = "cpio archive generator for Dracut"
4+
authors = ["David Disseldorp"]
5+
license = "GPL-2.0"
6+
version = "0.1.0"
7+
edition = "2018"
8+
9+
[dependencies]
10+
crosvm = { path = "third_party/crosvm" }
11+
# please avoid adding any more dependencies

0 commit comments

Comments
 (0)