Building a BSP

Updated: May 06, 2022

When you have finished building the BSP, you will have a complete image that you can transfer from your host to your target system and boot into.

Overview

A BSP can be extracted to any directory and built there. The BSP is anchored in the directory you extract or copy it to. No matter where you move this directory, if you type make from inside the directory, the process pulls in everything it needs (aside from standard system headers) from the BSP's own directory, and everything that make builds is installed in the BSP's directory.

If you plan to work with multiple, different BSPs, we recommend that you create a top-level BSP directory, then create subdirectories for each different BSP. The directory you create for each BSP is that BSP's root directory.

Note:

The instructions provided here are generic. For detailed, step-by-step instructions, see your BSP User's Guide.

After you have the system provided by QNX up and running, you probably need to modify its configuration. For information about the buildfile, its syntax, and how to modify it, see the chapter OS Image Buildfiles.

The build process

You can build an OS image from either the command line or the IDE, as explained in the subsections that follow. The BSP build process uses the Makefile that is shipped with the BSP. When you run make, the command uses instructions in the Makefile to:

  • Copy the contents of the prebuilt directory into the install directory.
  • Run mkifs with a modified search path, which prepares the IFS.

The install directory is the first directory mkifs searches when it looks for the components it needs to generate an IFS. If mkifs needs a component that it can't locate in the BSP directories, it scans the QNX SDP's /target directory for binaries or libraries, and uses the component it finds there.

The BSP build doesn't overwrite anything in your QNX SDP installation's /host or /target directories. Any binaries, libraries, or images that are generated when the BSP is built remain in the BSP directory from which they are extracted.

For more information, see the make and mkifs entries in the Utilities Reference.

Cleaning up the /images directory

After you have unzipped the BSP, you may notice prebuilt IFS files in the BSP's /images directory (e.g., x86_64-nuc-graphics.bin and x86_64-generic.bin).

You need to run make clean (command line) or Clean Project (IDE) to remove these files before you build the BSP.

Build the BSP (command line)

You can use the command line on Linux, Mac, or Windows to work with a BSP.

To build a BSP using the command line, open a terminal, then:

  1. Download the BSP archive, and unzip it (see Extracting from the command line).
  2. Set the environment variables for the appropriate QNX SDP version:

    • Windows: Run the qnxsdp_ver-env.bat script.

    • Linux and Mac: Source the qnxsdp_ver-env.sh script.

  3. In the BSP's root directory, type make clean to remove the default image files from the /images directory.

    This action removes all default IFS images.

  4. In the BSP's root directory, type make. This command:

    • Builds the BSP and creates its directories
    • Places the IFS image in the /images directory
    Note: We recommend that you use make to build the OS image. If you use mkifs directly, you need to use the -r option to tell mkifs where to find the binaries (see mkifs).

You can now prepare the IFS image that you will copy to your target.

Build the BSP (IDE)

You can use the QNX Momentics IDE on Linux, Mac, or Windows to work with a BSP. You can build the entire BSP in the QNX Momentics IDE, which includes building the source and the IPL and IFS images. To do so:

  1. If you haven't done so, launch the IDE, then import the BSP archive (which was downloaded for you using the QNX Software Center) into the IDE (see “Import to the QNX Momentics IDE” section below for details).

  2. If you haven't already, switch to the C/C++ Perspective, then in the Project Explorer view, right-click the BSP source project and select Build Project.

    This step builds the entire BSP, which includes the images and the binaries required for the images. You can check the progress and outcome of your build in the Console view.

  3. If you want to modify the image, open the .build file under the System Builder Files folder. After you've made your changes, right-click the BSP source project and select Build Project.

Import to the QNX Momentics IDE

If you use the QNX Momentics IDE to build your BSP, you don't need to extract the ZIP file. To import the BSP code into the IDE:

  1. Open the QNX Momentics IDE.

  2. From the C/C++ Perspective, select File > Import.

  3. Expand the QNX folder.

  4. Select QNX Source Package and BSP (archive) from the list and then click Next.

  5. In the Select the package dialog, click Browse for ZIP Archive....

  6. In the file selector, navigate to and select the BSP archive file that you downloaded earlier, and then click Open and then click Next.

  7. Confirm the BSP package you want is shown in the Selected Package list and then click Next.

  8. Optionally, set the Project Name and Location to import the BSP archive file. Defaults are provided for the project name and location, but you can override them if you choose.

  9. Click Finish. The project is created and the source is imported from the archive.

You should see the project in the Project Explorer view (e.g., bsp-renesas-r-car-h3). You can now build your BSP.