x86 disk boot IPLs

Updated: April 19, 2023

IPLs for x86 processors are board-agnostic and support x86_64 boards.

BIOS

The provided IPLs assume the x86 board has a PC-compatible BIOS and is configured to boot with legacy BIOS mode. Some recent boards use a Unified Extensible Firmware Interface (UEFI) or an Automotive Boot Loader (ABL) instead. The BIOS, UEFI, or ABL is in the board's firmware, which the board manufacturer can modify or update. (For simplicity, this guide uses “BIOS” unless it is discussing something specific to a UEFI or ABL.)

The startup program in the buildfile should match the board firmware. Thus, for example, when you boot with legacy BIOS mode, you must include startup-x86 in the buildfile, or when when you boot with UEFI, no QNX IPL is used, and you would typically include startup-uefi in the buildfile.

The BIOS looks after the first set of hardware initializations; when it finishes and passes execution to the IPL, the IPL only has to look after finding, validating, and loading the IFS. Further hardware initializations are done by the startup code (see Hardware initialization in the “Startup Programs” chapter).

Note: It is possible to replace the BIOS on an x86 system with a QNX IPL that performs most system initialization. In most cases, you replace the BIOS because you want to boot the system very quickly. (For instance, to meet specific boot requirements such as displaying output from a camera within n milliseconds.) However, this configuration requires information about how to initialize the specific CPU and board from the board manufacturer (e.g., Intel).

About x86 boot loader IPLs

Because the IPL for an x86 disk boot has to boot off partitioned media, it is composed of two IPLs, which we'll call IPL1 and IPL2. Both are written in assembly. The division into IPL1 and IPL2 is necessary because the first code to execute on an x86 board must be inside the disk's Master Boot Record (MBR). Because this area has only a few hundred bytes of storage, IPL1 is always very small.

Since the IPL for x86 boards is generic, its source code files are rarely included in a BSP. Instead, when you build a BSP, the generic IPL modules are retrieved from the QNX SDP directories.

IPL1

IPL1 is usually called ipl-diskpc1 and it begins execution after the BIOS has completed the hardware initializations. Its tasks are to determine the disk and partition to boot from, load the first sector of IPL2, and transfer execution to IPL2.

IPL2

IPL2 is usually called ipl-diskpc2-fsq6 (the suffix -fsq6 indicates that it is designed to boot from a Power-Safe (fs-qnx6.so) filesystem), and performs the same tasks as the main() function in an ARM IPL (see ARM IPLs in this chapter). Like IPL1, IPL2 is written in assembly. However, IPL2 is stored in reserved sectors within the Power-Safe filesystem.

Creating and updating IPL2

The mkqnx6fs utility creates and configures IPL2 (see mkqnx6fs in the Utilities Reference).

To update IPL2 to a newer version without reformatting or losing the filesystem contents, use mkqnx6fs -B.

Filesystems that IPL2 can boot

ipl-diskpc2-fsq6 can boot only little-endian, Power-Safe filesystems, which are either formatted with mkqnx6fs -elittle on any machine or natively formatted on a little-endian platform without specifying the endianness to mkqnx6fs.

Filesystem booting process

Because IPL2 is larger than the single block loaded by IPL1, its first action is to load the rest of its code. Next, it validates the filesystem and locates the most recent stable snapshot. In a Power-Safe filesystem, the IFS for an x86 board is always stored as a regular file in the /.boot directory. To be bootable, a file cannot be zero-length and its filename cannot be longer than 27 characters. If no file that meets these criteria is found, a Missing OS Image message is displayed.

If the /.boot directory contains only a single bootable file, it is booted immediately.

If more than one file is available, IPL2 displays all bootable files from the /.boot directory as a scrolling list and pauses for 3–4 seconds for a key press. You can use the up and down arrows to move from one file to another and press Enter to select a file. You can also press Home and End to go to the beginning or end of the list. A maximum of 10 files are displayed on the screen. To see more files, press the up or down arrows to scroll the list.

If you don't press a key before the timeout, the loader boots the default image. This file is always displayed as the first item in the list and is the file with the most recent modification time. (If more than one file has the most recent modification time, the file with the larger inode number is used.) Generally, this is the image that was copied into the directory most recently. You can use the touch utility to change the default image, and the following command to determine the default file:

ls -t /.boot | head -1

After IPL2 has determined which IFS to try to boot first, it populates the boot header structure startup_header with the information that the startup code needs to start the OS (see The startup header).

If the IFS is compressed, the IPL copies the IFS to a temporary location in RAM and the startup code handles the extraction to the final location (see Startup Programs).

Errors

The boot loader can display the following error messages:

Unsupported BIOS
The BIOS doesn't support INT13 Logical Block Addressing (LBA) extensions.
Missing OS Image
The filesystem isn't a Power-Safe (fs-qnx6.so) one or the .boot directory is empty.
Invalid OS Image
The selected file isn't an x86 boot image.
Disk Read Error
A physical I/O error occurred while reading the disk.
Ram Error
A physical RAM error occurred while copying the boot image.

Filesystem offset

To access the Power-Safe filesystem, IPL2 needs to know in which disk partition the filesystem is located. Because IPL1 does not provide this information, the filesystem contains a dedicated field (offset) that specifies at which LBA location the partition begins. How the filesystem is created and intialized determines if and how this field is set:

For more information about Power-Safe filesystems, see Power-Safe filesystem in the System Architecture guide and fs-qnx6.so in the Utilities Reference.