mirror of https://github.com/ARMmbed/mbed-os.git
PSA release script changes.
Since the offline build is made to auto-generate PSA related components and services for Secure targets, we can change the output directory to update the files in the respective locations. TARGET_PSA --TARGET_MBED_SPM --COMPONENT_SPE psa_setup.c --TARGET_TFM --COMPONENT_SPE --inc tfm_partition_defs.inc tfm_partition_list.inc tfm_service_list.inc tfm_spm_signal_defs.h --services --inc autogen_sid.h mbed_spm_partitions.h The release script is been modified to commit these files if there are any changes detected when `--commit` argument is passed. Cleaning of auto-generated is been removed as it uses the main directory for its operations, but PSA auto-generation will work if any of the service and application-based manifests are updated. Signed-off-by: Vikas Katariya <Vikas.Katariya@arm.com>pull/11685/head
parent
bd02761136
commit
dae119e7ea
|
@ -44,7 +44,7 @@ from tools.utils import argparse_filestring_type, args_error, argparse_many
|
||||||
from tools.utils import argparse_dir_not_parent
|
from tools.utils import argparse_dir_not_parent
|
||||||
from tools.utils import NoValidToolchainException
|
from tools.utils import NoValidToolchainException
|
||||||
from tools.utils import print_end_warnings
|
from tools.utils import print_end_warnings
|
||||||
from tools.psa import generate_psa_sources, clean_psa_autogen
|
from tools.psa import generate_psa_sources
|
||||||
from tools.resources import OsAndSpeResourceFilter
|
from tools.resources import OsAndSpeResourceFilter
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -166,9 +166,6 @@ def main():
|
||||||
skipped = []
|
skipped = []
|
||||||
end_warnings = []
|
end_warnings = []
|
||||||
|
|
||||||
if options.clean:
|
|
||||||
clean_psa_autogen()
|
|
||||||
|
|
||||||
for toolchain in toolchains:
|
for toolchain in toolchains:
|
||||||
for target_name in targets:
|
for target_name in targets:
|
||||||
target = Target.get_target(target_name)
|
target = Target.get_target(target_name)
|
||||||
|
|
|
@ -55,7 +55,7 @@ from tools.utils import print_end_warnings
|
||||||
from tools.utils import print_large_string
|
from tools.utils import print_large_string
|
||||||
from tools.settings import ROOT
|
from tools.settings import ROOT
|
||||||
from tools.targets import Target
|
from tools.targets import Target
|
||||||
from tools.psa import generate_psa_sources, clean_psa_autogen
|
from tools.psa import generate_psa_sources
|
||||||
from tools.resources import OsAndSpeResourceFilter
|
from tools.resources import OsAndSpeResourceFilter
|
||||||
|
|
||||||
def default_args_dict(options):
|
def default_args_dict(options):
|
||||||
|
@ -305,10 +305,6 @@ def main():
|
||||||
elif options.list_tests is True:
|
elif options.list_tests is True:
|
||||||
print('\n'.join(map(str, sorted(TEST_MAP.values()))))
|
print('\n'.join(map(str, sorted(TEST_MAP.values()))))
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if options.clean:
|
|
||||||
clean_psa_autogen()
|
|
||||||
|
|
||||||
# Target
|
# Target
|
||||||
if options.mcu is None:
|
if options.mcu is None:
|
||||||
args_error(parser, "argument -m/--mcu is required")
|
args_error(parser, "argument -m/--mcu is required")
|
||||||
|
|
|
@ -53,7 +53,7 @@ from tools.utils import print_large_string
|
||||||
from tools.utils import NotSupportedException
|
from tools.utils import NotSupportedException
|
||||||
from tools.options import extract_profile, list_profiles, extract_mcus
|
from tools.options import extract_profile, list_profiles, extract_mcus
|
||||||
from tools.notifier.term import TerminalNotifier
|
from tools.notifier.term import TerminalNotifier
|
||||||
from tools.psa import generate_psa_sources, clean_psa_autogen
|
from tools.psa import generate_psa_sources
|
||||||
from tools.resources import OsAndSpeResourceFilter
|
from tools.resources import OsAndSpeResourceFilter
|
||||||
|
|
||||||
""" The CLI entry point for exporting projects from the mbed tools to any of the
|
""" The CLI entry point for exporting projects from the mbed tools to any of the
|
||||||
|
@ -380,7 +380,6 @@ def main():
|
||||||
|
|
||||||
if options.clean:
|
if options.clean:
|
||||||
clean(options.source_dir)
|
clean(options.source_dir)
|
||||||
clean_psa_autogen()
|
|
||||||
|
|
||||||
ide = resolve_exporter_alias(options.ide)
|
ide = resolve_exporter_alias(options.ide)
|
||||||
exporter, toolchain_name = get_exporter_toolchain(ide)
|
exporter, toolchain_name = get_exporter_toolchain(ide)
|
||||||
|
|
|
@ -57,23 +57,11 @@ def find_secure_image(notify, resources, ns_image_path,
|
||||||
|
|
||||||
return secure_image
|
return secure_image
|
||||||
|
|
||||||
|
|
||||||
def _get_psa_autogen_dir():
|
|
||||||
return os.path.join(ROOT, 'PSA_AUTOGEN')
|
|
||||||
|
|
||||||
|
|
||||||
def clean_psa_autogen():
|
|
||||||
psa_out_dir = _get_psa_autogen_dir()
|
|
||||||
|
|
||||||
if os.path.isdir(psa_out_dir):
|
|
||||||
shutil.rmtree(psa_out_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def generate_psa_sources(source_dirs, ignore_paths):
|
def generate_psa_sources(source_dirs, ignore_paths):
|
||||||
services, apps = manifests_discovery(root_dirs=source_dirs,
|
services, apps = manifests_discovery(root_dirs=source_dirs,
|
||||||
ignore_paths=ignore_paths + ['.git'])
|
ignore_paths=ignore_paths + ['.git'])
|
||||||
assert len(services + apps), 'PSA manifest discovery failed'
|
assert len(services + apps), 'PSA manifest discovery failed'
|
||||||
psa_out_dir = _get_psa_autogen_dir()
|
psa_out_dir = os.path.join(ROOT, 'components', 'TARGET_PSA')
|
||||||
|
|
||||||
generate_spm_code(services, apps, psa_out_dir)
|
generate_spm_code(services, apps, psa_out_dir)
|
||||||
return psa_out_dir
|
return psa_out_dir
|
||||||
|
|
|
@ -48,7 +48,7 @@ PSA_TESTS = {
|
||||||
'*psa-crypto_access_control': ['USE_PSA_TEST_PARTITIONS',
|
'*psa-crypto_access_control': ['USE_PSA_TEST_PARTITIONS',
|
||||||
'USE_CRYPTO_ACL_TEST']
|
'USE_CRYPTO_ACL_TEST']
|
||||||
}
|
}
|
||||||
|
PSA_AUTOGEN_LOCATION = os.path.join(ROOT, 'components', 'TARGET_PSA')
|
||||||
|
|
||||||
def _psa_backend(target):
|
def _psa_backend(target):
|
||||||
"""
|
"""
|
||||||
|
@ -247,6 +247,34 @@ def commit_binaries(target, delivery_dir, toolchain):
|
||||||
else:
|
else:
|
||||||
logger.info("No changes detected in {}, Skipping commit".format(target))
|
logger.info("No changes detected in {}, Skipping commit".format(target))
|
||||||
|
|
||||||
|
def commit_psa_autogen():
|
||||||
|
"""
|
||||||
|
Commit changes related to auto-generated PSA components and services
|
||||||
|
"""
|
||||||
|
changes_made = verbose_check_call([
|
||||||
|
'git',
|
||||||
|
'-C', ROOT,
|
||||||
|
'diff', '--exit-code', '--quiet',
|
||||||
|
PSA_AUTOGEN_LOCATION], check_call=False)
|
||||||
|
|
||||||
|
if changes_made:
|
||||||
|
logger.info("Change in PSA auto-generated files has been detected")
|
||||||
|
verbose_check_call([
|
||||||
|
'git',
|
||||||
|
'-C', ROOT,
|
||||||
|
'add', PSA_AUTOGEN_LOCATION])
|
||||||
|
|
||||||
|
logger.info("Committing changes...")
|
||||||
|
commit_message = ('--message=Update PSA auto-generated components and '
|
||||||
|
'services')
|
||||||
|
verbose_check_call([
|
||||||
|
'git',
|
||||||
|
'-C', ROOT,
|
||||||
|
'commit',
|
||||||
|
commit_message])
|
||||||
|
else:
|
||||||
|
logger.info("No changes has been detected for PSA autogen, "
|
||||||
|
"Skipping commit")
|
||||||
|
|
||||||
def build_psa_platform(target, toolchain, delivery_dir, debug, git_commit,
|
def build_psa_platform(target, toolchain, delivery_dir, debug, git_commit,
|
||||||
skip_tests, args):
|
skip_tests, args):
|
||||||
|
@ -268,6 +296,7 @@ def build_psa_platform(target, toolchain, delivery_dir, debug, git_commit,
|
||||||
build_default_image(target, toolchain, profile, args)
|
build_default_image(target, toolchain, profile, args)
|
||||||
if git_commit:
|
if git_commit:
|
||||||
commit_binaries(target, delivery_dir, toolchain)
|
commit_binaries(target, delivery_dir, toolchain)
|
||||||
|
commit_psa_autogen()
|
||||||
|
|
||||||
|
|
||||||
def get_parser():
|
def get_parser():
|
||||||
|
|
|
@ -2,36 +2,36 @@
|
||||||
{
|
{
|
||||||
"name": "Secure Partition ID definitions",
|
"name": "Secure Partition ID definitions",
|
||||||
"template": "tools/psa/templates/tfm_partition_defs.inc.tpl",
|
"template": "tools/psa/templates/tfm_partition_defs.inc.tpl",
|
||||||
"output": "COMPONENT_SPE/TARGET_TFM/tfm_partition_defs.inc"
|
"output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_defs.inc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Secure Partition declarations",
|
"name": "Secure Partition declarations",
|
||||||
"template": "tools/psa/templates/tfm_partition_list.inc.tpl",
|
"template": "tools/psa/templates/tfm_partition_list.inc.tpl",
|
||||||
"output": "COMPONENT_SPE/TARGET_TFM/tfm_partition_list.inc"
|
"output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_list.inc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Secure Service list",
|
"name": "Secure Service list",
|
||||||
"template": "tools/psa/templates/tfm_service_list.inc.tpl",
|
"template": "tools/psa/templates/tfm_service_list.inc.tpl",
|
||||||
"output": "COMPONENT_SPE/TARGET_TFM/tfm_service_list.inc"
|
"output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_service_list.inc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Secure Service signals list",
|
"name": "Secure Service signals list",
|
||||||
"template": "tools/psa/templates/tfm_spm_signal_defs.h.tpl",
|
"template": "tools/psa/templates/tfm_spm_signal_defs.h.tpl",
|
||||||
"output": "COMPONENT_SPE/TARGET_TFM/tfm_spm_signal_defs.h"
|
"output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_spm_signal_defs.h"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mbed-SPM database",
|
"name": "mbed-SPM database",
|
||||||
"template": "tools/psa/templates/psa_setup.c.tpl",
|
"template": "tools/psa/templates/psa_setup.c.tpl",
|
||||||
"output": "COMPONENT_SPE/TARGET_MBED_SPM/psa_setup.c"
|
"output": "TARGET_MBED_SPM/COMPONENT_SPE/psa_setup.c"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Mappings from RoT Service names to SIDs",
|
"name": "Mappings from RoT Service names to SIDs",
|
||||||
"template": "tools/psa/templates/sid.h.tpl",
|
"template": "tools/psa/templates/sid.h.tpl",
|
||||||
"output": "autogen_sid.h"
|
"output": "services/inc/autogen_sid.h"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Details partition defines and structures",
|
"name": "Details partition defines and structures",
|
||||||
"template": "tools/psa/templates/mbed_spm_partitions.h.tpl",
|
"template": "tools/psa/templates/mbed_spm_partitions.h.tpl",
|
||||||
"output": "mbed_spm_partitions.h"
|
"output": "services/inc/mbed_spm_partitions.h"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -43,7 +43,7 @@ from tools.utils import argparse_dir_not_parent
|
||||||
from tools.utils import print_end_warnings
|
from tools.utils import print_end_warnings
|
||||||
from tools.settings import ROOT
|
from tools.settings import ROOT
|
||||||
from tools.targets import Target
|
from tools.targets import Target
|
||||||
from tools.psa import generate_psa_sources, clean_psa_autogen
|
from tools.psa import generate_psa_sources
|
||||||
from tools.resources import OsAndSpeResourceFilter, SpeOnlyResourceFilter
|
from tools.resources import OsAndSpeResourceFilter, SpeOnlyResourceFilter
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -220,10 +220,6 @@ def main():
|
||||||
print_tests(tests, options.format)
|
print_tests(tests, options.format)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if options.clean:
|
|
||||||
clean_psa_autogen()
|
|
||||||
|
|
||||||
# Build all tests
|
# Build all tests
|
||||||
if not options.build_dir:
|
if not options.build_dir:
|
||||||
args_error(parser, "argument --build is required")
|
args_error(parser, "argument --build is required")
|
||||||
|
|
Loading…
Reference in New Issue