Content files, directories, and symbolic links

You can modify the content of your target image by adding or removing files and directories from the fileset XML files.

Target images are assembled from the content files specified in the configuration files in your deployment directory (see Configuration files).

Files and directories

All content files and directories must be specified in a fileset. The simplest way to add a new file to your target image is to specify it in an existing fileset. For example, to add the new app file $QNX_DEPLOYMENT_WORKSPACE/target/apps/demo/denmark/hamlet.bin) to your image:

  1. Place hamlet.bin in an appropriate subdirectory under $QNX_DEPLOYMENT_WORKSPACE/; for example, apps/demo/denmark/.
  2. Use a plain-text editor to edit the fileset XML file (e.g., product/infra/filesets/basefs.denmark.elsinor.xml) to which you want to add hamlet.bin. If your new file is in a new directory, add the directory, then add the file. Thus, your additions to the fileset might look like the following (additions in bold):

    <?xml version="1.0" encoding="UTF-8"?>
    <fileset name="basefs.denmark.elsinor">
    	...
    	<!-- directories -->
    	<directory name="apps/demo" uid="root" gid="nto" mode="0777"/>
    	<directory name="apps/demo/denmark" uid="root" gid="nto" mode="0777"/>
    	
    	<!-- demo -->
    	<file name="apps/demo/denmark/soliloquy.mp4" uid="root" gid="nto" mode="0755"/>
    	<file name="apps/demo/denmark/stage.conf" uid="root" gid="nto" mode="0755"/>
    	<file name="apps/demo/denmark/hamlet.bin" uid="root" gid="nto" mode="0755"/>
    	...
  3. Save your file.
  4. Check if your fileset is in a profile. If it isn't in a profile, add it to a profile and save the modified profile file (see Profiles).
  5. Regenerate the image (see Generate the image).

Directory and file elements in a fileset file include the path and directory or file name, the user and group IDs, and the permissions, in standard octal notation.

If you are adding a file to a new directory, you must explicitly define the new directory. In the previous example, we specify the new directory denmark inside the apps/demo directory. If you need an empty directory, you can specify it in the same way.

If you want to remove a file or a directory and its contents from your image, you can remove them from a fileset.

Note:

Adding directories and files to filesets is the most granular method of modifying the contents of your image. Other methods available include changing the filesets, changing the profiles. and changing the search paths.

Changing destinations

By default, the path where a file (or directory) will be installed on the target system is the same path as the path inside the $QNX_TARGET directory on the host system. However, this location doesn't have to be inside the $QNX_TARGET directory.

If you need to change the file's location on the target system, you can set a new destination path. To change the destination of files or directories:

  1. In a plain-text editor, open the fileset that specifies the files or directories you want to install to a different path (e.g., basefs.denmark.elsinor.xml).
  2. In the relevant <file> element, add “dest”= and specify a valid location. For example:

    dest="england"

    For example, to set an alternative destination for the hamlet.bin binary, you might add the following for dest:

    <file name="apps/demo/hamlet.bin"
    dest="usr/england/lib/hamlet.bin"
    uid="root" gid="nto" mode="0755"/>
  3. Save the file.
  4. Generate the image (see Generate the image in the Generating a Target Image chapter).

The image generation process will copy the file or directory to the location you specified.