mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 17:14:21 +00:00
SPM: Alter sp_gen.mk entry depending on owner of partition
With recently introduced dualroot CoT for SPs where they are owned either by SiP or by Platform. SiP owned SPs index starts at SP_PKG1_ID while Plat owned SPs index starts at SP_PKG5_ID. This patch modifies SP makefile generator script to take CoT as an argument and if it is "dualroot" then generates SP_PKG in order mentioned above, otherwise generates it sequentially. Signed-off-by: Ruari Phipps <ruari.phipps@arm.com> Change-Id: Iffad1131787be650a9462f6f8cc09b603cddb3b8
This commit is contained in:
parent
990d972f1b
commit
1e7528ec37
2 changed files with 34 additions and 4 deletions
2
Makefile
2
Makefile
|
@ -1135,7 +1135,7 @@ endif
|
|||
# Add Secure Partition packages
|
||||
ifeq (${NEED_SP_PKG},yes)
|
||||
$(BUILD_PLAT)/sp_gen.mk: ${SP_MK_GEN} ${SP_LAYOUT_FILE} | ${BUILD_PLAT}
|
||||
${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT)
|
||||
${Q}${PYTHON} "$<" "$@" $(filter-out $<,$^) $(BUILD_PLAT) ${COT}
|
||||
sp: $(SPTOOL) $(DTBS) $(BUILD_PLAT)/sp_gen.mk
|
||||
${Q}$(SPTOOL) $(SPTOOL_ARGS)
|
||||
@${ECHO_BLANK_LINE}
|
||||
|
|
|
@ -19,6 +19,7 @@ standard format.
|
|||
param1: Generated mk file "sp_gen.mk"
|
||||
param2: "SP_LAYOUT_FILE", json file containing platform provided information
|
||||
param3: plat out directory
|
||||
param4: CoT parameter
|
||||
|
||||
Generated "sp_gen.mk" file contains triplet of following information for each
|
||||
Secure Partition entry
|
||||
|
@ -58,11 +59,39 @@ json_dir = os.path.dirname(json_file)
|
|||
gen_file = os.path.abspath(sys.argv[1])
|
||||
out_dir = os.path.abspath(sys.argv[3])
|
||||
dtb_dir = out_dir + "/fdts/"
|
||||
MAX_SP = 8
|
||||
dualroot = sys.argv[4].lower() == "dualroot"
|
||||
split = int(MAX_SP / 2)
|
||||
print(dtb_dir)
|
||||
platform_count = 1
|
||||
sip_count = 1
|
||||
|
||||
with open(gen_file, 'w') as out_file:
|
||||
for idx, key in enumerate(data.keys()):
|
||||
|
||||
pkg_num = idx + 1
|
||||
|
||||
if (pkg_num > MAX_SP):
|
||||
print("WARNING: Too many secure partitions\n")
|
||||
exit(-1)
|
||||
|
||||
if dualroot:
|
||||
owner = data[key].get('owner')
|
||||
if owner == "Plat":
|
||||
if (platform_count > split):
|
||||
print("WARNING: Maximum Secure partitions by Plat " +
|
||||
"have been exceeded (" + str(split) + ")\n")
|
||||
exit(-1)
|
||||
pkg_num = split + platform_count
|
||||
platform_count += 1
|
||||
elif (sip_count > split):
|
||||
print("WARNING: Maximum Secure partitions by SiP " +
|
||||
"have been exceeded (" + str(split) + ")\n")
|
||||
exit(-1)
|
||||
else:
|
||||
pkg_num = sip_count
|
||||
sip_count += 1
|
||||
|
||||
"""
|
||||
Append FDT_SOURCES
|
||||
"""
|
||||
|
@ -81,10 +110,10 @@ with open(gen_file, 'w') as out_file:
|
|||
Extract uuid from partition manifest
|
||||
"""
|
||||
pm_file = open(dts)
|
||||
key = "uuid"
|
||||
uuid_key = "uuid"
|
||||
|
||||
for line in pm_file:
|
||||
if key in line:
|
||||
if uuid_key in line:
|
||||
uuid_hex = re.findall(r'\<(.+?)\>', line)[0];
|
||||
|
||||
# PM has uuid in format 0xABC... 0x... 0x... 0x...
|
||||
|
@ -103,5 +132,6 @@ with open(gen_file, 'w') as out_file:
|
|||
"""
|
||||
Append CRT_ARGS
|
||||
"""
|
||||
out_file.write("CRT_ARGS += --sp-pkg" + str(idx + 1) + " " + dst + "\n")
|
||||
|
||||
out_file.write("CRT_ARGS += --sp-pkg" + str(pkg_num) + " " + dst + "\n")
|
||||
out_file.write("\n")
|
||||
|
|
Loading…
Add table
Reference in a new issue