[U-Boot] [PATCH 09/37] binman: Add a --toolpath option to set the tool search path

Simon Glass sjg at chromium.org
Fri Jun 28 14:08:51 UTC 2019

Sometimes tools used by binman may not be in the normal PATH search path,
such as when the tool is built by the U-Boot build itself (e.g. mkimage).
Provide a way to specify an additional search path for tools. The flag
can be used multiple times.

Update the help to describe this option.

Signed-off-by: Simon Glass <sjg at chromium.org>

 tools/binman/README     | 10 ++++++++++
 tools/binman/cmdline.py |  2 ++
 tools/binman/control.py |  1 +
 3 files changed, 13 insertions(+)

diff --git a/tools/binman/README b/tools/binman/README
index decca47bbf3..28624fadb33 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -691,6 +691,16 @@ Not all properties can be provided this way. Only some entries support it,
 typically for filenames.
+External tools
+Binman can make use of external command-line tools to handle processing of
+entry contents or to generate entry contents. These tools are executed using
+the 'tools' module's Run() method. The tools generally must exist on the PATH,
+but the --toolpath option can be used to specify additional search paths to
+use. This option can be specified multiple times to add more than one path.
 Code coverage
diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index 3886d52b3a0..ee19c5e33fe 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -52,6 +52,8 @@ def ParseArgs(argv):
                     default=False, help='run tests')
     parser.add_option('-T', '--test-coverage', action='store_true',
                     default=False, help='run tests and check for 100% coverage')
+    parser.add_option('--toolpath', type='string', action='append',
+            help='Add a path to the directories containing tools')
     parser.add_option('-u', '--update-fdt', action='store_true',
         default=False, help='Update the binman node with offset/size info')
     parser.add_option('-v', '--verbosity', default=1,
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 20186ee1980..df78848e13d 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -112,6 +112,7 @@ def Binman(options, args):
             tools.PrepareOutputDir(options.outdir, options.preserve)
+            tools.SetToolPaths(options.toolpath)
             # Get the device tree ready by compiling it and copying the compiled

More information about the U-Boot mailing list