SPI Flash Layout
Overall, the SPI Flash consists of a Header, Checksum and an Image Payload (which includes the image information and the image binary).
The specific images of the flash consists of the Caliptra FW, MCU RT, SoC Manifest, and other SoC images, if any.
Layout
The main layout below describes v3. Legacy v1 and v2 layouts are available in the collapsible Legacy Formats sections at the end.
Note: All fields are little-endian byte-ordered unless specified otherwise.
A typical overall flash layout is:
| Flash Layout |
|---|
| Header |
| Payload |
The Payload contains the following fields:
| Payload |
|---|
| Image Info (Caliptra FMC + RT) |
| Image Info (SoC Manifest) |
| Image Info (MCU RT) |
| Image Info (Owner Auth Manifest) |
| Image Info (SoC Image 1) |
| ... |
| Image Info (SoC Image N) |
| Caliptra FMC + RT Package |
| SoC Manifest |
| MCU RT |
| Owner Auth Manifest |
| SoC Image 1 |
| ... |
| SoC Image N |
- Caliptra FMC and RT (refer to the Caliptra Firmware Image Bundle Format)
- SoC Manifest (refer to the description of the SoC Manifest)
- MCU RT: This is the image binary of the MCU Runtime firmware
- Owner Authorization Manifest
- Other SoC images (if any)
Header
The Header section contains the metadata for the images.
| Field | Size (bytes) | Description |
|---|---|---|
| Header Version | 2 | The header version format, allowing for backward compatibility if the package format changes over time. (Current version is 0x0003) |
| Image Count | 2 | The number of images contained in the Payload.Each image will have its own image information section. |
| Payload Offset | 4 | Offset in bytes of the header to where the first byte of the Payload is located. |
| Header Checksum | 4 | Checksum calculated for the header excluding this field |
Image Information
The Image Information section is repeated for each image and provides detailed manifest data specific to that image.
| Field | Size (bytes) | Description |
|---|---|---|
| Identifier | 4 | Vendor selected unique value to distinguish between images. |
0x00000000: Caliptra FMC+RT | ||
0x00000001: SoC Manifest | ||
0x00000002: MCU RT | ||
0x00000003: Owner Auth Manifest | ||
0x00000004: Vendor Authorization Key (V_AUTH_KEY_ID) | ||
0x00000005: Owner Measurement Policy (OWNER_MEASUREMENT_POLICY_IDENTIFIER) | ||
0x00000006: Owner Authorization Key (O_AUTH_KEY_ID) | ||
0x00000007-0x00000FFE: Reserved for subsystem control identifiers | ||
0x00000FFF: Reserved for the optional device UEID entry in the SoC Authorization Manifest (not a flash image identifier) | ||
0x00001000-0x0000FFFF: Reserved for other Vendor-defined SoC images | ||
0x00010000-0xFFFFFFFF: Reserved for Owner-only SoC images | ||
Vendor and Owner SoC image entries use the image's component_id (as reported by GET_IMAGE_INFO) as the identifier. | ||
| ImageLocationOffset | 4 | Offset in bytes from byte 0 of the header to where the image content begins. Used in flash-based boot. |
| Size | 4 | Size in bytes of the image. This is the actual size of the image without padding. |
| The image itself as written to the flash should be 4-byte aligned and additional | ||
| padding will be required to guarantee alignment. | ||
| Filename | 64 | Used in network boot to specify the TFTP path relative to the TFTP server root. Field is not used in flash-based boot |
| Image Checksum | 4 | Checksum calculated for the binary image. |
| Image Info Checksum | 4 | Checksum calculated for the header excluding this field |
Image
The images (raw binary data) are appended after the Image Information section, and should be in the same order as their corresponding Image Information.
| Field | Size (bytes) | Description |
|---|---|---|
| Data | N | Image content. |
| Note: The image should be 4-byte aligned. | ||
| If the size of a firmware image is not a multiple of 4 bytes, | ||
0x00 padding bytes will be added to meet the alignment requirement. | ||
| Only used in flash-based boot |
Legacy Formats
These formats use the same image identifiers and payload alignment rules
described above. The Payload Offset and ImageLocationOffset fields are
relative to the start of the flash image, not the start of the backing flash
device.
Each checksum is the wrapping 32-bit negation of the sum of its covered bytes. Checksums do not replace firmware authentication.
Version 1 (v1)
v1 has a 16-byte flash header beginning with the literal ASCII magic FLSH.
Each image information entry is 20 bytes and has no filename field.
v1 Header
| Field | Offset (bytes) | Size (bytes) | Description |
|---|---|---|---|
| Magic | 0 | 4 | ASCII FLSH, stored as bytes 46 4c 53 48. |
| Header Version | 4 | 2 | 0x0001. |
| Image Count | 6 | 2 | Number of image information entries. |
| Payload Offset | 8 | 4 | Offset to the first image information entry. |
| Header Checksum | 12 | 4 | Checksum of bytes 0 through 11, including the magic. |
| Total | 16 |
v1 Image Information
Offsets in this table are relative to the start of each entry.
| Field | Offset (bytes) | Size (bytes) | Description |
|---|---|---|---|
| Identifier | 0 | 4 | Image identifier, as described above. |
| ImageLocationOffset | 4 | 4 | Offset from the start of the flash image to the image content. |
| Size | 8 | 4 | Image size in bytes. |
| Image Checksum | 12 | 4 | Checksum of the image content. |
| Image Info Checksum | 16 | 4 | Checksum of entry bytes 0 through 15. |
| Total | 20 |
Version 2 (v2)
v2 removes the FLSH magic, reducing the flash header to 12 bytes.
It retains the same 20-byte image information entries as v1.
There is no filename field; filenames were introduced in v3.
v2 Header
| Field | Offset (bytes) | Size (bytes) | Description |
|---|---|---|---|
| Header Version | 0 | 2 | 0x0002. |
| Image Count | 2 | 2 | Number of image information entries. |
| Payload Offset | 4 | 4 | Offset to the first image information entry. |
| Header Checksum | 8 | 4 | Checksum of bytes 0 through 7. |
| Total | 12 |
v2 Image Information
Offsets in this table are relative to the start of each entry.
| Field | Offset (bytes) | Size (bytes) | Description |
|---|---|---|---|
| Identifier | 0 | 4 | Image identifier, as described above. |
| ImageLocationOffset | 4 | 4 | Offset from the start of the flash image to the image content. |
| Size | 8 | 4 | Image size in bytes. |
| Image Checksum | 12 | 4 | Checksum of the image content. |
| Image Info Checksum | 16 | 4 | Checksum of entry bytes 0 through 15. |
| Total | 20 |