boot: bootutil: loader: Let image version comparison use build number
Change allows using build number in image version comparison.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig
index b232110..1493dc3 100644
--- a/boot/zephyr/Kconfig
+++ b/boot/zephyr/Kconfig
@@ -522,6 +522,15 @@
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
diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h
index a235e15..e14bf4c 100644
--- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h
+++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h
@@ -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