aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/control.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-07-17 13:25:32 -0600
committerSimon Glass <sjg@chromium.org>2018-08-01 16:30:47 -0600
commit53af22a9958ca93c89056ad2750ad0d46a51b6c8 (patch)
tree232abf4eb746495b01b96f3540a370ae71ac1da0 /tools/binman/control.py
parentdc08ecc90cc57d7ca73f837a847a81c8b1e8af79 (diff)
downloadu-boot-53af22a9958ca93c89056ad2750ad0d46a51b6c8.zip
u-boot-53af22a9958ca93c89056ad2750ad0d46a51b6c8.tar.gz
u-boot-53af22a9958ca93c89056ad2750ad0d46a51b6c8.tar.bz2
binman: Add support for passing arguments to entries
Sometimes it is useful to pass binman the value of an entry property from the command line. For example some entries need access to files and it is not always convenient to put these filenames in the image definition (device tree). Add a -a option which can be used like this: -a<prop>=<value> where <prop> is the property to set <value> is the value to set it to Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/control.py')
-rw-r--r--tools/binman/control.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 9ac392b..ab894a8 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -7,6 +7,7 @@
from collections import OrderedDict
import os
+import re
import sys
import tools
@@ -25,6 +26,9 @@ images = OrderedDict()
# 'u-boot-spl.dtb')
fdt_files = {}
+# Arguments passed to binman to provide arguments to entries
+entry_args = {}
+
def _ReadImageDesc(binman_node):
"""Read the image descriptions from the /binman node
@@ -76,6 +80,20 @@ def GetFdt(fname):
def GetFdtPath(fname):
return fdt_files[fname]._fname
+def SetEntryArgs(args):
+ global entry_args
+
+ entry_args = {}
+ if args:
+ for arg in args:
+ m = re.match('([^=]*)=(.*)', arg)
+ if not m:
+ raise ValueError("Invalid entry arguemnt '%s'" % arg)
+ entry_args[m.group(1)] = m.group(2)
+
+def GetEntryArg(name):
+ return entry_args.get(name)
+
def Binman(options, args):
"""The main control code for binman
@@ -116,6 +134,7 @@ def Binman(options, args):
try:
tools.SetInputDirs(options.indir)
tools.PrepareOutputDir(options.outdir, options.preserve)
+ SetEntryArgs(options.entry_arg)
# Get the device tree ready by compiling it and copying the compiled
# output into a file in our output directly. Then scan it for use