aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalint Matyi <Balint.Matyi@arm.com>2020-06-22 08:35:52 +0100
committerTamas Ban <tamas.ban@arm.com>2020-07-22 11:40:16 +0000
commitd9abb4973c5d7842f3bab8a7b34736472000f98e (patch)
tree202ce2c8531c94c0ff4ac147f5c7245e8d66851a
parent3bae8830af4c9b443cf0aa0902bffb0f08328e92 (diff)
downloadtrusted-firmware-m-d9abb4973c5d7842f3bab8a7b34736472000f98e.tar.gz
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
-rw-r--r--bl2/ext/mcuboot/MCUBoot.cmake6
-rw-r--r--bl2/ext/mcuboot/scripts/requirements.txt1
-rw-r--r--bl2/ext/mcuboot/scripts/wrapper/wrapper.py (renamed from bl2/ext/mcuboot/scripts/wrapper.py)9
-rw-r--r--docs/getting_started/tfm_sw_requirement.rst11
4 files changed, 15 insertions, 12 deletions
diff --git a/bl2/ext/mcuboot/MCUBoot.cmake b/bl2/ext/mcuboot/MCUBoot.cmake
index 71ed6e915f..28dd7feaf9 100644
--- a/bl2/ext/mcuboot/MCUBoot.cmake
+++ b/bl2/ext/mcuboot/MCUBoot.cmake
@@ -166,7 +166,7 @@ if (MCUBOOT_IMAGE_NUMBER GREATER 1)
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 @@ if (MCUBOOT_IMAGE_NUMBER GREATER 1)
${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 @@ else() # MCUBOOT_IMAGE_NUMBER = 1
-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 d3c54b4671..14bbb18f34 100644
--- a/bl2/ext/mcuboot/scripts/requirements.txt
+++ b/bl2/ext/mcuboot/scripts/requirements.txt
@@ -2,4 +2,5 @@ cryptography
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
index 14ad07a103..09443367ef 100644
--- a/bl2/ext/mcuboot/scripts/wrapper.py
+++ b/bl2/ext/mcuboot/scripts/wrapper/wrapper.py
@@ -11,13 +11,12 @@ import re
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*(.*)")
diff --git a/docs/getting_started/tfm_sw_requirement.rst b/docs/getting_started/tfm_sw_requirement.rst
index 9b3e09b2bd..91869d274e 100644
--- a/docs/getting_started/tfm_sw_requirement.rst
+++ b/docs/getting_started/tfm_sw_requirement.rst
@@ -170,11 +170,11 @@ Install the following tools:
- CMake (see the "Supported CMake versions" chapter)
- GNU Make (see the "Supported make versions" chapter)
- Python3 and the pip package manager (from Python 3.4 it's included)
-- Python3 packages: *cryptography, pyasn1, yaml, jinja2 v2.10, cbor v1.0.0, click*
+- Python3 packages: *cryptography, pyasn1, yaml, jinja2 v2.10, cbor v1.0.0, click, imgtool v1.6.0*
.. code-block:: bash
- pip3 install --user cryptography pyasn1 pyyaml jinja2 cbor click
+ pip3 install --user cryptography pyasn1 pyyaml jinja2 cbor click imgtool
- SRecord v1.58 (for Musca test chip boards)
@@ -230,11 +230,11 @@ Install the following tools:
installation.
- Python3 `(native Windows version) <https://www.python.org/downloads/>`__ and
the pip package manager (from Python 3.4 it's included)
-- Python3 packages: *cryptography, pyasn1, yaml, jinja2 v2.10, cbor v1.0.0, click*
+- Python3 packages: *cryptography, pyasn1, yaml, jinja2 v2.10, cbor v1.0.0, click imgtool v1.6.0*
.. code-block:: bash
- pip3 install --user cryptography pyasn1 pyyaml jinja2 cbor click
+ pip3 install --user cryptography pyasn1 pyyaml jinja2 cbor click imgtool
- `SRecord v1.63 <https://sourceforge.net/projects/srecord/>`__ (for Musca test
chip boards)
@@ -493,6 +493,7 @@ To build the TF-M firmware the following tools are needed:
"cryptography",,"Firmware"
"cbor",,"Firmware"
"click",,"Firmware"
+ "imgtool",,"Firmware"
"Doxygen",">1.8","Reference manual"
"Sphinx",">1.4","User Guide"
"sphinxcontrib-plantuml",,"User Guide"
@@ -544,12 +545,14 @@ Dependency chain:
fw --> jinja2
fw --> cbor
fw --> click
+ fw --> imgtool
cryptography --> Python3
pyasn1 --> Python3
yaml --> Python3
jinja2 --> Python3
cbor --> Python3
click --> Python3
+ imgtool --> Python3
[*] --> u_guide
u_guide --> Sphinx