Tools: Make manifest tool aware of Partition Enabled status
The manifest tool does not know the enabled status of Partitions.
So it includes every Secure Partition in manifest list even when
some Partitions are disabled.
This patch makes the tool aware of the Partition enabled status basing
on the following feature:
The CMake command configure_file substitutes variable values referenced
as @VAR@ or ${VAR} in the input file content.
By adding "@" to "conditional" attribute in manifest lists, the
manifest tool will get the "conditional" replaced by real enabled status
such as "ON" and "OFF". And skips Partitions that are disabled.
Change-Id: I5ef8a0b5dfb17fd8eb3b5aaec054bc83cdacd8a1
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index 2fde44c..6207bb5 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -128,6 +128,25 @@
manifest_list_yaml_file.close()
for i, manifest_item in enumerate(manifest_list):
+ valid_enabled_conditions = ['on', 'true', 'enabled']
+ valid_disabled_conditions = ['off', 'false', 'disabled']
+ is_enabled = ''
+
+ if 'conditional' in manifest_item.keys():
+ is_enabled = manifest_item['conditional'].lower()
+ else:
+ # Partitions without 'conditional' is alwasy on
+ is_enabled = 'on'
+
+ if is_enabled in valid_disabled_conditions:
+ continue
+ elif is_enabled not in valid_enabled_conditions:
+ raise Exception('Invalid "conditional" attribute: "{}" for {}. '
+ 'Please set to one of {} or {}, case-insensitive.'\
+ .format(manifest_item['conditional'],
+ manifest_item['name'],
+ valid_enabled_conditions, valid_disabled_conditions))
+
# Check if partition ID is manually set
if 'pid' not in manifest_item.keys():
no_pid_manifest_idx.append(i)