Loading boot/bootutil/src/loader.c +17 −5 Changes for boot/bootutil/src/loader.c: 17 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -622,15 +622,17 @@ boot_check_header_erased(struct boot_loader_state *state, int slot) defined(MCUBOOT_RAM_LOAD) || \ defined(MCUBOOT_DOWNGRADE_PREVENTION) /** * Compare image version numbers not including the build number * Compare image version numbers * * By default, the comparison does not take build number into account. * Enable MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER to take the build number into account. * * @param ver1 Pointer to the first image version to compare. * @param ver2 Pointer to the second image version to compare. * * @retval -1 If ver1 is strictly less than ver2. * @retval 0 If the image version numbers are equal, * (not including the build number). * @retval 1 If ver1 is strictly greater than ver2. * @retval -1 If ver1 is less than ver2. * @retval 0 If the image version numbers are equal. * @retval 1 If ver1 is greater than ver2. */ static int boot_version_cmp(const struct image_version *ver1, Loading @@ -657,6 +659,16 @@ boot_version_cmp(const struct image_version *ver1, return -1; } #if defined(MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER) /* The revisions are equal, continue comparison. */ if (ver1->iv_build_num > ver2->iv_build_num) { return 1; } if (ver1->iv_build_num < ver2->iv_build_num) { return -1; } #endif return 0; } #endif Loading boot/zephyr/Kconfig +9 −0 Changes for boot/zephyr/Kconfig: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -522,6 +522,15 @@ config UPDATEABLE_IMAGE_NUMBER help Enables support of multi image update. config BOOT_VERSION_CMP_USE_BUILD_NUMBER bool "Use build number while comparing image version" depends on (UPDATEABLE_IMAGE_NUMBER > 1) || BOOT_DIRECT_XIP || \ BOOT_RAM_LOAD || MCUBOOT_DOWNGRADE_PREVENTION help By default, the image version comparison relies only on version major, minor and revision. Enable this option to take into account the build number as well. choice BOOT_DOWNGRADE_PREVENTION_CHOICE prompt "Downgrade prevention" optional Loading boot/zephyr/include/mcuboot_config/mcuboot_config.h +4 −0 Changes for boot/zephyr/include/mcuboot_config/mcuboot_config.h: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -93,6 +93,10 @@ #define MCUBOOT_IMAGE_NUMBER 1 #endif #ifdef CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER #define MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER #endif #ifdef CONFIG_BOOT_SWAP_SAVE_ENCTLV #define MCUBOOT_SWAP_SAVE_ENCTLV 1 #endif Loading Loading
boot/bootutil/src/loader.c +17 −5 Changes for boot/bootutil/src/loader.c: 17 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -622,15 +622,17 @@ boot_check_header_erased(struct boot_loader_state *state, int slot) defined(MCUBOOT_RAM_LOAD) || \ defined(MCUBOOT_DOWNGRADE_PREVENTION) /** * Compare image version numbers not including the build number * Compare image version numbers * * By default, the comparison does not take build number into account. * Enable MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER to take the build number into account. * * @param ver1 Pointer to the first image version to compare. * @param ver2 Pointer to the second image version to compare. * * @retval -1 If ver1 is strictly less than ver2. * @retval 0 If the image version numbers are equal, * (not including the build number). * @retval 1 If ver1 is strictly greater than ver2. * @retval -1 If ver1 is less than ver2. * @retval 0 If the image version numbers are equal. * @retval 1 If ver1 is greater than ver2. */ static int boot_version_cmp(const struct image_version *ver1, Loading @@ -657,6 +659,16 @@ boot_version_cmp(const struct image_version *ver1, return -1; } #if defined(MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER) /* The revisions are equal, continue comparison. */ if (ver1->iv_build_num > ver2->iv_build_num) { return 1; } if (ver1->iv_build_num < ver2->iv_build_num) { return -1; } #endif return 0; } #endif Loading
boot/zephyr/Kconfig +9 −0 Changes for boot/zephyr/Kconfig: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -522,6 +522,15 @@ config UPDATEABLE_IMAGE_NUMBER help Enables support of multi image update. config BOOT_VERSION_CMP_USE_BUILD_NUMBER bool "Use build number while comparing image version" depends on (UPDATEABLE_IMAGE_NUMBER > 1) || BOOT_DIRECT_XIP || \ BOOT_RAM_LOAD || MCUBOOT_DOWNGRADE_PREVENTION help By default, the image version comparison relies only on version major, minor and revision. Enable this option to take into account the build number as well. choice BOOT_DOWNGRADE_PREVENTION_CHOICE prompt "Downgrade prevention" optional Loading
boot/zephyr/include/mcuboot_config/mcuboot_config.h +4 −0 Changes for boot/zephyr/include/mcuboot_config/mcuboot_config.h: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -93,6 +93,10 @@ #define MCUBOOT_IMAGE_NUMBER 1 #endif #ifdef CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER #define MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER #endif #ifdef CONFIG_BOOT_SWAP_SAVE_ENCTLV #define MCUBOOT_SWAP_SAVE_ENCTLV 1 #endif Loading