diff options
author | Simon Glass <sjg@chromium.org> | 2018-07-17 13:25:32 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-08-01 16:30:47 -0600 |
commit | 53af22a9958ca93c89056ad2750ad0d46a51b6c8 (patch) | |
tree | 232abf4eb746495b01b96f3540a370ae71ac1da0 /tools/binman/control.py | |
parent | dc08ecc90cc57d7ca73f837a847a81c8b1e8af79 (diff) |
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.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/binman/control.py b/tools/binman/control.py index 9ac392b7e5..ab894a8aa8 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 |