Search by Tags

Build a QNX BSP

 
Applicable for

Article updated at 14 Dec 2020

Introduction

On the article, we summarize the process of building a QNX BSP for Apalis iMX8QM 4GB WB V1.0B with the same configuration as our Partner Demo Image - QNX Neutrino Real-time Operating System.

Prerequisites

NXP Binaries for SECO and SCFW - Get the Binaries

The NXP binaries for SECO and SCFW are pieces of software from NXP that cannot be redistributable by QNX, therefore you must get them by yourself. There is not a super easy way to get those packages, but the simple fact that you are granted straightforward instructions already makes your life easier.

Note: a Yocto build may take a few hours, you may want to execute this step before doing anything else, and then go grab a cup of coffee or watch one of our webinars about QNX.

Here is what you need to do:

  • Setup the build environment following Build a Reference Image with Yocto Project for Apalis iMX8.
  • Build the recipe imx-boot by running bitbake imx-boot.
  • Navigate to the build output directorybuild/deploy/images/apalis-imx8.
  • Copy the following files to a temporary directory:
    • imx-boot-tools/mkimage_imx8
    • imx-boot-tools/mx8qmb0-ahab-container.img renamed to imx-boot-tools/mx8qm-ahab-container.img
    • imx-boot-tools/scfw_tcm.bin renamed to scfw_tcm_b0.bin
    • imx-boot-tools/bl31-imx8qm.bin renamed to bl31.bin

To illustrate copying files to a temporary directory:

$ cd <path to your Yocto build setup>
$ cd deploy/images/apalis-imx8
$ mkdir ~/tmp-seco-scfw-binaries
$ cp imx-boot-tools/mkimage_imx8 ~/tmp-seco-scfw-binaries/
$ cp imx-boot-tools/mx8qm-ahab-container.img ~/tmp-seco-scfw-binaries/
$ cp imx-boot-tools/scfw_tcm.bin ~/tmp-seco-scfw-binaries/scfw_tcm_b0.bin
$ cp imx-boot-tools/bl31-imx8qm.bin ~/tmp-seco-scfw-binaries/bl31.bin

Install QNX Packages

Open the QNX Software Center and install QNX packages. You must have previously followed the prerequisites, and therefore already have QNX SDP 7.0 installed.

You must install the following packages:

  • Apalis iMX8 BSP
  • Apalis iMX8 BSP documentation
  • Screen package for Apalis iMX8
  • Touch screen package for Atmel mXT1066T2

  • QNX Toradex Packages

    QNX Toradex Packages


  • QNX Atmel Packages

    QNX Atmel Packages

In addition, you need to evaluate what other generic packages you want or need to install!

Access the QNX Apalis iMX8 BSP and Documentation

To access the documentation PDF, go to the directory where you installed the SDP 7.0. It will be named qnx700 if you used the default name. Inside it, there is the BSP directory and a sub-directory with the documentation:

$ cd qnx700/bsp/
$ tree
.
├── apalis_imx8qm
│   ├── BSP_RN_Toradex_Apalis_iMX8QM_EVB.txt
│   └── SDP7_BSP_UG_Toradex_Apalis_iMX8QM.pdf
└── BSP_apalis-imx8qm_br-700_be-700_SVN915708_JBN13.zip

1 directory, 3 files

Since this tutorial is written with the QNX documentation as reference, it is very usefult that you have it at hand.

Import the BSP Into the Momentics IDE

On the previous step, you have found the BSP source-code as a ZIP file. Momentics can import that as-is, no need to unpack it. Follow the dialogs and you are good to go:

Take note of the path where you choose to import the BSP, you will need it in the next step!

NXP Binaries for SECO and SCFW - Install the Binaries

Hopefully when you reach this point, the Yocto build will be done and you will already have access to the SECO and SCFW binaries. Copy the files to the paths relative to where you have imported the BSP on the previous step:

  • mkimage_imx8: $BSP_ROOT_DIR/images/tools/imx-mkimage/
  • mx8qm-ahab-container.img: $BSP_ROOT_DIR/images/tools/imx-mkimage/
  • scfw_tcm_b0.bin: $BSP_ROOT_DIR/images/tools/imx-mkimage/
  • bl31.bin: $BSP_ROOT_DIR/src/hardware/ipl/boards/imx8qm-cpu/

Attention: the QNX PDF document wrongly states $BSP_ROOT_DIR/images/imx-mkimage/ instead of $BSP_ROOT_DIR/images/tools/imx-mkimage/, if you use it the build will fail.

To illustrate copying files from the temporary directory:

$ cd <path for your BSP root directory>
$ cp ~/tmp-seco-scfw-binaries/mkimage_imx8 images/tools/imx-mkimage/
$ cp ~/tmp-seco-scfw-binaries/mx8qm-ahab-container.img images/tools/imx-mkimage/
$ cp ~/tmp-seco-scfw-binaries/scfw_tcm_b0.bin images/tools/imx-mkimage/
$ cp ~/tmp-seco-scfw-binaries/bl31.bin src/hardware/ipl/boards/imx8qm-cpu/

Customize the BSP

We make the following BSP customization for a nice out-of-the-box experience. It is optional and you must evaluate by yourself what is suitable to include for your product. The customization steps are provided as-is for your reference and are not maintained by Toradex:

  • Add graphics package.
  • Add touch package.
  • Boot from the internal flash memory (eMMC) by default.

Apply Patches

Patches are provided in a .patch file. You can initialize the BSP repository as a Git repository and use Git to apply the patches, which we illustrate in this section. Alternatively you can apply the patches directly without using Git.

Head to the BSP repository that was set up when you imported the BSP into Momentics. Initialize it and commit all files:

$ cd <path to BSP import location inside the Momentics workspace>
$ git init
$ git add .
$ git commit -m "BSP: import QNX BSP from ZIP file"

Downlaod and apply the patch file:

$ wget -O toradex-qnx-bsp.patch https://docs.toradex.cn/108541-toradex-qnx-bsp-patches.patch
$ git am toradex-qnx-bsp.patch

Make sure that the patches applied using git log. The command output will be similar to the one below:

$ git log --oneline
7dd84ab (HEAD -> master) TEZI: update version of Ixora to newer one
5a4ba30 EULA: add NXP EULA
07a78be TEZI: update TEZI fields to make image compliant
593fbba ipl: load QNX IFS from eMMC by default
061b63c build: add mtouch
abb0ce8 build: add libpng16
53186b1 Makefile: run "make all" for image build
ec01bdd build: add generic libs for OpenGL ES
e452923 build: add graphics support according to doc
5bb297d Momentics: add image build targets
2ab0bb5 .gitignore: ignore build files and artifacts
c097844 BSP: import QNX BSP from ZIP file

Build the BSP

Restart the Momentics IDE, otherwise it may not reflect all changes that were applied with the patches, even if you Refresh the project.

To build the BSP:

  • Make sure that you have the C/C++ perspective selected and that you can see the Project Explorer window docked to the left-side of the screen.
  • Right click on the BSP project named by default apalis-imx8qm, unless you have modified it when importing the BSP.
  • Select the option Build Project from the dialog.

The final build output is the QNX image packed with the Toradex Easy Installer format, compressed as a ZIP file. It will be present in the sub-directory images with a name similar to apalis-imx8qm-v1.0b_ixora-v1.2a_qnx-neutrino-rtos-image_7.0.4-2020-09-21.zip.

Install the BSP

Follow the instructions from Toradex Easy Installer.