Open Source › LamBoot filesystem crates › lamfold-cpio
lamfold-cpio
cpio archives and whole initramfs chains, compressed members included, read as a tree.
forbid(unsafe_code)
|
2 required dependencies
What lamfold-cpio is for
lamfold-cpio lets an initramfs read like a filesystem, so a bootloader can look inside one. Debian 13's own 57 MiB initramfs (a microcode archive, then a compressed main one) reads with every file identical to what unmkinitramfs extracts.
Basis: Folds a cpio stream into a directory tree; odc and old binary archives parse through cpio_reader.
Part of lamfold: A thin frontend over the lamfold substrate (v0.1.5), which supplies its codecs, block cache, bounded parsing and integrity checks.
Add it to your crate
[dependencies]
lamfold-cpio = "0.1"
Or cargo add lamfold-cpio. On Debian unstable or testing, the packaged crate is librust-lamfold-cpio-dev (rust-lamfold-cpio).
What it reads
| Feature | Status |
|---|---|
| Initramfs chains: several newc or CRC archives back to back, as initramfs-tools and dracut write them | Read as the kernel unpacks them |
| Hard links (newc stores the data once) | Every link reads the data |
| CRC archives (070702) | Regular files' checksums verified |
| odc and old binary archives | Read, through cpio_reader |
| Compressed archives in the chain: gzip, zstd, xz, legacy .lzma, LZ4 legacy frames | Decoded and folded in (0.1.2) |
What it refuses
- bzip2 and LZO (lzop) archives
- A compressed archive inside a decompressed one, as the kernel does
Decompressed members together are capped at 512 MiB.
What it depends on, and what it doesn't
Avoids: Unpacking to disk or a shell: It reads in memory, under a cap.
Always
- lamfold 0.1.5: The substrate
- cpio_reader 0.1.2: odc and old binary archive parsing
Only with a feature
None.
Cargo features
| Feature | Default | What it adds |
|---|---|---|
| gzip, zstd, xz, lz4 | Yes | Each codec (xz also reads legacy .lzma) |
| std | Yes | std support |
How it's tested
Real GNU cpio archives and Debian's initramfs.
No GPL drivers in the boot path
Until 2026 LamBoot read most Linux filesystems through about a dozen prebuilt UEFI filesystem driver binaries from the EfiFs (GPL-3.0) and rEFInd (GPL-2.0) projects. Three things ruled them out at once. Debian's free-software guidelines and Fedora's packaging rules reject a prebuilt .efi blob that isn't built from source in the archive. Microsoft doesn't sign GPLv3 code for Secure Boot, and loading a separate UEFI driver binary removes the ShimLock protocol that shim 15.8 relies on. And GPL binaries sit badly beside a permissively licensed loader. These crates replace those drivers with readers compiled into LamBoot itself. The whole family · LamBoot
The lamfold stack
Disk filesystems: lamxfs · lambutter · lamlvm · lamzfs · lamexfat · lamfat