Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ This feature is disabled by default. To enable it, set
smaller than, the flash write granularity. Raise it on platforms whose flash
write word is wider than 16 bytes (for example 32 for the 256-bit words on
STM32H7).
- On the disk boot path (`WOLFBOOT_UPDATE_DISK`) use SPI flash: `EXT_FLASH=1`,
`WOLFBOOT_DIAGNOSTICS_EXT=1` and `WOLFBOOT_SECTOR_SIZE` set to its erase
block (`0x20000` on the ZCU102 QSPI).

The region is managed as a circular store over its sectors. With two or more
sectors, older records are retained until the log wraps all the way around, so
Expand All @@ -117,11 +120,17 @@ The following events are recorded:
- A rollback was caused by a new image that never confirmed via
`wolfBoot_success()` (`WOLFBOOT_FAILURE_PHASE_ROLLBACK`).

On the disk boot path each refused slot is recorded, with `partition` set to
the slot (0 A, 1 B, 2 golden), followed by a `WOLFBOOT_FAILURE_PHASE_RECOVERY`
record when no slot boots. The newest record is printed at the next boot.

For verification failures, the cause distinguishes a bad header
(`WOLFBOOT_FAILURE_CAUSE_HEADER`), a failed integrity/hash check
(`WOLFBOOT_FAILURE_CAUSE_HASH`) and a failed signature/authenticity check
(`WOLFBOOT_FAILURE_CAUSE_SIGNATURE`). A rollback uses
`WOLFBOOT_FAILURE_CAUSE_NOT_CONFIRMED`.
`WOLFBOOT_FAILURE_CAUSE_NOT_CONFIRMED`. The disk boot path adds
`WOLFBOOT_FAILURE_CAUSE_DECRYPT`, `WOLFBOOT_FAILURE_CAUSE_VERSION` and
`WOLFBOOT_FAILURE_CAUSE_READ`.

The application can read the records, ordered newest-first, through this API:

Expand Down
4 changes: 4 additions & 0 deletions docs/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ A dual-boot target that loads the image to RAM (two fixed slots, no swap, `src/u

`DUALBOOT_ROLLBACK_UNCONFIRMED=1` lets that fallback go to a lower version: the other slot boots, and the unconfirmed slot is erased once that image has passed verification. If the other slot fails verification, the unconfirmed image is kept and booted again. The version check for confirmed images is unchanged. The option is not available with the hardware-assisted swap loader. The trade-off is that someone able to reset the board during the probation window can keep it on the older image, which `ALLOW_DOWNGRADE=0` otherwise prevents once the newer one has been written.

### Boot stage timing

`BOOT_BENCHMARK=1` prints the time of each step. On the disk boot path it also passes `/chosen/wolfboot,boot-times` to the OS: six big-endian 32-bit stamps in microseconds of `hal_get_timer_us()`, taken at wolfBoot entry and at the end of load, decrypt, hash, verify and handoff (0 for a stage that did not run). On ZynqMP the counter starts at `psu_init`, so the entry stamp is the time spent before wolfBoot.

### Linux kernel command line (bootargs)

On the FIT Linux-boot targets whose DTB comes from the signed FIT (Versal, ZynqMP, PolarFire SoC), a DTB that already carries a non-empty `/chosen/bootargs` keeps it by default - the image boots with the arguments its kernel was validated with, and wolfBoot logs `FDT: using DTB bootargs: ...`. Three macros control this:
Expand Down
6 changes: 6 additions & 0 deletions include/wolfboot/wolfboot.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,12 @@ int wolfBoot_get_partition_state(uint8_t part, uint8_t *st);
#define WOLFBOOT_FAILURE_CAUSE_SIGNATURE 3 /* signature/auth check failed */
#define WOLFBOOT_FAILURE_CAUSE_NOT_CONFIRMED 4 /* image never confirmed via
* wolfBoot_success() */
#define WOLFBOOT_FAILURE_CAUSE_DECRYPT 5 /* image could not be
* decrypted */
#define WOLFBOOT_FAILURE_CAUSE_VERSION 6 /* below the version floor or
* a refused downgrade */
#define WOLFBOOT_FAILURE_CAUSE_READ 8 /* image could not be read
Comment thread
bigbrett marked this conversation as resolved.
Resolved
* from storage */

/* Persisted failure record. */
struct wolfBoot_failure_record {
Expand Down
Loading
Loading