The searchpaths.cfg file lists the paths the mksysimage.py script searches to gather up the components of the image it is generating.
Search paths are a simple method for specifying which files are included in an image when it is generated. When the scripts and utilities called by mksysimage.py generate an image, they examine the search paths in sequence and use the first instance they find of the file they need.
The searchpaths.cfg file is located at $QNX_DEPLOYMENT_WORKSPACE/infra/utils/. Every searchpaths.cfg file has an infra section that specifies the path mksysimage.py script should search for infrastructure files, and a target section that specifies the paths to search for the files to be included in the image (see Workspace directories).
The contents of a searchpaths.cfg file look like this:
#Search Path for infra files [infra] ${QNX_DEPLOYMENT_WORKSPACE}/infra/boards/board.variant ${QNX_DEPLOYMENT_WORKSPACE}/infra/boards/board ${QNX_DEPLOYMENT_WORKSPACE}/infra/boards/common ${QNX_DEPLOYMENT_WORKSPACE}/infra/ #Search Path for target files [target] ${QNX_DEPLOYMENT_WORKSPACE}/INTERNAL_OVERRIDE/boards/board.variant/<ARCH> ${QNX_DEPLOYMENT_WORKSPACE}/INTERNAL_OVERRIDE/boards/board.variant ${QNX_DEPLOYMENT_WORKSPACE}/INTERNAL_OVERRIDE/<ARCH> ${QNX_DEPLOYMENT_WORKSPACE}/INTERNAL_OVERRIDE ${QNX_DEPLOYMENT_WORKSPACE}/target/boards/board.variant/ifs ${QNX_DEPLOYMENT_WORKSPACE}/target/boards/board.variant ${QNX_DEPLOYMENT_WORKSPACE}/target/boards/common/ifs ${QNX_DEPLOYMENT_WORKSPACE}/target/boards/common ${QNX_DEPLOYMENT_WORKSPACE}/target ${BSP_ROOT_DIR}/images ${BSP_ROOT_DIR}/install/<ARCH> ${BSP_ROOT_DIR}/install ${BSP_ROOT_DIR}/prebuilt/<ARCH> ${BSP_ROOT_DIR}/prebuilt ${QNX_TARGET}/<ARCH> ${QNX_TARGET}
When the image generation process assembles an image, it reads the profile and fileset files to get a list of what it must include in the image (see Profiles and Filesets). It then scans the paths specified in the searchpaths.cfg file, from top to bottom, looking for the items it must use in the process. When it finds what it is looking for, it stops looking. In other words, it ignores all instances in the search paths further down the searchpaths.cfg file.
Search paths paths are listed in the searchpaths.cfg file from the most specific (product and board) to the most general (QNX Neutrino OS). This means that if a product-, board- or even board-variant-specific version of an item exists, the image generation process will find it first and include it the image. If no such specific versions exist, the generation process will continue examining the search paths listed in the searchpaths.cfg file until it finds a less specific version of the item.
For instance, there may be several instances of foo.bin at different paths. The image generation process will use the first instance of foo.bin that it finds. Thus, assuming that the image generation process is using a searchpaths.cfg organized like the one shown above, if it finds:
${QNX_DEPLOYMENT_WORKSPACE}/target/boards/board.variant/foo.bin
it will use this file rather than:
${QNX_DEPLOYMENT_WORKSPACE}/target/foo.bin
because the first path is listed first in the search paths configuration file.
This design allows you to easily override content on a per-board or per-board-variant level, when you require variants in your product based on board or even board-variant.
All files listed in a fileset must be present somewhere in the search paths. If none is found, the image generation proces fails. For example, in the example above, if no foo.bin file is found in any of the specified search paths the image generation process fails.
If you don't want the image generation process to fail when it can't find a file, run mksysimage.py with the -i option (see mksysimage.py), or use the optional attribute when you list a specific file in a fileset (see Making a file optional).
There are several ways to use search paths to modify the contents of a target image:
The example below is taken from QNX Platform for ADAS 1.0. The user has placed her custom target files in the $HOME/qnx_install directory. The second portion of the searchpaths.cfg configuration file instructs the image generation process to look for content at this location before looking in the standard locations.
#Search Path for infra files [infra] ${QNX_DEPLOYMENT_WORKSPACE}/infra/boards/board.variant ${QNX_DEPLOYMENT_WORKSPACE}/infra/boards/board ${QNX_DEPLOYMENT_WORKSPACE}/infra/boards/common ${QNX_DEPLOYMENT_WORKSPACE}/infra/ #Search Path for target files [target] ${HOME}/qnx_install/<ARCH> ${HOME}/qnx_install ${QNX_DEPLOYMENT_WORKSPACE}/INTERNAL_OVERRIDE/boards/board.variant/<ARCH> ${QNX_DEPLOYMENT_WORKSPACE}/INTERNAL_OVERRIDE/boards/board.variant ${QNX_DEPLOYMENT_WORKSPACE}/INTERNAL_OVERRIDE/<ARCH> ${QNX_DEPLOYMENT_WORKSPACE}/INTERNAL_OVERRIDE ${QNX_DEPLOYMENT_WORKSPACE}/target/boards/board.variant/ifs ...
Two environment variables can be used to override the search paths listed in the searchpaths.cfg file:
The value assigned to these environment variables overrides the information in the corresponding infra or target section of searchpaths.cfg. Thus, for example, setting QNX_INFRA_SEARCHPATH to:
${QNX_TARGET_SEARCHPATH}:workspace/ADAS/infra/boards/my_target_board.r12/special
extends the $QNX_INFRA_SEARCHPATH environment variable with:
workspace/ADAS/infra/boards/my_target_board.r12/special
The image generation scripts will use the infra components at this new location and ignore the infra paths specified in the searchpaths.cfg file.
This method is simpler (but less subtle) than adding a line to the searchpaths.cfg file. Everything must be at the location specified by the environment variable. If the image generation process needs something and it is not in the specified directory, the process simply fails. It does not continue searching paths for more generic versions of the component.
If you are working in a Windows environment, use a semi-colon instead of a full-colon when you extend the environment variable. For example:
${QNX_TARGET_SEARCHPATH};workspace/ADAS/infra/boards/my_target_board.r12/special