binman: Allow help to work without libfdt
authorSimon Glass <sjg@chromium.org>
Tue, 17 Jul 2018 19:25:34 +0000 (13:25 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 1 Aug 2018 22:30:47 +0000 (16:30 -0600)
At present binman needs libfdt.py to be available before it will do
anything, even print help. Import those modules later to avoid this, as it
is bad practice to fail to even show help on startup.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/control.py

index ab894a8aa8db5663e34571302e5ba0d7107494aa..3c931d9aeb63290222f645561fa1214b8f8abc81 100644 (file)
@@ -13,8 +13,6 @@ import tools
 
 import command
 import elf
-import fdt
-import fdt_util
 from image import Image
 import tout
 
@@ -129,6 +127,11 @@ def Binman(options, args):
         options.indir.append(board_pathname)
 
     try:
+        # Import these here in case libfdt.py is not available, in which case
+        # the above help option still works.
+        import fdt
+        import fdt_util
+
         tout.Init(options.verbosity)
         elf.debug = options.debug
         try: