A QNX system can be self-contained in a single boot file—the IFS. You can boot the IFS on x86_64 target platforms using standard disk boot methods.
For example, run the following command from the BSP images directory to create the IFS x86_64-generic.bin using the buildfile x86_64-generic.build. It specifies the file extension .bin, but you can use any value (for example, there are BSPs that use .ifs and .raw).
mkifs -r../install -vv x86_64-generic.build x86_64-generic.bin
Alternatively, in the IDE, create the IFS using the right-click menu for the BSP project.
# Set the size of the filesystem image in disk sectors (not filesystem blocks) # The size must be a multiple of 8 and can be any value that can fit on the media # For this example, the media is 400 MB [num_sectors=409600] # In QNX Neutrino 6, inodes have to be pre-allocated at format time [num_inodes=50000] # The blocksize is typically set based on how the filesystem is expected to be used # If the filesystem will contain many very small files, reduce the specified blksize, # because each file occupies a whole number of blocks. Default to 4KiB as that size # ensures everything is 4KiB aligned and may work better with some solid-state # devices. [blksize=4096] # Include the boot IFS in the image, in /.boot # In this example, x86_64-generic.bin is the image that you # build from the BSP and primary_boot.ifs is its name in the image # You can choose any name for the boot IFS in /.boot, as long as it is the only file /.boot/primary_boot_image.bin=x86_64-generic.bin # Optionally, include any other files you want in the filesystem image /usr/bin/traceprinter=${QNX_TARGET}/x86_64/usr/bin/traceprinter /usr/bin/awk=${QNX_TARGET}/x86_64/usr/bin/awk # Optionally, include a complete directory without specifying individual file names # For example, include all files for screen graphics /usr/lib/graphics/intel-drm=${QNX_TARGET}/x86_64/usr/lib/graphics/intel-drmThe following example command uses this buildfile to create the bios_root.img file, which contains the filesystem:
mkqnx6fsimg -vv bios_root.build bios_root.img
# Set the disk CHS geometry. The following values should work on all # HDDs and sets the cylinder size to 1 MiB # Although the usual value for sectors_per_trk is 63, here is it # set to 32 to allow for a convenient cylinder size of 1 MiB [heads=64] [sectors_per_track=32] [sector_size=512] # The lines above create a 1 MiB cylinder size and the following line # sets the corresponding total disk image size to 400 MiB. Adjust as necessary [cylinders=400] # List the partitions and provide the image files to use. diskimage # re-sizes the partition automatically to fit the image file, if one is provided # Specify the partition information using the MBR format [partition=1 type=177 boot=true] "bios_root.img"
For Windows hosts, you must run sh to get a prompt (for example, sh-4.3$) before you run the command.
diskimage -o bios_disk.img -c bios_disk.cfg -b $QNX_TARGET/x86_64/boot/sys/ipl-diskpc1-nomsg -s 131072Where:
The output file bios_disk.img is somewhat larger than the bios_root.img file specified in diskimage configuration file (bios_disk.cfg).
UEFI implementations differ from board to board. The following procedure illustrates transferring an OS image to an ASRock Beebox. (Because the Beebox does not provide a serial connection, to access the console, you need to use adapters to create USB-to-serial connections.)
For example, run the following command from the BSP images directory to create the IFS x86_64-uefi.efi using the buildfile x86_64-uefi.build. It specifies the file extension .efi, but you can use any value (for example, there are BSPs that use .ifs, .raw, and .bin).
mkifs -r../install -vv x86_64-uefi.build x86_64-uefi.efi
Alternatively, in the IDE, create the IFS using the right-click menu for the BSP project.
# Set the size of the filesystem image in disk sectors (not filesystem blocks) # The size must be a multiple of 8 and can be any value that can fit on the media # For this example, the media is 400 MB [num_sectors=409600] # In QNX Neutrino 6, inodes have to be pre-allocated at format time [num_inodes=50000] # The blocksize is typically set based on how the filesystem is expected to be used # If the filesystem will contain many very small files, reduce the specified blksize, # because each file occupies a whole number of blocks. Default to 4KiB as that size # ensures everything is 4KiB aligned and may work better with some solid-state # devices. [blksize=4096] # Optionally, include any other files you want in the filesystem image /usr/bin/traceprinter=${QNX_TARGET}/x86_64/usr/bin/traceprinter /usr/bin/awk=${QNX_TARGET}/x86_64/usr/bin/awk # Optionally, include a complete directory without specifying individual file names # For example, include all files for screen graphics /usr/lib/graphics/intel-drm=${QNX_TARGET}/x86_64/usr/lib/graphics/intel-drmThe following example command uses this buildfile to create the uefi_root.img file, which contains the filesystem:
mkqnx6fsimg -vv uefi_root.build uefi_root.img
#The EFI boot partition only needs to be large enough to hold the IFS [num_sectors=51200] #Create the boot image with the name required by your board's firmware EFI/BOOT/BOOTX64.EFI=x86_64-uefi.efi
mkfatfsimg -vv uefi_boot.build uefi_boot.img
The following example illustrates a diskimage configuration file (uefi_disk.cfg):
# Set the disk CHS geometry. The values below should work on all # HDDs and sets the cylinder size to 1 MiB # Although the usual value for sectors_per_trk is 63, here is it # set to 32 to allow for a convenient cylinder size of 1 MiB [heads=64] [sectors_per_track=32] [sector_size=512] # The lines above create a 1 MiB cylinder size and the following line # sets the corresponding total disk image size to 400 MiB. Adjust as necessary [cylinders=400] # Generate a GPT with the required "UEFI System Partition" [partition=1 type_guid={C12A7328-F81F-11D2-BA4B-00A0C93EC93B} name="boot" boot=true] "uefi_boot.img" [partition=2 type_guid="qnx6"] "uefi_root.img"
The string C12A7328-F81F-11D2-BA4B-00A0C93EC93B in this example is the full GUID for an EFI system partition; you could use the short identifier efi instead. For information about GUIDs for partition types, see <gpt_guid.h> or the entry for the diskimage configuration file in the Utilities Reference.
The following example commands create the fully bootable HDD image uefi_disk.img that specifies the partition images that appear in the disk image.
For Windows hosts, you must run sh to get a prompt (for example, sh-4.3$) before you run the command.
diskimage -g -o uefi_disk.img -c uefi_disk.cfg
The output file uefi_disk.img is somewhat larger than the uefi_root.img file specified in diskimage configuration file (uefi_disk.cfg).