diff options
author | Simon Glass <sjg@chromium.org> | 2019-08-24 07:22:44 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-10-15 08:40:02 -0600 |
commit | 8dbb7444ebaa499b753269c88cdd76f12f0fa875 (patch) | |
tree | a0686156cbdc102690cc019b5c7c5b3057a3a4cb /tools/binman/control.py | |
parent | b986b3bb192f772a7c81c69aafe59094df7d4b81 (diff) |
binman: Allow use of help and entry-docs without libfdt
At present if libfdt is not available binman can't do anything much.
Improve the situation a little.
Ideally there should be a test to cover this, but I'm not quite sure how
to fake this.
Signed-off-by: Simon Glass <sjg@chromium.org>
(fixed up missing ReadChildData() enty test)
Diffstat (limited to 'tools/binman/control.py')
-rw-r--r-- | tools/binman/control.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/binman/control.py b/tools/binman/control.py index cb51bc2dd46..8268eda37ea 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -15,8 +15,6 @@ import tools import cbfs_util import command import elf -from image import Image -import state import tout # List of images we plan to create @@ -113,6 +111,9 @@ def ReadEntry(image_fname, entry_path, decomp=True): Returns: data extracted from the entry """ + global Image + from image import Image + image = Image.FromFile(image_fname) entry = image.FindEntryPath(entry_path) return entry.ReadData(decomp) @@ -459,6 +460,9 @@ def Binman(args): Args: args: Command line arguments Namespace object """ + global Image + global state + if args.full_help: pager = os.getenv('PAGER') if not pager: @@ -468,6 +472,10 @@ def Binman(args): command.Run(pager, fname) return 0 + # Put these here so that we can import this module without libfdt + from image import Image + import state + if args.cmd in ['ls', 'extract', 'replace']: try: tout.Init(args.verbosity) |