![]() |
![]() |
![]() |
![]() |
Build an embedded transaction filesystem (QNX)
mketfs [-Ddnv] [-l inputline] [-p patchfile] [buildfile [outputfile]]
QNX Neutrino, Linux, Microsoft Windows
The mketfs utility reads a text buildfile describing an embedded transaction filesystem (ETFS) and produces a binary image file containing the ETFS as a sequence of transactions. You can copy this file to flash at a later stage, using etfsctl.
![]() |
Don't confuse this command with mkifs, which builds an OS image filesystem, or mkefs, which builds an embedded filesystem. |
The input and output files are specified on the command line:
The mketfs utility generates a list of clusters, which are sized to match the hardware (1024, 2048, or 4096 bytes). Each cluster has a header of type struct etfs_trans, which is a fixed 16 bytes. So the actual size of the image file is the size of the input data (rounded up to a multiple of the cluster size) plus 16 bytes times the number of clusters. When etfsctl writes to the filesystem, it removes the etfs_trans structure. As the devio layer is putting the cluster into hardware, it generates a new, BSP-specific structure to hold the same information as was in the etfs_trans.
The buildfile uses the same grammar as the mkifs command, but supports different attributes.
The buildfile is basically just a list of files that you want to be included in the ETFS image file when it's built by mketfs. As well as 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 maximum size of the filesystem, or the user and group IDs of the individual files.
![]() |
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:
[attribute] A B C
[attribute] A B C
Attributes provide information about the file following the attribute. They're 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:
A question mark (?) before an attribute makes the setting conditional. The attribute is set only if it hasn't already been set. For example, ?+bigendian sets the +bigendian attribute only if +bigendian or -bigendian hasn't already been set.
The file_specification takes one of the following forms:
![]() |
The mketfs utility doesn't parse the contents of an inline file for
anything but the closing brace.
For example, mketfs 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.
The mketfs command supports the following attributes:
![]() |
You should explicitly specify the cluster_size, block_size and num_blocks attributes as appropriate for your flash device to ensure that the image produced is fully compatible with your specific device. |
![]() |
An OR-bar indicates that either the first element or the second element must be present, but not both (e.g. +|- bigendian means either +bigendian or -bigendian, but not +-bigendian). |
+|-bigendian
Set the byte order for the embedded filesystem to either big (via +bigendian) or little (via -bigendian) endian. The default is little endian.
block_size=bsize
Set the block size for the ETFS. The block size depends on what memory device you have in your target hardware. The default block size is 16 KB.
cd=filename
Set the current working directory to the specified pathname before attempting to open the host file. Default is the directory from which mketfs was invoked.
cluster_size=csize
Set the cluster size for the ETFS. The cluster size depends on what memory device you have in your target hardware. The default cluster size is 1 KB.
dperms=dperms_spec
Set the access permissions of the directory. If specified as a number, the permissions are set to that number (just like the chmod command). If specified as an asterisk (*), the host directory's permissions are used; for an inline directory, the permissions are obtained from the umask of the user running mketfs. Otherwise, a symbolic mode string (which is a subset of chmod's) is used to delete, add, or set permissions.
The symbolic mode string consists of:
You can include more than one symbolic mode string, separating them with a comma (,).
The default dperms_spec is *.
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 embedded filesystem. 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, mketfs resolves the symbolic link and includes its target file or directory. If you specify -followlink, mketfs includes the symbolic link itself in the filesystem. It's up to you to include in the image whatever the link points to.
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 mketfs. The default value for this attribute is *.
mountperms=perms_spec
Set the access permissions for mountpoints. If specified as a number, the permissions are set to that number (just like the chmod command). Otherwise, a symbolic mode string (which is a subset of chmod's) is used to delete, add, or set permissions.
The symbolic mode string consists of:
You can include more than one symbolic mode string, separating them with a comma (,).
The default perms_spec is “0775”.
num_blocks=num_blocks[,num_pad]
You must use this attribute to specify the number of blocks in the flash device (num_blocks). You can also use it to specify the minimum number of blocks in the image file (num_pad). If you specify num_pad, then the image file is padded out to that number of blocks; otherwise the image file is padded to num_blocks blocks.
To keep the image as small as possible (for faster programming of the NAND part), set num_blocks to the appropriate number and set num_pad to 0. Doing this will correctly set the size of the .counts file, so that wear-levelling will be done.
+|-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 mketfs. The default is true.
perms=perms_spec
Set the access permissions of the file. If specified as a number, the permissions are set to that number (just like the chmod command). If specified as an asterisk (“*”), the host file's permissions are used; for an inline file, permissions of 0666 are used. Otherwise, a symbolic mode string (which is a subset of chmod's) is used to delete, add, or set permissions.
The symbolic mode string consists of:
You can include more than one symbolic mode string, separating them with a comma (,).
The default perms_spec is *.
![]() |
When running on a Windows host, mketfs 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. |
prefix=prefix_spec
Set the prefix on the target file names. The default is the empty string.
search=path:path:…
This attribute specifies that mketfs 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 ETFS.
![]() |
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=file_type
Sets the type of the files being created in the ETFS. Allowable types are:
![]() |
Specifying [type=dir] tells mketfs 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=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 mketfs. The default value for this attribute is *.
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.
Here's a sample buildfile, my_etfs.bld:
# A sample buildfile for mketfs [cluster_size=1k block_size=64k num_blocks=240] /home/jgarvey/nto_flash
In this example, we've specified a cluster_size of 1 KB, a block_size of 64 KB and a total device size of 240 blocks (which is the default configuration of fs-etfs-ram). The files and subdirectories from the /home/jgarvey/nto_flash directory on the host system are to be recursively copied into the root directory of the ETFS.
To create an ETFS image file using the above buildfile, invoke mketfs as follows:
mketfs my_etfs.bld my_image.etfs
This creates the my_image.etfs file containing the ETFS filesystem, which can then be copied to the target system as follows:
etfsctl -d /dev/etfs2 -S -e -w my_image.etfs -c
“Embedded transaction filesystem (ETFS)” in the Filesystems chapter of the System Architecture guide
“Filesystem limits” in the Understanding System Limits chapter of the QNX Neutrino User's Guide
![]() |
![]() |
![]() |
![]() |