x86 disk boot IPLs

IPLs for x86 processors are board agnostic and support both 32- and 64-bit architectures.

BIOS

The provided IPLs assume the x86 board has a PC-compatible BIOS and is configured to boot to 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 build file should match the board firmware. For example, when you boot to legacy BIOS mode, you must include startup-x86 (or startup-x86-32) in the build file. When you boot to UEFI, no QNX ILP is used and you must include startup-uefi (or startup-uefi-32) in the build file.

The BIOS looks after all the hardware initializations (for example, clocks, memory controller). When it finishes and passes execution to the IPL, the IPL only has to look after finding, validating, and loading the IFS.

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 example, 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 (for example, 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 we'll call IPL1 and IPL2. Both IPL1 and IPL2 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 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 SDP directories.

IPL1

IPL1 is usually called ipl-diskpc1 and it begins execution after the BIOS has completed all 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 an fs-qnx6 file system) 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 -el on any machine or natively formatted on a little-endian platform with an unspecified endian-ness.

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 (fs-qnx6.so), the IFS for an x86 board is always stored as a regular file in the /.boot directory. To be bootable, a file cannot be a zero-length file 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 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 until the list scrolls.

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 speaking, 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 OS 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 LBA extensions.
Missing OS Image
The filesystem isn't an fs-qnx6 one, or the .boot directory is empty.
Invalid OS Image
The selected file isn't an x86 startup 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 partition on the disk the filesystem is located. Because IPL1 does not provide this information, the filesystem contains a dedicated field (offset) that specifies at which Logical Block Addressing (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.