Bootldr Internals Documentation

Copyright 2000 Compaq Computer Corporation.

Copying or modifying this code for any purposes is permitted, provided that this copyright notice is preserved in its entirety in all copies or modifications. COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED, AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.

Prinicipals of Operation

The bootldr is firmware -- it is the first code executed by the processor when it comes out of reset, whether reset was induced by turning on power to the device or by hitting the reset switch.

The first word of the bootldr image is loaded at the beginning of Flash so that it will be executed when the processor comes out of reset. Usermode programs and even the kernel have some other program that interprets the executable and loads the code into memory at the appropriate point. These often have executable file headers that describe where to load them into memory. The bootldr does not have this luxury -- it is the one that loads the kernel. For this reason, the Makefile for the bootldr does some funny things to ensure that the first word of the bootldr is a valid instruction.

Memory Mapping

With one exception, the bootldr uses a linear identity mapping from virtual to physical addresses.

The exception is that the first 1MB of Flash is copied into DRAM, and the virtual address corresponding to the first 1MB of Flash is mapped to this image in DRAM.

This is done in mmu-strongarm.c, before setting up the MMU the bootldr copies itself into DRAM .

Flash and DRAM are mapped cacheable, and bufferable.

The second exception to the identity virtual->physical mapping is that a second uncacheable mapping is created for Flash. This is necessary so taht the bootldr can program flash. However, booting the kernel is faster if there is a cacheable image of Flash to read the kernel and possibly ramdisk from. Since we boot more often than write flash, it's the uncached image that is non-identity.

Signature of the Bootldr

The bootldr contains a number of elements that identify it as a valid, uncorrupted bootldr.

BOOTLDR_MAGIC (0x646c7462)
Identifies this file as a bootldr. It appears at offset 0x20 because this is the first free location after the exception vector jump table.
BOOTLDR_VERSION
Identifies the version number of the bootldr image
BOOTLDR_START
Specifies where this bootldr should be loaded in memory. This is used to distinguish between bootldr images for SA110/Footbridge and SA1100, which have Flash at different offsets. We should probably add BOOTLDR_ARCHITECTURE.

Safeguards

After linking, the bootldr image is padded with bytes so that the checksum of the image is zero. It is padded with zeros to a multiple of 128 bytes so that the checksum of the image after xmodem download is still zero.

Bootldr Commands

[ to be written ]

Structure of the Source Code

[to be written]