I went with a simpler implementation that uses Go compression packages to do the work. The downside of this is that the compression Level is a bit weird to set, since most libraries discourage setting the numeric compression level directly. This is configured by setting `deviceinfo_initfs_compression`, the value it expects is a string in the form: `FORMAT[:LEVEL]`, where `[:LEVEL]` is optional. Actually setting the variable at all is optional... if nothing is specified, or it can't parse the format/level from the string value, it defaults to using gzip with the "default" level for the package (which tries to mirror gzip's default, or something). The level can be one of `default`, `fast`, `best`. To configure gzip with the fastest compression (so, bigger size): deviceinfo_initfs_compression="gzip:fast"` To configure zstd with the most compression: `deviceinfo_initfs_compression="zstd:best"` To configure zstd with default compression: `deviceinfo_initfs_compression="zstd"` (or `deviceinfo_initfs_compression="zstd:default"`) In this case, `gzip:default` is assumed: deviceinfo_initfs_compression="bananas:mmmm"`
mkinitfs is a tool for generating an initramfs. It was originally designed
for postmarketOS, but a long term design goal is to be as distro-agnostic as
possible. It's capable of generating a split initramfs, in the style used by
postmarketOS, and supports running boot-deploy to install/finalize boot files
on a device.
Building
Building this project requires a Go compiler/toolchain and make:
$ make
To install locally:
$ make install
Installation prefix can be set in the generally accepted way with setting
PREFIX:
$ make PREFIX=/some/location
# make PREFIX=/some/location install
Other paths can be modified from the command line as well, see the top section of
the Makefile for more information.
Tests (functional and linting) can be executed by using the test make target:
$ make test
Usage
The tool can be run with no options:
# mkinitfs
Configuration is done through a series of flat text files that list directories
and files, and by placing scripts in specific directories. See man 1 mkinitfs
for more information.