Embedded Board Farm - QNX Guide

NOTE: All the instructions described in this guide are for BeagleBoneBlack board. For other boards instructions may vary.

In order to build a QNX image you should have a valid login credentials of QNX. If you don’t have an account you can contact QNX

After getting a valid license key, follow the steps below for building an image. The steps shown below use Beaglebone as an example.

  1. Download and install Software Center and use your credentials whenever required
  2. Launch Software Center and install the SDP.
    1. Add Installation >> QNX Software Development Platform 7.0
  3. After installing the SDP download & Install BSP for BBB
    1. Software Center >> Install New Packages >> Available >> QNX Software Development Platform >> BSP >> BeagleBone Black
  4. After successfully download the BBB bsp build the image
    1. Software Center >> Launch Momentics
    2. Import BSP - Project Explorer >> Import >> QNX >> QNX Source Packages and BSP
    3. Build BSP - Project Explorer >> ti-am335x-beaglebone >> Right click >> Build Project

The above steps will create a default QNX BBB image that you can find under the image folder.

How to Boot BBB for QNX

BeagleBoneBlack (BBB) with QNX OS can either be booted using an sd card or network boot, below are the steps for booting BBB using an sd card.

Boot from microSD card

Partition and format microSD card

  1. First access the console dashboard of the device and click on SDMUX. Note that BBB doesn’t have to be up. The following case shows BBB is up and running a Linux image.
  2. You will see it’s details under SD Card information. In case the SD card is corrupted, it will only show the size. Click on Partition SD Card option to partition the sd card.
  3. Creating two partitions: the first will be the bootable read-only partition and use 100M as the size; and the second partition can be used as a read-write filesystem and its size would be the remaining size of the SD card. Then click on Format & Partition.
  4. Upon successful partition, you will see two partitions under SD Card File Manager.

Transfer the Image and Booting the board

After you format and make your microSD card bootable, you are ready to transfer the image to it. You can either use a prebuilt BSP image file (IFS) or use your custom image generated after modifying the buildfile, and rebuilding the IFS and optionally IPL.

You can use one of the following methods to boot QNX Neutrino RTOS ( the IFS) onto your board:
  • MLO/U-Boot to boot the IFS onto your board from a microSD card.
  • QNX IPL to boot the IFS onto your board from a microSD card.

Boot from microSD card using MLO/U-boot

To prepare the microSD card, you must first copy two boot loader module files (MLO and U-Boot) and then the IFS image file.

To copy the boot loader modules and the IFS boot image to the microSD card:
  1. Get the MLO and u-boot.img files from the hardware manufacturer of your board.
  2. Copy the files below in the prescribed order to the DOS/FAT32 partition of your microSD card:
    1. mlo
      CAUTION: If the MLO isn't the first file copied to the formatted microSD card, the
      board won't boot. To fix this issue, reformat the card, and then copy the files in the correct order, starting with the MLO.
    2. U-boot.img
    3. Qnx-image
    4. sshd_config(optional required for network console access
  3. Click on Partition-1 and upload the MLO, u-boot.img, QNX Image and sshd_config(optional) file from your local machine.
  4. Power up BBB and interrupt on u-boot
    1. fatload mmc 0 0x81000000 qnx-ifs
    2. go 0x81000000

Boot from microSD card using QNX IPL

  1. In the images folder you will also find ipl-sd-am335x-beaglebone.bin file, rename it to mlo.
  2. Click on Partition 1 and upload the mlo, QNX Image and sshd_config(optional) file from your local machine.
  3. Hold down the SD Boot button (S2) and then connect the power supply. If the power is already connected, hold the SD Boot button, then hold down the Power button (S3) to turn off the power (the blue light should turn off on the board), and then while holding the SD Boot button, tap the Power button to turn the power on. See the documentation for the BeagleBone Black board for more information about recommended practices to power the board.
  4. In your console connection, you should the following prompt:
    QNX Neutrino Initial Program Loader for AM335x Board
    Command:
    
    Press 'S' for SERIAL download, using the 'sendnto' utility to download file
    Press 'M' for SDMMC download, file qnx-ifs assumed.
    Press 'r' followed by physical address to read memory
    Press 'w' followed by write address, followed by new value to write to memo
    
  5. Type M to boot from the microSD card.

Boot from Network

Setup Network folder and upload files

  1. Access the serial console and select the Network Boot
  2. Select Network Boot File Manager and create a folder named qnx
  3. Click on the qnx folder and then upload the QNX image and sshd_config(optional) file.

Boot From NFS

  1. Power up BBB and interrupt on u-boot
    1. tftp 0x81000000 upload/DUT3*/qnx/qnx-ifs-sshd
    2. go 0x81000000

NOTE: My DUT is connected to port “3” that's why I am using “DUT3” you should change this according to your device. You can find this details from “Network Boot Information” option.

How to enable SSH

SSH is required for the Network Console Access. By default SSHD is disabled in the image. To enable it, add the lines shown below in the buildfile under the image folder and rebuild the image.
NOTE: Below procedure is required only if you want to have either SSH access to Device/board or want to use SSH port forwarding feature.

  1. Add following entries for pseudo tty
              devc-pty
              waitfor /dev/ptyp0 4
    
  2. After the [data=c] section of build file, add below lines for sshd setup
              /usr/sbin/sshd=sshd
              ssh-keygen
              usr/libexec/sftp-server=${QNX_TARGET}/${PROCESSOR}/usr/libexec/sftp-server
              /etc/profile = {
                   PATH=/proc/boot:/bin:/usr/bin:/sbin:/usr/sbin
                   LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll
              }
    
  3. Add ssh to the general commands list
  4. Rebuild the QNX image.

How to run SSH Server using the MicroSD Card

  1. After boot up the QNX image check the sdcard nodes, In our case first partition is detected as “/dev/sd0t12” and second partition as “/dev/sd0t13”
    1. ls /dev/sd*
  2. Format SD card second partition as qnx6 filesystem.
    1. # mkqnx6fs /dev/sd0t131
  3. Mount SD card second partition on '/' mount point.
    1. # mount -t qnx6 /dev/sd0t131 /
  4. Create folders and generate ssh keys required for the ssh server.
    1. mkdir -p /etc/ssh
    2. mkdir -p /var/chroot/sshd
    3. chmod 700 /var/chroot/sshd
    4. ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
    5. ssh-keygen -t rsa -b 1024 -f /etc/ssh/ssh_host_rsa_key -N ''
    6. ssh-keygen -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key -N ''
    7. ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ''
  5. Mount SD card first partition on '/mnt' mount point to copy sshd_config file from it.
    1. mkdir /mnt
    2. mount -t dos /dev/sd0t12 /mnt
    3. cp /mnt/sshd_config /etc/ssh
  6. Verify the ssh folder and key file permissions.
    1. mode 755 for /etc/ssh
    2. mode 600 for private keys
    3. mode 644 for public keys
  7. Start the sshd service.
    1. /usr/sbin/sshd
  8. By default QNX image has two user “qnxuser” and “root” and password for the both are “qnxuser” and “root” respectively.
  9. If you want to access your DUT over the corporate network, you have to forward DUT ssh port 22 to any port of Zombie. (see Network-Console-access section)

How to run SSH Server using the network boot

  1. After booting the board mount nfs folder “qnx” on “/” mount point.
    1. # fs-nfs3 192.168.111.1:/var/lib/lava/dispatcher/tmp/nfs/DUT3/qnx /
  2. Create folders and generate ssh keys required for the ssh server.
    1. mkdir -p /etc/ssh
    2. mkdir -p /var/chroot/sshd
    3. chmod 700 /var/chroot/sshd
    4. ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
    5. ssh-keygen -t rsa -b 1024 -f /etc/ssh/ssh_host_rsa_key -N ''
    6. ssh-keygen -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key -N ''
    7. ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ''
  3. Copy sshd_config file to /etc/ssh
    1. cp /sshd_config /etc/ssh
  4. Verify the ssh folder and key file permissions.
    1. mode 755 for /etc/ssh
    2. mode 600 for private keys
    3. mode 644 for public keys
  5. Start the sshd service.
    1. /usr/sbin/sshd
      By default QNX image has two user “qnxuser” and “root” and password for the both are “qnxuser” and “root” respectively.
      If you want to access your DUT over the corporate network, you have to forward DUT ssh port 22 to any port of Zombie. (see Network-Console-access section)