-
Notifications
You must be signed in to change notification settings - Fork 0
Creating Boot Images
The SD card inserted into the Raspberry Pi 4 is the Pi's "hard disk" or long-term storage. The file system for the operating system will be located here, as well as the boot file system.
By default, the QNX file system will exist in RAM and disappear. We want a writable file system, which is why we need to partition the SD card into a boot partition and file system partition.
At the time of writing the CUInSpace design bay has an Ubuntu machine which can be used to run the partitioning tool,
fdisk. If you know how to follow the below partitioning steps using another tool, you may do so. Otherwise, there are
other ways to access fdisk, such as using Windows Subsystem for Linux.
- Plug the SD card into the computer.
- Identify the name of the SD card assigned by Linux by running the
lsblkcommand. It will likely be something likesda. The rest of the steps will assume that name. Be sure to verify the name by runninglsblkbefore and after the SD card is plugged in. - Run
fdisk /dev/sda. You made need to usesudo. - Press
dandEnterrepeatedly until fdisk tells you that all partitions are deleted. - Press
uto change the size to cylinders. - Press
oto create a new disk label. - Press
nto make a new partition and selectpfor primary. It will be partition 1. - Hit enter to use the default start cylinder.
- Put enough cylinders after to be about 50MB (1000~ to be safe).
- Press
ato mark partition 1 as bootable. - Press
tto set the type of the partition as W95 FAT32. This will be hex codec. - Press
nto create another new partition. Selectpfor primary. It will be partition 2. - Hit enter to use the default start cylinder.
- Hit enter to give partition 2 all the remaining cylinder space. The type of partition 2 will be Linux (hex code
83). -
sudo mkfs.vfat /dev/sda1will format the boot partition to FAT32. -
sudo mkfs.ext2 /dev/sda2will format the second partition to be Linux.
You can now remove the SD card!
Make sure you've followed the instructions in Installing QNX Development Tools before attempting this. You will also need to install the wireless driver mentioned in that guide.
You will need:
- TTL USB Cable
- Ethernet Cable
- Raspberry Pi 4 Model B
- Raspberry Pi power cord
First follow the instructions listed in Research Computing Service's Video, but don't upload files onto the Pi's SD card yet.
You'll need these files mentioned in the video:
- bcm2711-rpi-4-b.dtb
- fixup4.dat
- fixup4cd.dat
- fixup4db.dat
- fixup4x.dat
- start4.elf
- start4cd.elf
- start4db.elf
- start4x.elf
Grab the rpi4.build file from the qnx-guide repository and put it into the qnx710/bsp/images directory
to overwrite the previous build file. If you haven't already, you'll need to unzip the BSP package for this.
- Launch the QNX Momentics IDE.
- Select
File > Import > QNX > QNX Source Package and BSP, then clickNext. - Select the
qnx710\bspfolder you unzipped before. - Once it opens in the Project Explorer along the lefthand side, right click the project (top-level directory) and
select
Clean Project. - Once that completes (see status near the bottom in the console), right click again and select
Build Project. There should not be any build errors. - Once the project is built, you will follow the last steps of the video (copying files to the SD card).
- You will copy over all the files in
qnx710/bsp/images/tools/sdboot_images, as well as theifs-rpi4.binfile in your Momentics IDE workspace. - As in the video, eject the SD card and put it in the Pi.
- Connect the TTL USB to the correct pins.
- List the currently connected serial device using
py -m serial.tools.list_ports(python3 -m ...for Linux). - Open a connection to the Pi using
py -m serial.tools.miniterm <port> 115200.
You should see QNX boot up, and there will be a message Starting WIFI Network driver... with no errors. You can check
if the Pi connected to WiFi correctly using ifconfig and checking for an IP address under the bcm0 entry. Note that
the Pi will only connect to networks that are configured in the build file under the "WPA Supplicant configuration"
heading.
The build file created by CUInSpace contains a script to automatically start the SSH daemon using sshd.
This script is located on the PATH, so you will only need to run start_ssh.sh from your shell on the Pi.
This command will prompt you to generate an RSA SSH key if ssh_host_rsa_key isn't already present in /etc/ssh/.
Please run the command you are prompted with to generate the key, and then attempt to run the SSH server again.
To learn more about the OpenSSH Daemon on QNX, please take a look at the QNX provided guide.