Commit d5d3359e authored by Thomas Altenbach's avatar Thomas Altenbach Committed by Jamie
Browse files

zephyr: Fix trailer size computation for swap-scratch



When swap-scratch is used, the trailer size doesn't have to be rounded
up to the next multiple of the sector size. Indeed, the trailer only
need to be sector-aligned for swap-move and swap-offset.

Signed-off-by: default avatarThomas Altenbach <thomas.altenbach@legrand.com>
parent f9e4e529
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -678,7 +678,10 @@ if(SYSBUILD)
    endif()

    math(EXPR trailer_size "${key_size} + ${boot_magic_size} + ${boot_swap_data_size} + ${boot_status_data_size}")

    if(CONFIG_BOOT_SWAP_USING_MOVE OR CONFIG_BOOT_SWAP_USING_OFFSET)
      align_up(${trailer_size} ${erase_size} trailer_size)
    endif()

    math(EXPR required_size "${trailer_size} + ${boot_tlv_estimate}")

@@ -686,8 +689,11 @@ if(SYSBUILD)
      set(required_upgrade_size "0")
    else()
      math(EXPR required_upgrade_size "${boot_magic_size} + ${boot_swap_data_size} + ${boot_status_data_size}")

      if(CONFIG_BOOT_SWAP_USING_MOVE OR CONFIG_BOOT_SWAP_USING_OFFSET)
        align_up(${required_upgrade_size} ${erase_size} required_upgrade_size)
      endif()
    endif()

    if(CONFIG_BOOT_SWAP_USING_MOVE)
      math(EXPR required_size "${required_size} + ${erase_size}")