Building OS and Flash Images

One of the more distinctive tools within the IDE is the QNX System Builder perspective, which simplifies the job of building OS images for your embedded systems.

Before we can begin to understand how to create an OS image, we must first understand the steps that occur when the system starts up:

  1. The processor begins executing at the reset vector.
  2. The Initial Program Loader (IPL) locates the image and transfers control to the startup program in the image.
  3. Startup program configures the system and transfers control to the procnto module (combined microkernel and process manager).
  4. The procnto module loads additional drivers and any application programs.

The reset vector is the address at which the processor begins executing instructions after the processor's reset line has been activated. On the x86, for example, this is the address 0xFFFFFFF0.

The IPL minimally configures the hardware to create an environment that allows the startup program microkernel to run.

An image is a file that contains the OS, your executables, and any data files that might be related to your programs. You can think of the image as a filesystem; it contains a directory structure and some files.

To create an image for your platform, you first need to understand the components of an image and the boot process. The following illustration shows the boot sequence:

When the bootup process starts, the CPU executes code at the reset vector, which could be a BIOS, ROM monitor, or an IPL. If it's a BIOS, then it'll find and jump to a BIOS extension (for example, a network boot ROM or disk controller ROM), which will load and jump to the next step. If it's a ROM monitor, typically uboot, then the ROM monitor jumps to the IPL code.

The IPL code does chip selects and sets up RAM, then jumps to the startup code. In either case, the next thing that runs is some startup code that sets up some hardware and prepares the environment for procnto to run.

The procnto module sets up the kernel and runs a boot script that contains drivers and other processes (which may include those you specify), and any additional commands for running anything else. The files included will be those as specified by the mkifs buildfile.

A buildfile specifies any file and commands to include in the image, the startup order for the executables, the loading options for the files and executables, as well as the command-line arguments and environment variables for the executables.