dtoc: Support reading a list of arguments
It is helpful to support a string or stringlist containing a list of
space-separated arguments, for example:
args = "-n fred", "-a", "123";
This resolves to the list:
-n fred -a 123
which can be passed to a program as arguments.
Add a helper to do the required processing.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
index d59ea2f..c82e774 100644
--- a/tools/dtoc/fdt_util.py
+++ b/tools/dtoc/fdt_util.py
@@ -184,6 +184,18 @@
return [strval]
return value
+def GetArgs(node, propname):
+ prop = node.props.get(propname)
+ if not prop:
+ raise ValueError(f"Node '{node.path}': Expected property '{propname}'")
+ if prop.bytes:
+ value = GetStringList(node, propname)
+ else:
+ value = []
+ lists = [v.split() for v in value]
+ args = [x for l in lists for x in l]
+ return args
+
def GetBool(node, propname, default=False):
"""Get an boolean from a property