1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00
sortix--sortix/mkinitrd/mkinitrd.8

127 lines
3.4 KiB
Groff
Raw Normal View History

2017-06-03 15:27:30 -04:00
.Dd October 7, 2015
2015-10-07 15:24:39 -04:00
.Dt MKINITRD 8
.Os
.Sh NAME
.Nm mkinitrd
.Nd make initialization ramdisk
.Sh SYNOPSIS
.Nm mkinitrd
.Op Fl \-filter Ns "=" Ns Ar rules-file
.Op Fl \-format Ns "=" Ns Ar format
2015-12-27 20:04:01 -05:00
.Op Fl \-manifest Ns "=" Ns Ar manifest-file
2015-10-07 15:24:39 -04:00
.Fl o Ar destination
.Ar directory ...
.Sh DESCRIPTION
.Nm
produces a
.Xr initrd 7
for the Sortix
.Xr kernel 7
at the
.Ar destination .
2016-04-10 09:19:12 -04:00
It is an archive in the
2015-10-07 15:24:39 -04:00
.In sortix/initrd.h
format of files and directories.
.Pp
Every specified
.Ar 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.
2015-10-07 15:24:39 -04:00
.Pp
2016-04-10 09:19:12 -04:00
Hardlinks are detected and preserved to avoid data duplication.
Inode times are truncated to second precision due to format limitations.
Inodes 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.
2015-10-07 15:24:39 -04:00
.Pp
.Xr initrdfs 8
can be used to view the files produced by
.Nm .
.Pp
The options are as follows:
.Bl -tag -width "12345678"
.It Fl \-filter Ns "=" Ns Ar rule-file
Include only files and directories during the recursive search that matches
rules in the
.Ar rule-file
in the format specified under
.Sx FILTER RULES .
.It Fl \-format Ns "=" Ns Ar format
Produce the archive in the specified format.
This is for forward compatibility and only
2015-10-07 15:24:39 -04:00
.Sy sortix-initrd-2
is supported.
.Sy default
is an alias for the newest format
.Sy sortix-initrd-2 .
.Nm
will default to a newer format when one is introduced and this allows
.Nm
to support old callers during the transitional period.
2015-12-27 20:04:01 -05:00
.It Fl \-manifest Ns "=" Ns Ar manifest-file
Include only files and directories during the recursive search whose path
exactly matches a line in the
.Ar manifest-file .
2015-10-07 15:24:39 -04:00
.It Fl o , Fl \-output Ns "=" Ns Ar destination
Store the produced
.Xr initrd 7
at the specified
.Ar destination .
.El
.Sh FILTER RULES
The rule format is line based and leading whitespace is skipped.
Lines starting with a
2015-10-07 15:24:39 -04:00
.Li #
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.
2015-10-07 15:24:39 -04:00
.Bl -tag -width "12345678"
.It Sy default Ar boolean
The
.Ar boolean
parameter is either
.Sy true
or
.Sy false
and determines whether a file or directory is included if no other rules match
it.
This defaults to
.Sy true .
2015-10-07 15:24:39 -04:00
.It Sy include Ar path
Include the file or directory if it matches
.Ar path .
.It Sy exclude Ar path
Exclude the file or directory if it matches
.Ar path .
.El
.Pp
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.
2015-10-07 15:24:39 -04:00
.Sh EXIT STATUS
.Nm
will exit 0 on success and non-zero otherwise.
.Sh EXAMPLES
.Bd -literal
# By default include everything except these directories:
2015-10-07 15:24:39 -04:00
exclude /dev
exclude /src/sysroot
exclude /tmp
.Ed
.Sh SEE ALSO
.Xr initrd 7 ,
.Xr kernel 7 ,
.Xr initrdfs 8 ,
.Xr update-initrd 8
.Sh BUGS
The path pattern matching should be upgraded to use
.Xr fnmatch 3 .
The initrd format does not losslessly represent the Sortix
.Li struct stat .