From 93273613b48048a4a884770e292e765fa85e3ad7 Mon Sep 17 00:00:00 2001 From: Ben Horgan Date: Tue, 29 Oct 2024 17:54:24 +0000 Subject: [PATCH] feat(sptool): populate secure partition number in makefile Calculate the secure partition number and saves it into the defined macro NUM_SP. Signed-off-by: Ben Horgan Signed-off-by: Leo Yan Change-Id: I4175a10d315482b65fd0f3eed4c6fd1e1e2b5e4d --- tools/sptool/sp_mk_generator.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/sptool/sp_mk_generator.py b/tools/sptool/sp_mk_generator.py index 1edb77d00..9bf5cd0bf 100644 --- a/tools/sptool/sp_mk_generator.py +++ b/tools/sptool/sp_mk_generator.py @@ -30,6 +30,9 @@ Secure Partition entry FIP_ARGS += --blob uuid=XXXXX-XXX...,file=sp1.pkg CRT_ARGS += --sp-pkg1 sp1.pkg +It populates the number of SP in the defined macro 'NUM_SP' + $(eval $(call add_define_val,NUM_SP,{len(sp_layout.keys())})) + A typical SP_LAYOUT_FILE file will look like { "SP1" : { @@ -151,6 +154,12 @@ def check_max_sps(sp_layout, _, args :dict): raise Exception(f"Too many SPs in SP layout file. Max: {MAX_SP}") return args +@SpSetupActions.sp_action(global_action=True) +def count_sps(sp_layout, _, args :dict): + ''' Count number of SP and put in NUM_SP ''' + write_to_sp_mk_gen(f"$(eval $(call add_define_val,NUM_SP,{len(sp_layout.keys())}))", args) + return args + @SpSetupActions.sp_action def gen_fdt_sources(sp_layout, sp, args :dict): ''' Generate FDT_SOURCES values for a given SP. '''