x86 disk boot IPLs
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. The IPLs aren't designed to be used on boards that use a
Unified Extensible Firmware Interface (UEFI) or an Automotive Boot Loader (ABL). 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. For x86 platforms, this typically means you must include startup-x86 in the buildfile when you boot with BIOS or UEFI firmware.
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).
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 means that it is designed to boot from a
Power-Safe or fs-qnx6.so filesystem), and performs the same
tasks as the main() function in an ARM IPL (see ARM IPLs
, below). Like IPL1, IPL2 is written in assembly,
but 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.
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
- 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
- If the filesystem is initialized on the target (using mkqnx6fs), then this offset is known and filled in immediately.
- When you use diskimage to create an image of an entire disk, the utility allows you to adjust the offset.
-
When you use mkxfs or mkqnx6fsimg to create an image of an individual Power-Safe filesystem, because you can use the partition image anywhere, no offset information is available yet. When this type of image is applied to a target disk partition, you can use the patch command provided by the partition table editor pted to provide the filesystem offset information.
The pted utility automatically performs the patching process. Because it knows the partition’s location and the filesystem’s internal structure, it can locate the offset field and populate it with the correct value. The patch command has no arguments other than the one that specifies which partition to patch.
For more information, see
pted
in the Utilities Reference.
For more information about Power-Safe filesystems, see Power-Safe filesystem
in the
System Architecture guide and fs-qnx6.so in the
Utilities Reference.