QNX on Pi 400: Make your own image!

In this post we leverage the QNX 8 Custom Target Image repo for Raspberry Pi 4B to make a similar image for the Pi 400.

QNX on Pi 400: Make your own image!

The QNX Everywhere team, a couple of weeks ago, launched a new repo with a system to build your own custom QNX target image for the Raspberry Pi 4 B. In this post we'll look at what changes you can make to build an image for the Raspberry Pi 400, which also uses the BCM2711 SoC.

Overview

The process to adjust the build for Pi 400 is pretty simple. Here's the high-level overview:

  1. Clone the source repo
  2. Update some Makefiles to pull down the right drivers
  3. Edit snippets to swap to the right driver files
  4. Build & flash the image
  5. Connect to Wi-Fi

Let's get started!

Prepare The Pi 400 Image

Clone the source repo

First you'll need to clone the source repo we'll be working with. Note that the build is only designed to run on Linux hosts right now. (If you're on a non-Linux host, you can use a QNX Docker container to run the build!)

  1. Clone the repo from here: https://gitlab.com/qnx/custom-target-image-builds/raspberry-pi-4-qnx-8.0/-/tree/release/CTI-8.0.2
  2. Important! You must build the image as-is first before making any modifications. Follow the instructions in the README in that repo to complete a successful default build.
💡
The initial build takes a while, since it does a first-run installation of some dependencies.

Update Makefiles

We need to make two mandatory changes to convert the build from a Pi 4B build to a Pi 400 build: change the DTB device tree source file and the Wi-Fi drivers.

  1. In the cloned repo, open /boot/Makefile
  2. Replace all instances of bcm2711-rpi-4-b.dtb with bcm2711-rpi-400.dtb
  3. Change the URL on line 35 to the URL of the new DTB file:
	wget https://github.com/raspberrypi/firmware/raw/refs/heads/master/boot/bcm2711-rpi-400.dtb

Line 35

  1. Save that file, then open /boot/wifi/Makefile
  2. Make the following replacements throughout the file:
    cyfmac43455-sdio.bin becomes brcmfmac43456-sdio.bin
    cyfmac43455-sdio.clm_blob
    becomes brcmfmac43456-sdio.clm_blob
    brcmfmac43455-sdio.raspberrypi,4-model-b.txt
    becomes brcmfmac43456-sdio.raspberrypi,400.txt
  3. Adjust the URLs for the three Wi-Fi drivers to new URLs:
    1. Line 29:
      wget https://github.com/armbian/firmware/raw/refs/heads/master/brcm/brcmfmac43456-sdio.bin
    2. Line 32:
      wget https://github.com/armbian/firmware/raw/refs/heads/master/brcm/brcmfmac43456-sdio.clm_blob
    3. Line 35:
      wget https://github.com/armbian/firmware/raw/refs/heads/master/brcm/brcmfmac43456-sdio.raspberrypi,400.txt
  4. Save this file

Edit snippets

Our Makefiles are now set to download the new DTB and Wi-Fi driver files. Next, we need to adjust the build's snippets so that the new files are used in the build.

In your project directory you have a qnx800 directory, which was added after you successfully completed a default build to prepare.

  1. Navigate to the directory:
    ./qnx800/host/common/mkqnximage/extras/rasppi/rpi/snippets/
  2. Copy these two files from this directory to snippets/ in the root of your project folder:
    1. boot_files.99.type_rasppi
    2. system_files.type_rasppi
  3. Next, open /snippets/boot_files.99.type_rasppi and replace all instances of bcm2711-rpi-4-b.dtb with bcm2711-rpi-400.dtb
  4. Then, open /snippets/system_files.type_rasppi and replace lines 15-17 which begin with [perms=444]... to use the new Wi-Fi drivers:
[perms=444] etc/wifi/firmware/brcmfmac43456-sdio.bin=brcmfmac43456-sdio.bin
[perms=444] etc/wifi/firmware/brcmfmac43456-sdio.clm_blob=brcmfmac43456-sdio.clm_blob
[perms=444] etc/wifi/firmware/brcmfmac43456-sdio.raspberrypi,400.txt=brcmfmac43456-sdio.raspberrypi,400.txt
  1. And lastly, in this same file, change lines 25-27 to have the new Wi-Fi driver filenames:
fw=/system/etc/wifi/firmware/brcmfmac43456-sdio.bin
nvram=/system/etc/wifi/firmware/brcmfmac43456-sdio.raspberrypi,400.txt
clm_blob=/system/etc/wifi/firmware/brcmfmac43456-sdio.clm_blob
⚠️
Do not remove the old Pi 4B DTB file and Wi-Fi drivers. Though they won't be used for your build now, the (current) tooling still checks for their presence before allowing a successful build.

Build and Configure the Image

Build it and flash it!

Okay! We're ready to build it. If you run make again, you should find that the build is much quicker than the initial build (maybe 1 minute at most), and it should result in a new rpi4.img file in the root directory of your project.

Use this file to flash the SD card for your Pi 400, then insert the card and power on the device.

💡
If you are using a display, make sure to use the micro-HDMI port closest to the micro-SD card slot, and not the one closest to the USB-C port.

Connect to Wi-Fi

After a few moments you should see the familiar rainbow screen and then the (rather plain) landing page of the QNX demolauncher! (Back in the original repo there is a lot of information about how to customize this launcher.)

To set up a Wi-Fi connection:

  1. Click the center icon to open a terminal
  2. Edit the Wi-Fi configuration file to add your network credentials:
    vim /boot/wpa_supplicant.conf
  3. Reboot the Pi 400
⚠️
This process should get you a running, connected image for Pi 400, but it's possible not everything will be working. Other peripherals may need additional tweaking.

Just For Fun

Here's a few simple things you might want to try to further customize the build!

  • Edit Makefile, mkqstiimage.sh, and rpi4.config in the project root folder to change the resulting image name from rpi4.img to something else (pi400.img?)
  • Modify qnx800_rpi4_welcome_msg.txt to change the text shown when you log in as a user in the terminal on the Pi 400
  • Change src/Makefile to remove some of the extras or to add your own extra files, libraries, or programs

Troubleshooting

If you're having trouble with this process, try the following options:

I hope this process worked well for you, and I'm looking forward to hearing what you're doing with your Pi 400! Cheers!