Changing where mkifs looks for files

Updated: April 19, 2023

You can change where mkifs looks for files it includes in the OS image.

To include files from host locations other than the standard set of paths for binary files in your QNX SDP installation, you have a number of options:
Note: The examples below are for a Linux host. Commands on a Windows host may differ.

Modify MKIFS_PATH

To set MKIFS_PATH, on your host system use the shell command export MKIFS_PATH=newpaths. For example:
export MKIFS_PATH=/usr/nto/x86_64/bin:/usr/nto/x86_64/sys:/usr/nto/x86_64/dll:/usr/nto/x86_64/lib:/project/bin

This variable determines the default set of host search paths for all files specified in the buildfile. Note that you can augment the search paths for all files with the -r option or for specific files with the [search] attribute (see the next sections).

Add the -r command option to mkifs

In the Makefile, you can provide the -r option to the mkifs command to modify the search paths. With this option, a set of standard paths within the specified directories will be searched for files to include in the image. Suppose you specify:
mkifs -r /scratch
The mkifs utility would then search the standard paths for storing binaries within /scratch before searching any other host paths. The exact paths searched are based on the target CPU architecture, which you can set through the PROCESSOR environment variable. Suppose you set PROCESSOR to x86_64 and then run mkifs with the -r setting above. This would cause mkifs to search paths such as /scratch/x86_64/sbin (and others within /scratch/x86_64/) before searching those specified in MKIFS_PATH. For more details, see the -r option in the mkifs reference.

Modify the search path

By specifying the [search=newpaths] attribute, you can make mkifs look in paths other than those in MKIFS_PATH, for a specific set of files listed in the buildfile. The newpaths component is a colon-separated list of pathnames, which can include environment variables. For instance, to augment the existing MKIFS_PATH pathnames to also include the directory /mystuff, you would specify:
[search=${MKIFS_PATH}:/mystuff]
For more information, see the search attribute description in the mkifs entry.

Specify the pathname explicitly

You can explicitly specify the pathname for a file you want mkifs to include in the OS image, by using a leading / character (e.g., /release/data1). However, with this instruction, mkifs places the file at the default path in the image (/proc/boot/data1 in our example). To place it elsewhere, you must also specify the target location; for example:
/some_other_location/data1 = /release/data1

See also Location of files on the target later in this chapter.

Create the contents of a file in line

In some cases it may be simplest to create the contents of a file in line. That is, instead of having an external file on the host system and instructing mkifs is to include it in the image, you can include an inline file's contents right in the buildfile. For example:
data1 = {
 This is a data file, called data1, contained in the image.
 This is a convenient way of associating data files with your programs.
}
CAUTION:
If your inline file includes special characters, such as a closing brace (“}”) or a backslash (\), then you must escape these characters (see the Inline files section).