Documentation
¶
Overview ¶
Package initramfs builds deterministic SVR4 newc cpio archives (Linux initramfs images) from a directory tree or a tar/tar.gz rootfs.
The archive is byte-for-byte deterministic: entries are written in the order given, with a zero mtime and nlink 1, so the same input always yields the same image. PackTree walks a directory; PackTar streams a (possibly gzipped) tar; both accept extra in-memory Entry values (config files, injected guest binaries) that are appended before the archive trailer.
The package is format-only and has no notion of any particular guest's layout: callers decide what extra entries to inject and under what names.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanName ¶
CleanName returns a cpio-safe relative entry name, rejecting empty names and names containing a NUL byte.
func Pack ¶
Pack writes entries as a deterministic SVR4 newc cpio archive, in order, followed by the trailer.
func PackTar ¶
PackTar writes a (possibly gzipped) tar rootfs from r as a newc initramfs, then appends extras before the trailer. Regular files are streamed rather than buffered.
Types ¶
type Entry ¶
type Entry struct {
Name string
Mode uint32
UID uint32
GID uint32
RDevMajor uint32
RDevMinor uint32
Data []byte
}
Entry is one filesystem entry in a newc initramfs archive. Mode is a full st_mode (type bits OR permission bits); for device nodes set RDevMajor and RDevMinor. Data holds a regular file's contents or a symlink's target.