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 <vikas.katariya@arm.com>
pull/12955/head
Vikas Katariya 2020-05-11 17:33:32 +01:00 committed by Jaeden Amero
parent f4b676b4ee
commit 8252f3ee6e
1 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import struct
import shutil import shutil
import inspect import inspect
import sys import sys
from collections import namedtuple from collections import namedtuple
from copy import copy from copy import copy
from future.utils import raise_from 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.utils import json_file_to_dict, NotSupportedException
from tools.psa import find_secure_image 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", __all__ = ["target", "TARGETS", "TARGET_MAP", "TARGET_NAMES", "CORE_LABELS",
"CORE_ARCH", "HookError", "generate_py_target", "Target", "CORE_ARCH", "HookError", "generate_py_target", "Target",