src

There are many open source projects that are integrated into this project. They include projects from:

  • QNX Ports on GitHub
  • QNX projects on Gitlab
  • QNX Sample Apps on Gitlab
  • the internet in general

General approach to project integration

  1. All integrations take advantage of the following features of the project:

    • separate SDP installation located in the qnx800 subfolder created under the project root folder
    • a staging folder created in this folder (named stage) where locally built binaries and artifacts are installed as the different projects are built (this is important for building projects to find artifacts generated from other projects that they are dependent on)

    Similar steps apply to integrating projects from any of the four sources above:

  2. Add a make target for the repo folder or project folder that is unpacked from the project package to be downloaded. Note that if it's for a project on QNX ports, you must add buildfiles as a dependency. Any other project that needs to be built first, must be integrated beforehand using a similar process as described below, and you must add its make target as a dependency.

  3. Perform the following operations in the make target for the project repo being integrated:

    • Add a command to clone the repo or to download the project package.
    • If required, add an option to clone a specific branch or add a command to cd into the folder and checkout a specific branch.
    • If downloading a package, add a command to unpackage the package.
    • If required, you may need to apply a patch to build the project successfully for QNX. A general approach for patching includes:
      • From within the cloned project folder, make any changes required to successfully build the project.
      • Run the git diff command and save the patch in the src/patches folder.
      • Update the make target commands after cloning to run git apply to apply the patch before the build commands.
    • Consult the project build instructions and add commands to cd into the project folder and build the project (note that in some cases, you must make build folders and go into the build folders to build the project).
    • Add commands to install the project binaries and includes (if required) into the src/stage folder that represents the local installation (some projects make install commands may work properly, or you may need to add custom commands to copy to the appropriate spot).
  4. Add the new make target for the project being integrated as a dependency to the all target, so that it builds by default.

  5. Once the project artifacts are successfully built, note where they are located and update the appropriate snippets files to include the artifacts built for the new project.

  6. Rebuild the project and make sure there are no warnings during image generation.

  7. Flash the build and check that the new content is present and running properly. Note that some open source applications expect their content at certain locations that aren't standard in the image, requiring additional recipe updates to add symbolic links to the content to make it also available at an expected path.

Integrations

QNX ports integrations

Refer to the qnx-ports repo at: https://github.com/qnx-ports.

The projects include:

  • bash
  • vim
  • cairo

Example integration: bash

This example reviews the Makefile to see how bash was integrated.

  1. Add a make target for the bash project folder. Here is the make target that was added for bash:

    bash: build-files
        $(RM_HOST) -rf bash
        git clone https://github.com/qnx-ports/bash.git
        touch build-files/ports/bash/nto-x86_64-o/**Makefile**.dnm
        QCONF_OVERRIDE=$(PWD)/qconf-override.mk \
        QNX_PROJECT_ROOT="$(PWD)/bash" make -C build-files/ports/bash install -j4
  2. Complete the make target for bash.

    Note the following:

    • Since this is a QNX ports project, it needs the buildfiles target as a dependency. This target performs the steps to setup the local build folders needed to build QNX ports projects.
    • After cloning the project repo, execute a similar make command as is found in the README for the bash port repo.
  3. Add the new make target for the project being integrated as a dependency to the all target:

    all: bash vim cairo rpi-gpio rpi-mailbox rpi-thermal simple-terminal screenwm SDL SDL_image SDL_ttf SDL_net pattern-race

QNX projects integrations

Refer to the projects repo at: https://gitlab.com/qnx/projects

The projects include:

  • rpi-gpio
  • rpi-mailbox
  • rpi-thermal
  • simple-terminal

Example integration: rpi-gpio

This example reviews the Makefile to see how rpi-gpio was integrated.

Add a make target for the rpi-gpio project folder.

Here is the make target that was added for rpi-gpio:

rpi-gpio: cairo
    $(RM_HOST) -rf rpi-gpio
    git clone https://gitlab.com/qnx/projects/rpi-gpio
    cd rpi-gpio && \
    QCONF_OVERRIDE=$(PWD)/qconf-override.mk \
    make hinstall
    cd rpi-gpio && \
    MY_STAGE=$(PWD)/stage make
    cd rpi-gpio && \
    QCONF_OVERRIDE=$(PWD)/qconf-override.mk \
    MY_STAGE=$(PWD)/stage make install

Completing the make target for the rpi-gpio project

Note the following:

  • Although this project is not from QNX ports, it does have a dependency to the cairo project on QNX ports.
  • After cloning the project repo, execute more build steps than the previous project integration example. The reason for this is that this project uses QNX make, instead of a third party build system to build the project. There is at least one extra build step to install headers in the stage, that are required by the rpi-thermal project that is also integrated.

Add rpi-gpio target as a dependency to the all target

Add the new make target for the project being integrated as a dependency to the all target:

all: bash vim cairo rpi-gpio rpi-mailbox rpi-thermal simple-terminal screenwm SDL SDL_image SDL_ttf SDL_net pattern-race

Internet (in general)

This project integrates the following additional open source projects, which aren't currently included (or enabled) in the QSTI:

  • screenwm
  • SDL
  • SDL_image
  • SDL_ttf
  • SDL_net
  • pattern-race

Example Integration: SDL_net

This example reviews the Makefile to see how SDL_net was integrated.

Add a make target for the SDL_net project folder

Here is the make target that was added for SDL_net:

SDL_net: SDL
    $(RM_HOST) -rf SDL_net
    git clone https://github.com/libsdl-org/SDL_net.git -b SDL2
    cd SDL_net && git apply $(PWD)/patches/SDL_net.patch
    mkdir SDL_net/build
    cd SDL_net/build && cmake .. -DCMAKE_TOOLCHAIN_FILE=$(PWD)/patches/aarch64-qnx.cmake -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=$(PWD)/stage/nto \
    -DSDL2_LIBRARY=$(PWD)/stage/nto/lib/libSDL2-2.0.so -DSDL2_INCLUDE_DIR=$(PWD)/stage/nto/include/SDL2
    cd SDL_net/build && make
    cd SDL_net/build && make install

Completing the make target for SDL_net

Note the following:

  • This project has a dependency on the SDL project, that was integrated first.
  • After cloning the project repo, this example executes different build steps than the previous project integration example. The reason for this is that this project is an open source project that supports multiple platforms, so it uses CMake to support this flexibility, which has different build steps than QNX make projects.
  • This project required a small patch to build, specifically to adjust an entry for the library to add a dynamic link to libsocket. When figuring out patches like this, you can determine patches while testing the new target being added. If you are patching a cloned git repo, you can use git diff to create the patch, then git apply to apply the patch after cloning.

Add SDL_net target as a dependency to the all target

Add the new make target for the project being integrated as a dependency to the all target:

all: bash vim cairo rpi-gpio rpi-mailbox rpi-thermal simple-terminal screenwm SDL SDL_image SDL_ttf SDL_net pattern-race

Testing the integrations

showimage

Refer to the "icons" section for more details regarding this utility, which is included from the SDL_image project integration.

showfont

Refer to the "fonts" section for more details regarding this utility, which is included from the SDL_ttf project integration.

screenwm

screenwm is an alternative window manager that can be used in place of the default fullscreen window manager.

Refer to the "system" section for more details regarding how to modify the recipe to launch the alternate window manager instead of the demolauncher (that launches by default).

SDL and related libraries

The SDL2 libraries (SDL, SDL_image, SDL_ttf, and SDL_net) have been integrated into the build. These libraries can be used to integrate other open source games built with SDL.

pattern-race

Pattern Race is a simple pattern-matching game that uses three of the SDL libraries. After you successfully build and flash the image, you can run it as follows:

patrace

The starting screen looks like this:


Pattern Race start screen
Page updated: