Image storage
The media on which the bootable OS image is stored, and how it is stored (compressed or not) determine what the IPL must do with the image.
The type of removable media used to store the IPL and the IFS affects many aspects of the IPL design. One significant factor is whether the storage media is linearly mapped (e.g., NOR FLASH) or non-linearly mapped (e.g., eMMC, SD card), because it determines if the IPL can use eXecute In Place (XIP).
Other important factors include whether the image is compressed, and the device on which
it is stored (see Image storage methods
).
Linearly mapped devices
With linearly mapped devices (e.g., ROM devices), the entire image is in directly addressable storage that maps its entire address space into the processor's address space. The processor can address any location in the OS image, so the IPL needs to copy only the startup code (not the entire image) into RAM, leaving the rest of the image on the device.
If the removable media is linearly mapped, the IPL can use XIP. In this case, the
.text
section of the IPL (the code) in the linker file (e.g.,
mx6sx-sabre-sdb.lnk or vayu-evm.lnk)
must be in the linearly mapped address space.
Non-linearly mapped devices
With non-linearly mapped devices (e.g., eMMCs, SD cards, or SPI NOR devices), the image is in storage that can't be mapped directly into the processor's address space. The processor can't address the OS image, so the IPL needs to copy the entire image (including the startup code) into RAM.
Compressed images
If a bootable image is too large to store on the removable media in its original form, or if hardware limitations (e.g., slow bus) make copying and extracting the compressed image more efficient than copying the image in its original form, the bootable image may be compressed on either a linearly mapped or a non-linearly mapped removable storage device.
When it builds the OS image, the mkifs utility checks for the
compress
attribute in the buildfile. If the attribute is set
(e.g., [virtual = x86_64, bios +compress boot = {
),
mkifs compresses the image (see the OS Image Buildfiles chapter).
- Copy the compressed image to a RAM location other than the address where you will extract it.
- Extract the image so the startup code is at the address where your IPL will jump to when it has finished.
- Leave enough room for the entire uncompressed image between the location where you copy the compressed image and the address to which you will extract it.
For examples of how different storage options are used, see Image storage methods
in this chapter.
Image locations
- Disk
- Most embedded systems now use solid-state media such as a USB key, SD or micro SD card, or eMMC, though some may still use a rotating disk. The board's platform type determines the kind of media, if any, from which the system can boot.
- Network
- If the board has a PCI network card, the OS image can be loaded over an Ethernet network and placed in the processor's address space.
- DHCP server
- On some embedded boards, the boot loader contains DHCP code. This code knows how to talk to the networking hardware, and how to get the OS image from a remote system.
- Serial port
- A serial port on the target can be useful during development for downloading an image or as a failsafe mechanism (e.g., if a checksum fails, you can simply reload the OS image via the serial port).
Alternative method for loading the image
As well as supporting a primary method for loading the OS image, the IPL code may also need to support an alternative loading method (e.g., an .altboot in the case of a disk boot on x86 boards). This secondary method may have to be an automatic fallback when the primary image is corrupt. You can use a .boot directory with a list of fallback IFSs that can be loaded from read-only media.
Image validation
checksum (image_paddr, startup_size);
checksum (image_paddr + startup_size, stored_size - startup_size);
Optimizing an IPLin this chapter, and enable_cache() in the IPL Library).