Building a BSP

When you have finished building the BSP you should have a complete, bootable image you can transfer from your host system to your target board and boot.

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 everything it needs (aside from standard system headers) in 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 will be that BSP's root directory.

Note:

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

After you have the system provided by QNX up and running, you will 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

Building an image consists of the following general tasks:

  1. Build the BSP, either from the command line or in the IDE.
  2. Prepare the IFS, either from the command line or in the IDE.

The BSP build process uses the Makefile that is shipped with every BSP. When you run make, the command uses instructions in the Makefile to perform the following tasks:

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

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 won'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 where they are extracted.

For more information about the make and mkifs utilities, see make and mkifs 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., ifs-dkelsinore-ghost8.bin and ifs-dkelsinore-ghost8-graphics.bin).

You need to run make clean to remove these files before you build the BSP in the command line. You don't need to remove them if you will use the IDE to build the BSP, however; the IDE looks after cleaning up before the build.

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 Extract from the command line).
  2. Set the environment variables for the appropriate QNX SDP version:

    • Windows: run the qnxsdp-env.bat script.

    • Linux: source the qnxsdp-env.sh script.

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

    This action removes both default IFS images (the one with Screen and the one without Screen).

  4. In the BSP's root directory, type make to build the BSP, and create its directories. This command:

    • builds the BSP and creates its directories
    • places the IFS image in the BSP's /images directory

You should now be ready to prepare the IFS image that you will copy to your target.

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).

Build the BSP (IDE)

You can use the QNX Momentics IDE on Linux, Mac or Windows to work with a BSP. To build the BSP in the QNX Momentics IDE, launch the IDE, then:

  1. Download the BSP archive, and import it into the IDE (see Import to the IDE).

    After you've imported your BSP source, you're ready to build.

  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 binaries required for the image. If you don't modify any of the source code, you won't need to do this step again. You can check the progress and outcome of your build in Console view.

  3. Switch from the C/C++ Perspective to the QNX System Builder Perspective.
  4. In the System Builder Projects view, expand your BSP project, and then expand the images folder and double-click a buildfile (.build file).
  5. In the view that opens, under the Actions pane, double-click Build Image. This step builds the image itself and whenever you modify the buildfile, you should run this step to rebuild the image.
  6. The IDE starts to build the image. Select the Console and Problems views in the C/C++ perspective to look for issues with the build.

You are now be ready to prepare the IFS image that you copy to your target.