mkrcfsimg

Build a read-only compressed filesystem (RCFS) image (QNX)

Syntax:

mkrcfsimg [option...] [buildfile] [directory] [outputfile]
mkxfs -t rcfs [option...] [buildfile] [directory] [outputfile]

Runs on:

Linux, Microsoft Windows

Options:

-D
Treat undeclared intermediate directories as errors. If there's a target filesystem entry of /x/y, and /x has never occurred explicitly in the buildfile, the patch file, the input directory, or as a child of a recursively included directory, then /x is considered an undeclared intermediate directory.
-d
Display warnings for undeclared intermediate directories.
-f path
Fill the specified text file with a list of all files in the output image, including a hash of the file contents, and data similiar to that returned by the ls -l command. The file is truncated if it already exists. Each line has the form:
target-path uid:gid mode_in_octal size [SHA256]

You can express the mode_in_octal as a 6-digit octal number; see the st_mode member in the stat structure.

-l inputline
("el") Process inputline before interpreting the buildfile. Input lines given to mkrcfsimg should be quoted to prevent interpretation by the shell. Multiple -l options are processed in the order specified. This option is especially useful for setting global attributes when the input is a directory only.
-n[n..]
Don't use timestamps in the files. Using the -n option permits identical images in binary format. One n strips timestamps from files that vary from run to run. More than one strips ALL time information, which is necessary on Windows NTFS with daylight saving time.
-o directory
("oh") Specify a directory to be used for all permanent build artifacts, other than the output image itself.
-p patchfile
Apply patching instructions from this file (see "Patch files," below).
-r root
Search the default paths in this directory before the default.
-v[v..]
Operate verbosely. Specifying additional v options increases the verbosity. The default is quiet operation.

Description:

The mkrcfsimg utility reads a text buildfile and/or a specified directory and produces a binary image file containing a read-only compressed filesystem (fs-rcfs.so) created from the given input. You can copy this file to target media at a later stage.

Note: Don't confuse this command with mkrcfs, which formats an RCFS, but doesn't process a buildfile.

You specify the input and output on the command line:

buildfile
The filename of the buildfile that describes the contents of the RCFS; use a hyphen (-) to specify standard input (the default).
directory
The root of a directory hierarchy to be appended to the file list specified in buildfile (if any). The default is no directory.
outputfile
The filename of the image file containing the RCFS; use a hyphen (-) to specify standard output (the default). Note that you can specify the output file only if you specified at least either a buildfile or a directory.

If you don't specify either a buildfile or a directory, a buildfile is expected as input from standard input. The output is always an image file; if you don't specify outputfile, image-file data will be produced on standard output.

Buildfiles

The mkrcfsimg command uses the same buildfile grammar as mkifs, but supports a different set of attributes. The buildfile is basically just a list of files that you want to be included in the RCFS image file when it's built by mkrcfsimg. As well as identifying the files to be included, you can specify various attributes that are used to set parameters of the filesystem and the files in it. For example, you can specify the filesystem's label, or the compression algorithm for individual files.

Note: You can't use a backslash (\) to break long lines into smaller pieces.

In a buildfile, a pound sign (#) indicates a comment; anything between it and the end of the line is ignored. There must be a space between a buildfile command and the pound sign.

Each line is in the form:

[attributes] file_specification

where the attributes (with the enclosing square brackets) and the file specification are both optional.

You can use an attribute:

Attributes provide information about the file following the attribute. They are enclosed in square brackets; when combining attributes (e.g., to specify both the user ID and the group ID), enclose both attribute tokens in the same pair of square brackets. For example:

# correct way
[uid=5 gid=5] filename
# incorrect way
[uid=5] [gid=5] filename

There are two types of attributes:

Boolean attributes
Those prefixed with a plus (+) or minus (-) sign.
Value attributes
Those ending with an equals sign (=) followed by a value. Don't put any spaces around the equals sign.

A question mark (?) before an attribute makes the setting conditional. The attribute is set only if it hasn't already been set. For example:

?+followlink 

sets the +followlink attribute only if +followlink or -followlink hasn't already been set.

The file_specification takes one of the following forms:

path
The file is copied from the host to the location in the image defined by the prefix attribute. If path isn't absolute, mkrcfsimg looks for it in the locations identified by the search attribute.
target_path=host_path
The specified file or contents of the specified directory are fetched from the host filesystem and placed into the image.
target_path={contents}
An inline definition. The contents of the file are listed within the buildfile itself, enclosed in braces ({ })—the file doesn't exist on the host system anywhere. The contents of the inline file can't be on the same line as the opening or closing brace.
Note: The mkrcfsimg utility doesn't parse the contents of an inline file for anything but the closing brace. For example, mkrcfsimg doesn't interpret a pound sign (#) in an inline file as the beginning of a comment. The syntax of the inline file depends on what it's used for on the target system.

Closing braces (}) and backslashes (\) in an inline file must be escaped with a backslash.

You can enclose a filename in double quotes (") if it includes spaces or unusual characters.

Attributes

In mkrcfsimg buildfiles, the following attributes are supported:

An OR-bar indicates that either the first element or the second element must be present, but not both (e.g., +|-followlink means either +followling or -followlink, but not +-followlink).

block_size attribute

block_size=bsize

Set the block size for the RCFS; bsize can be 0 to use the default, or the size in kilobytes: 4, 8, 16 (the default), 32, or 64.

cd attribute

cd=path

Set the current working directory to the specified pathname before attempting to open the host file. The default is the directory from which you invoked mkrcfsimg.

compress attribute (boolean)

+|-compress

Enable or disable compression, using LZO if enabled.

compress_type attribute

compress_type=compression_type

Set the compression type:

Value Type Compression Decompression Amount
0 None Very fast Very fast 0%
1, 2 LZO Fast Very fast 30–50% on executables
3 UCL Slow Fast 40–65% on executables

Specifying a compression type of 0 is the same as specifying the -compress attribute. Compression types 1 and 2 are identical.

dperms attribute

dperms=perm_spec

Set the access permissions of the directory. See the perms attribute for more information.

filter attribute

filter=filter_spec

Run the host file through the filter program specified, presenting the host file data as standard input to the program and using the standard output from the program as the data to be placed into the RCFS. Default is no filter. You can specify a filter_spec of none. This is useful if you need to override a global filter specification.

[+|-followlink]target_path=host_path

If you specify +followlink or omit it, then whenever an item x is taken from the host filesystem and x is a symbolic link, mkrcfsimg resolves the symbolic link and includes its target file or directory. If you specify -followlink, mkrcfsimg includes the symbolic link itself in the image filesystem. It's up to you to include in the image whatever the link points to.

gid attribute

gid=id_spec

Set the group ID number for the file. The value of this attribute may be either a number or an asterisk (*). If it's an asterisk, the group ID is taken from the host file; for an inline file, the group ID is the group of the user running mkrcfsimg. The default value for this attribute is *.

label attribute

label=string

Set a plain-text string (up to 32 bytes) to record in the superblock.

mtime attribute

mtime=time_spec

Set the timestamps of the files or directories to the specified time. The time_spec must be either:

Timestamps specified with the mtime attribute aren't affected by the -n option.

optional attribute (boolean)

+|-optional

If true, and the host file can't be found, output a warning and continue building the embedded filesystem. If false, and the host file can't be found, output an error message and exit mkrcfsimg. The default is true.

perms attribute

perms=perm_spec

Set the access permissions of the file. The perm_spec can be one of the following:

The default is *.

Note: When running on a Windows host, mkrcfsimg can't get the execute (x), setuid ("set user ID"), or setgid ("set group ID") permissions from the file. Use the perms attribute to specify these permissions explicitly. You might also have to use the uid and gid attributes to set the ownership correctly. To determine whether or not a utility needs to have the setuid or setgid permission set, see its entry in the Utilities Reference.

ELF executables and shared objects are automatically marked as executable (unless you specify [+raw]).

prefix attribute

prefix=path

Set the prefix on the target file names. The default is the empty string.

search=path[:path...]

This attribute specifies that mkrcfsimg should search for the file in the named locations on the host system. The search directory portion of the host file name isn't included in the name that's stored in the RCFS. Colon separators and forward slashes in the paths are the standard Unix conventions, but for Windows searches, you must use the standard Windows conventions, such as semicolon separators and backslashes in the paths.

type attribute

type=file_type

Set the type of the files being created in the image filesystem. Allowable types are:

Note: Specifying [type=dir] tells mkrcfsimg to make the named file a directory; you don't need to specify the type when you're copying the contents of a directory. For example, this command:
[type=dir]/usr/bin=/usr/nto/x86/bin

creates an empty directory named /usr/bin, with the same owner and permissions as for the host directory. To recursively copy /usr/nto/x86/bin to /usr/bin, you just need to specify:

/usr/bin=/usr/nto/x86/bin

uid attribute

uid=id_spec

Set the user ID number for the file. The value of this attribute may be either a number or an asterisk (*). If it's an asterisk, the user ID is taken from the host file; for an inline file, the user ID is the user running mkrcfsimg. The default value for this attribute is *.

verifier attribute

verifier=verifier_type

Enable hashing and set the type of verifier:

inline
RCFSv2 inline
log
Generate a file called verifier.log in the output filesystem, containing a set of SHA-256 hashes, one per file.

This attribute is always applied globally.

zone attribute

zone=number

Assign a zone number to the file or directory. Zones let you group files; the file data is physically arranged on disk by zone number. During mounting, all of the files in a given zone can be validated by doing a sequential read of the raw blocks encompassing the zone. If you use zones, your RCFS image must be cryptographically signed.

Patch files

Patch files let you override the user ID, group ID, and permissions of certain files, depending on their location and filename pattern. Patches are applied after all files have been collected (from the buildfile and/or the specified directory). Consequently, patch files can override settings specified in the buildfile.

Patch files must contain only lines of the form:

#comment

or:

type:path:pattern:uid:gid:perms

In comment lines, # must be the very first character. The entire line is regarded as a comment and is ignored.

The type is either d or f, optionally followed by r. Type d patches are applied only to directories, and type f patches are applied only to files. An r indicates that the patch should be applied recursively within path; without r, the patch is applied to path only.

The pattern is a filename pattern that specifies which files to apply the patch to. The uid and gid must be decimal numbers, while perms must be an octal number (see chmod). Note that it isn't possible to set only the user ID, group ID, or permissions; for each match, all three are affected. As mentioned above, the RCFS ignores any settings for the user ID and group ID.

Exit status:

0
Successful completion.
1
An error occurred.