Boot: Add version number from command line
- Add an optional command line argument that can be used to set an
image's version number at build-time (using
-DIMAGE_VERSION=maj.min.rev+build) so that the Cmake command within
bl2/ext/mcuboot/MCUBoot.cmake doesn't need to be edited each time the
specified version number needs to be changed
- If the version number is not defined in the command line, use a
default value and automatically increment it in the next build
Signed-off-by: Oliver Swede <oli.swede@arm.com>
Change-Id: I3ff44ffb8219d7ea1a441d918cceb525e7af60f2
diff --git a/bl2/ext/mcuboot/scripts/imgtool/image.py b/bl2/ext/mcuboot/scripts/imgtool/image.py
index f8309b3..9731844 100644
--- a/bl2/ext/mcuboot/scripts/imgtool/image.py
+++ b/bl2/ext/mcuboot/scripts/imgtool/image.py
@@ -79,8 +79,8 @@
obj.check()
return obj
- def __init__(self, version=None, header_size=IMAGE_HEADER_SIZE, pad=0):
- self.version = version or versmod.decode_version("0")
+ def __init__(self, version, header_size=IMAGE_HEADER_SIZE, pad=0):
+ self.version = version
self.header_size = header_size or IMAGE_HEADER_SIZE
self.pad = pad
@@ -182,4 +182,4 @@
pbytes = b'\xff' * padding
pbytes += b'\xff' * (tsize - len(boot_magic))
pbytes += boot_magic
- self.payload += pbytes
+ self.payload += pbytes
\ No newline at end of file