MKINITRD(8)

NAME
mkinitrd - make initialization ramdisk

SYNOPSIS
mkinitrd [--filter=rules-file] [--format=format] [--manifest=manifest-file] -o destination directory ...

DESCRIPTION
mkinitrd produces a initrd(7) for the Sortix kernel(7) at the destination. It is an archive in the <sortix/initrd.h> format of files and directories.

Every specified directory is used as a root directory and is recursively searched for files and directories matching the filter. If multiple directories are specified, the directories are merged together. In case two files with the same path conflict, precedence is given to the file in the root directory specified first.

Hardlinks are detected and preserved to avoid data duplication. Inode times are truncated to second precision due to format limitations. Inode are stored with uid 0 and gid 0 of the root user. The format is not compressed but can be compressed externally if it is decompressed during bootloading.

initrdfs(8) can be used to view the files produced by mkinitrd.

The options are as follows:

--filter=rule-file
    Include only files and directories during the recursive search that matches rules in the rule-file in the format specified under FILTER RULES.

--format=format
    Produce the archive in the specified format. This is for forward compatibility and only sortix-initrd-2 is supported. default is an alias for the newest format sortix-initrd-2. mkinitrd will default to a newer format when one is introduced and this allows mkinitrd to support old callers during the transitional period.

--manifest=manifest-file
    Include only files and directories during the recursive search whose path exactly matches a line in the manifest-file.

-o, --output=destination
    Store the produced initrd(7) at the specified destination.

FILTER RULES
The rule format is line based and leading whitespace is skipped. Lines starting with a # character are ignored as comments. The first word on a line must be one of the following commands and the rest of the line is its parameter. Trailing whitespace is not ignored.

default boolean
    The boolean parameter is either true or false and determines whether a file or directory is included if no other rules match it. This defaults to true.

include path
    Include the file or directory if it matches path.

exclude path
    Exclude the file or directory if it matches path.

The rules are checked on the paths relative to the root directories during the recursive descent. The last rule to match a path decides whether it is included or not. Directory are not descended into if they are excluded. The pattern patch is simple and matches paths exactly.

EXIT STATUS
mkinitrd will exit 0 on success and non-zero otherwise.

EXAMPLES

    # By default include everything except these directories:
    exclude /dev
    exclude /src/sysroot
    exclude /tmp

SEE ALSO
initrd(7), kernel(7), initrdfs(8), update-initrd(8)

BUGS
The path pattern matching should be upgraded to use fnmatch(3). The initrd format does not losslessly represent the Sortix struct stat.