From 8252f3ee6ece806f4c96b61ed7b1a896e54bda60 Mon Sep 17 00:00:00 2001 From: Vikas Katariya Date: Mon, 11 May 2020 17:33:32 +0100 Subject: [PATCH] psa: Add TF-M utility scripts to python path When python3 is enforced to build the ARM_MUSCA_A1 or ARM_MUSCA_B1 targets, it is unable to find binary utility tool scripts which are imported from TF-M. The reason to use the python3 environment is as follows: Mbed OS + TFM contained a faulty boot record TLV, which failed the attestation test (TF-M regression). The data in the boot record TLV will be included in the generated attestation token as 1 item in the SW_COMPONENTS claim. This data (in the boot record TLV) is pre-encoded in CBOR format at build time and appended to the image during the image signing process (done by the imgtool Python3 script). Signed-off-by: Vikas Katariya --- tools/targets/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/targets/__init__.py b/tools/targets/__init__.py index 4db6d21fdc..ba16450171 100644 --- a/tools/targets/__init__.py +++ b/tools/targets/__init__.py @@ -22,6 +22,7 @@ import struct import shutil import inspect import sys + from collections import namedtuple from copy import copy from future.utils import raise_from @@ -31,6 +32,11 @@ from tools.paths import TOOLS_BOOTLOADERS from tools.utils import json_file_to_dict, NotSupportedException from tools.psa import find_secure_image +# Add PSA TF-M binary utility scripts in system path +from os.path import dirname, abspath, join +TFM_SCRIPTS = abspath(join(dirname(__file__), '..', 'psa', 'tfm', 'bin_utils')) +sys.path.insert(0, TFM_SCRIPTS) + __all__ = ["target", "TARGETS", "TARGET_MAP", "TARGET_NAMES", "CORE_LABELS", "CORE_ARCH", "HookError", "generate_py_target", "Target",