K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches
Recovery image

Enumerations

enum  kfsw_golden_outcome { KFSW_GOLDEN_NOT_NEEDED = 0 , KFSW_GOLDEN_INSTALLED }
 

Functions

bool kfsw_golden_present (void)
 
int kfsw_golden_install (void)
 
int kfsw_golden_check (enum kfsw_golden_outcome *outcome)
 

Description

Installs the image held in the golden partition when the early flash boot budget reaches zero.

The bootloader only boots the slots, so installing means copying the image into the secondary slot and asking for a trial swap.

Enumeration Documentation

◆ kfsw_golden_outcome

#include <golden.h>

What a recovery decision concluded.

Enumerator
KFSW_GOLDEN_NOT_NEEDED 

The running image is within its budget, or there is nothing to install.

KFSW_GOLDEN_INSTALLED 

The recovery image is in the secondary slot and a swap is scheduled.

Function Documentation

◆ kfsw_golden_check()

int kfsw_golden_check ( enum kfsw_golden_outcome *  outcome)

#include <golden.h>

Install Golden at zero budget; MCUboot revert takes priority (-EBUSY).

Parameters
outcomeFilled with the decision. Must not be NULL.
Return values
0on success, a negative errno when the decision could not be made.

◆ kfsw_golden_install()

int kfsw_golden_install ( void  )

#include <golden.h>

Copy the recovery image into the secondary slot and schedule a swap.

The caller restarts the node. Refused with -EBUSY while the bootloader still needs the secondary slot to revert, because that revert is the cheaper recovery and it comes first. If cleanup fails, a later explicit install retries only the exact acquired transfer before beginning another copy.

Return values
0on success.
-ENOENTwhen the partition holds no image.
-EBADMSGwhen the image does not match its own SHA-256 TLV; the secondary slot is left untouched.
-ENODEVwhen this build has no golden partition.

◆ kfsw_golden_present()

bool kfsw_golden_present ( void  )

#include <golden.h>

Whether the golden partition holds something that looks like an image.

Checks the bootloader's magic only. kfsw_golden_install() also checks the image against its SHA-256 TLV before it erases anything; the signature is checked by the bootloader when it swaps.