The startup header

The startup header structure startup_header is defined in the include file startup.h.

The startup.h file is located in the /src/hardware/startup/lib/public/sys/ directory, and is 256 bytes. The startup_header boot header structure members are populated by mkifs when it builds the bootable image. The IPL and/or startup code examine the members of the boot header structure to learn about the the contents of the image and how to use it. These members include:

signature, version, flags1, flags2, header_size, machine, startup_vaddr, paddr_bias, image_paddr, ram_paddr, ram_size, startup_size, stored_size, imagefs_paddr, imagefs_size, preboot_size, zero0, zero[3], info[48]

The table below lists the startup_header members and describes their uses. The “Used by” column indicates which component or components use the member: the IPL, the startup code, or both the IPL and the startup code.

Member Type Description Used by
signature _Uint32t

The signature is the first 32 bits of the header. It is used to identify the header, and always contains 0x00FF7EEB in native byte order.

Platforms that can be either big-endian or little-endian (a bi-endian machine), typically have a hardware strap that sets the board's endianness. The signature member must be set appropriately for the selected endianness.

version _Uint16t The version of mkifs that made the image. IPL
flags1 _Uint8t

flags1 is single-byte to ensure that it's endian-neutral. The following values are defined for flags1 (flags2 is currently not used):

If this flag is set, the operating system is to run with the Memory Management Unit (MMU) enabled.
Note: You should always specify a virtual system (by specifying the virtual= attribute in your buildfile, which then sets the STARTUP_HDR_FLAGS1_VIRTUAL flag).
The IPL is configured for a big-endian processor. If this flag isn't set, then the IPL is configured for a little-endian processor.
The IPL should always examine this flag to check that the endianness is correctly set for the processor.
The image isn't compressed.
The image is compressed using libz (gzip).
The image is compressed with liblzo.
The image is compressed with libucl. This is the format chosen when using the [+compress] attribute in the mkifs build script.
  • The STARTUP_HDR_FLAGS1_COMPRESS_* constants enumerate compression types. They may set more than one bit, so they aren't strictly flags.
  • The standard startup-* programs are built to understand only the UCL compression method. However, you can twiddle the SUPPORT_CMP_* macro definitions in startup/lib/uncompress.c to change to one of the other supported compression methods.
IPL and Startup
flags2 _Uint8t For future use n/a
header_size _Uint16t The size of the startup header, in bytes. Startup
machine _Uint16t Machine type, from sys/elf.h. IPL and Startup
startup_vaddr _Uint32t Virtual address to transfer to after IPL is done. IPL
paddr_bias _Uint32t Value to add to physical address to get a value to put into a pointer and indirect through. Startup
image_paddr _Uint32t Set by the IPL to the physical address of the image filesystem. Used by the startup code. IPL and Startup
ram_paddr _Uint32t The physical address in RAM to which the startup code must be copied. The size of the startup code is stored in startup_size member. IPL and Startup
ram_size _Uint32t The number of bytes the image will occupy when has been copied into RAM. This value is used by the startup code in the image and isn't currently needed by the IPL code. This size may be greater than stored_size if the image was compressed. It may also be smaller than stored_size if the image is XIP. Startup
startup_size _Uint32t The size of the startup code. Copy this number of bytes from the start of the image into RAM, at the location specifed by ram_paddr. The startup code is never compressed, so this size is true in all cases. IPL
ram_size _Uint32t The size of the image including the header. The stored_size member is also used in the copy and extraction routines for non-XIP images. IPL
imagefs_paddr _Uint32t Set by the IPL to the physical address of the image filesystem. Used by the startup code. IPL and Startup
imagefs_size _Uint32t Size of uncompressed image filesystem. Startup
preboot_size unsigned short

The number of bytes from the beginning of the loaded image to the startup header. This value will usually be zero on non-x86 boards, indicating that nothing precedes the startup portion.

On an x86 board with an APIC, this value is non-zero, because there's a small piece of code that gets data from the APIC in real mode, then switches into protected mode and performs the startup.

zero0 _Uint16t Zero filler; reserved for future expansion. n/a
zero[3] _Uint32t Zero filler; reserved for future expansion. n/a
info[48] _Uint32t The info member is an array of startup_info* structures. This member and the structures are described in The info member below. IPL and Startup