| English | 简体中文 |
Offsets are what scripts/package.sh
writes.
| Offset | Content |
|---|---|
0x000000 |
GPT (from binaries/rk3576_spi_nor_gpt.img) |
0x008000 |
idblock: DDR init + U-Boot SPL, about 190 KB |
0x060000 |
FIT: BL31, EDK2, DTB. May grow up to 0xFC0000. |
0xFC0000 |
UEFI variable store, 64 KB |
0xFD0000 |
FTW working block, 64 KB |
0xFE0000 |
FTW spare block, 64 KB |
The three NV regions ship in the erased state (all 0xFF). Zeros there read
as a corrupt store rather than an empty one, and variables never initialise.
On SPI NOR the variable driver reads and writes the flash itself.
| Sector | Byte offset | Content |
|---|---|---|
| 64 | 0x008000 |
idblock: DDR init + U-Boot SPL |
| 16384 | 0x800000 |
FIT: BL31, EDK2, DTB and the UEFI variable store |
| 43648 | 0x1550000 |
inside the FIT: the image nvdata, the UEFI variable store, 192 KB (store, FTW working, FTW spare), erased state |
On SD and eMMC the variable store travels inside the FIT as its last image,
nvdata. The SPL loads it to PcdFlashNvStorageVariableBase64
(0x415C0000) on every boot, and RkFvbDxe writes changes back to the same
bytes of the card. That is the only way a saved variable gets back into
memory on these media. package.sh takes the address and size from
RK3576.fdf, finds where mkimage put nvdata, and checks that those bytes
of the image are all 0xFF.
So a write that should keep the settings stops at sector 43648: the
“keep the partitions” write is sectors 64 to 43647 of the eMMC image, written
at sector 64 (flashing).
The web flasher reads the FIT in the image and refuses that write if
nvdata does not start at sector 43648.
<Board>-emmc-edk2-<ver>.img is the same bytes with a protective MBR and a
primary GPT in front:
| Sector | Content |
|---|---|
| 0 to 33 | protective MBR and primary GPT |
| 64 to 131071 | p1 firmware (64 MiB, no file system) |
| 131072 to the end | p2 data, unformatted, the rest of the eMMC |
The image stops at 32 MiB, so the backup GPT is missing until
sgdisk -e is run on the board. <Board>-emmc.sfdisk is the same table on
its own.
| Image | Load address | What |
|---|---|---|
atf-1 |
0x3fe70000 |
BL31, PMU SRAM segment |
atf-2 |
0x40040000 |
BL31 main code; the configuration’s entry point |
atf-3 |
0x4005d000 |
BL31 coherent data |
fdt |
none | The DTB the SPL uses |
edk2 |
0x40800000 |
EDK2 as BL33. Must match TF-A’s BL33_BASE. |
nvdata |
0x415c0000 |
UEFI variable store (SD and eMMC images only) |
RK3576’s DRAM starts at 0x40000000, so every load address except the PMU
SRAM segment sits just above that base. The FIT is built with external data
(mkimage -E -B 0x1000): a 4 KB header followed by the payloads. The ITS is
generated by
scripts/lib/gen_fit_its.py.
BootROM
-> idblock (DDR init, then SPL)
-> SPL loads the FIT
-> BL31 at 0x40040000, EL3
-> EDK2 at 0x40800000, EL2 (BL33)
-> UEFI front page and boot manager