Boot: Use the PyPI version of imgtool
Modifies the Python wrapper for imgtool in TF-M to use the PyPI
version instead of the one in the MCUBoot repository.
Signed-off-by: Balint Matyi <Balint.Matyi@arm.com>
Change-Id: I0b3fb9c802c59628cced0962241a1b4573a00cfc
diff --git a/bl2/ext/mcuboot/MCUBoot.cmake b/bl2/ext/mcuboot/MCUBoot.cmake
index 71ed6e9..28dd7fe 100644
--- a/bl2/ext/mcuboot/MCUBoot.cmake
+++ b/bl2/ext/mcuboot/MCUBoot.cmake
@@ -166,7 +166,7 @@
POST_BUILD
#Sign secure binary image with default public key in mcuboot folder
- COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper.py
+ COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper/wrapper.py
ARGS -k ${KEY_FILE_S}
--public-key-format ${PUBLIC_KEY_FORMAT}
--align 1
@@ -182,7 +182,7 @@
${CMAKE_BINARY_DIR}/${_MY_PARAMS_S_BIN}_signed.bin
#Sign non-secure binary image with default public key in mcuboot folder
- COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper.py
+ COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper/wrapper.py
ARGS -k ${KEY_FILE_NS}
--public-key-format ${PUBLIC_KEY_FORMAT}
--align 1
@@ -263,7 +263,7 @@
-o ${CMAKE_BINARY_DIR}/${_MY_PARAMS_FULL_BIN}.bin
#Sign concatenated binary image with default public key in mcuboot folder
- COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper.py
+ COMMAND ${PYTHON_EXECUTABLE} ${MCUBOOT_DIR}/scripts/wrapper/wrapper.py
ARGS -k ${KEY_FILE}
--public-key-format ${PUBLIC_KEY_FORMAT}
--align 1
diff --git a/bl2/ext/mcuboot/scripts/requirements.txt b/bl2/ext/mcuboot/scripts/requirements.txt
index d3c54b4..14bbb18 100644
--- a/bl2/ext/mcuboot/scripts/requirements.txt
+++ b/bl2/ext/mcuboot/scripts/requirements.txt
@@ -2,4 +2,5 @@
pyasn1
pyyaml
cbor>=1.0.0
+imgtool>=1.6.0
click
\ No newline at end of file
diff --git a/bl2/ext/mcuboot/scripts/wrapper.py b/bl2/ext/mcuboot/scripts/wrapper/wrapper.py
similarity index 95%
rename from bl2/ext/mcuboot/scripts/wrapper.py
rename to bl2/ext/mcuboot/scripts/wrapper/wrapper.py
index 14ad07a..0944336 100644
--- a/bl2/ext/mcuboot/scripts/wrapper.py
+++ b/bl2/ext/mcuboot/scripts/wrapper/wrapper.py
@@ -11,13 +11,12 @@
import os
import sys
import click
-import macro_parser
-# Import the external MCUBoot repo's imgtool script
-scripts_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '../../../../../mcuboot/scripts'))
-sys.path.insert(0, scripts_path)
import imgtool
import imgtool.main
+# Import macro_parser script
+parser_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
+sys.path.append(parser_path)
+import macro_parser
sign_bin_size_re = re.compile(r"^\s*RE_SIGN_BIN_SIZE\s*=\s*(.*)")
load_addr_re = re.compile(r"^\s*RE_IMAGE_LOAD_ADDRESS\s*=\s*(.*)")