Design

Boot Loaders Small, Fast System Initialization

Choosing the best system initialization approach for a given architecture migration depends on boot speed, boot loader size, and the amount of configurability

Lori Matassa and Max Domeika are the authors of Break Away with Intel Atom Processors: A Guide to Architecture Migration

The system firmware is a layer between the hardware and the operating system that maintains platform hardware data for the operating system. The system firmware is customized for the specific hardware requirements of the platform and perhaps for a given application. Traditionally, platforms based on Intel architecture boot in three steps:

System firmware

Operating system loader

Operating system

As part of the power on self test (POST), the system firmware begins to execute out of flash memory to initialize all the necessary silicon components including the CPU itself and the memory subsystem. Once main memory is initialized, the system firmware is shadowed from ROM into RAM and the initialization continues. As part of the advanced initialization stages the system firmware creates tables of hardware information in main memory for the operating system to utilize during its installation, loading, and runtime execution. Hardware workarounds are often implemented during the power-on self-test (POST) to avoid changing silicon or hardware during later design phases. There may be an element of the system firmware that remains active during later stages to allow for responses to various operating system function calls.

The last task that the system firmware performs is a handoff of control to the operating system loader. The operating system loader does exactly what its name implies. It is customized with knowledge about the specific operating system, how it is ordered, and which blocks of the operating system to pull from the OS storage location. The operating system loader may be configured to extend the platform initialization beyond the system firmware's scope in order to allow for additional boot options. Depending on the system architecture and the firmware solutions that are adopted, the operating system loader and the system firmware could be part of the same binary.

The operating system completes the initialization of the hardware as it executes the software stack and device drivers. It potentially loads the human/machine interface and finally begins the applications. Care should be taken when considering combining elements of various components together as licenses may prohibit linking the objects together in various ways.

Boot Loaders for Closed Box Designs

Some embedded systems use minimized specialized (custom) firmware stacks created for fast speed, small size, and specific system requirements. These boot loaders perform static hardware configurations and only initialize critical hardware features prior to handoff to an operating system. They are tuned to a targeted OS, specific application, or function set, and support minimal upgrade and expansion capabilities.

QNX fastboot technology integrates system initialization into the QNX Neutrino RTOS, eliminating the need for BIOS or other boot loader. It was developed specifically for use in the QNX Neutrino RTOS, for Intel Atom processor Z5xx series platforms. Systems using QNX fastboot can achieve boot times of milliseconds while eliminating the BIOS royalty from their bill of materials. More information about QNX fastboot technology may be found here.

A custom boot loader may be developed for the Intel platform for architecture migrations where more time and effort is available and a do-it-yourself model is preferred. Developing your own boot loader requires a special set of software and hardware knowledge, and you'll need certain documents respective to the Intel architecture processor, chipset, motherboard, and other platform hardware. Additional information that will be needed includes operating system requirements, industry standards and exceptions, silicon-specific eccentricities beyond the standards, basic configuration, along with compiler and linker details, and software debug tools. Gather the appropriate documents at the start of the project.

Motherboard schematics are an absolute must. If the design is reusing an off-the-shelf solution from a vendor it could be more difficult to obtain the required information. In some cases confidential nondisclosure agreements (CNDAs) and perhaps restricted secret nondisclosure agreements (RSNDAs) with the various silicon vendors or motherboard vendors must be signed. The nondisclosure agreements (NDAs) will require some level of legal advice. Further, Memory Reference Code (MRC) requires an RSNDA agreement with Intel.

Intel Architecture System BIOS for Open Box Designs

A common requirement for open, expandable system designs is to provide the broadest possible system initialization solution, allowing the flexibility to load a wide range of off-the-shelf operating systems and methodical, dynamic hardware configurations. These designs will support multiple standard interfaces and expansion slots, and host mainstream operating systems with a broad set of pre-OS features and are ready to run multiple applications. On Intel architecture designs that require the flexibility, developers can choose from vendor-provided firmware.

The legacy Basic Input/Output System (BIOS) initializes the hardware and boots it to a point where the operating system can load, and it also abstracts the hardware from the operating system through various industry standard tables (ACPI, SMBIOS, IRQ routing, memory maps, and so on). Access to the hardware is directly made through silicon-specific BIOS commands or industry standards interfaces. Intel architecture has commonly used BIOS for over 25 years to support designs with multiple use cases, customizable services, multiple boot paths, native operating systems, or that are rich in features. BIOS is a common choice for legacy Intel architecture software design support. Major BIOS vendors include:

American Megatrends Inc.

Insyde Software Corp.

Phoenix Technologies, Ltd.

Nanjing Byosoft Co.,Ltd.

Talking to a BIOS vendor is a great idea when the situation demands ready solutions and the return on investment merits the costs. The BIOS solution provides everything needed to get the system initialized and to a successful production cycle. Obtaining starter code from a BIOS vendor normally requires various levels of licenses and agreements for evaluation, production, and follow-on support. Additionally, a commercial BIOS usually includes a varying amount of nonrecurring engineering (NRE), and/or royalties per unit or subscription costs.

Many successful and established computer OEM development teams utilize BIOS vendors to provide a base level of software core competency, basic OS support, tools, and on-call support. Smaller companies can take advantage of BIOS starter kits, which consists of a lesser number of features and limited support.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!