Skip to content

Compatibility issues of slots when using the scratch swap method #2524

@TwoBrushes

Description

@TwoBrushes

Assuming that the primary slot has 64 sectors with a sector size of 1KB, the secondary slot has 32 sectors with a sector size of 2KB, and the scratch slot has 5 sectors with a sector size of 1KB (excluding the trailer size), the boot_slots_compatible(struct boot_loader_state *state) function should determine that the slots are compatible. Assuming the code is approximately 32KB, in the run_swap() function, sz = boot_copy_sz(state, last_sector_idx, &first_sector_idx), the return value of sz should be 5KB, since the sector indices in the input parameters are referenced to the primary slot. However, during the BOOT_STATUS_STATE_1 phase of the swap process, the secondary slot's sectors need to be erased. Since 5KB is not a boundary of the secondary slot, will erasing the secondary slot's sectors not erase the lower 1KB?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions