Commit e6ab34c3 authored by David Brown's avatar David Brown Committed by Fabio Utzig
Browse files

Allow upgrades of only one slot

When only upgrading one slot, the swap type for the non upgraded slot is
BOOT_SWAP_TYPE_FAIL instead of NONE.  Account for this, and check slot 0
in this case.

This is probably not the correct solution, but it is unclear of the
timing of when the dependencies of the other images first slot would be
checked.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
Signed-off-by: default avatarFabio Utzig <utzig@apache.org>
parent 873be31d
Loading
Loading
Loading
Loading
+3 −1
Changes for boot/bootutil/src/loader.c: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -1831,10 +1831,12 @@ boot_verify_slot_dependency(struct boot_loader_state *state,
    struct image_version *dep_version;
    size_t dep_slot;
    int rc;
    uint8_t swap_type;

    /* Determine the source of the image which is the subject of
     * the dependency and get it's version. */
    dep_slot = (state->swap_type[dep->image_id] != BOOT_SWAP_TYPE_NONE) ?
    swap_type = state->swap_type[dep->image_id];
    dep_slot = (swap_type != BOOT_SWAP_TYPE_NONE && swap_type != BOOT_SWAP_TYPE_FAIL) ?
                BOOT_SECONDARY_SLOT : BOOT_PRIMARY_SLOT;
    dep_version = &state->imgs[dep->image_id][dep_slot].hdr.ih_ver;