aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/control.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-01-09 20:13:50 -0700
committerSimon Glass <sjg@chromium.org>2022-01-25 12:36:11 -0700
commit386c63cfad30901055a7d41173c2a99d268b6b0d (patch)
tree9382d73ce342712062c012ee88cf812b6d4b69e9 /tools/binman/control.py
parent252de6b1f7189062d984b72149ea4d3123a63d8d (diff)
downloadu-boot-386c63cfad30901055a7d41173c2a99d268b6b0d.zip
u-boot-386c63cfad30901055a7d41173c2a99d268b6b0d.tar.gz
u-boot-386c63cfad30901055a7d41173c2a99d268b6b0d.tar.bz2
binman: Plumb in support for bintools
Support collecting the available bintools needed by an image, by scanning the entries in the image. Also add a command-line interface to access the basic bintool features, such as listing the bintools and fetching them if needed. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/control.py')
-rw-r--r--tools/binman/control.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/binman/control.py b/tools/binman/control.py
index e0d2b38..5b10f19 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -14,6 +14,7 @@ import re
import sys
from patman import tools
+from binman import bintool
from binman import cbfs_util
from binman import elf
from patman import command
@@ -487,6 +488,7 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt, use_expanded):
# without changing the device-tree size, thus ensuring that our
# entry offsets remain the same.
for image in images.values():
+ image.CollectBintools()
image.ExpandEntries()
if update_fdt:
image.AddMissingProperties(True)
@@ -606,7 +608,7 @@ def Binman(args):
from binman.image import Image
from binman import state
- if args.cmd in ['ls', 'extract', 'replace']:
+ if args.cmd in ['ls', 'extract', 'replace', 'tool']:
try:
tout.Init(args.verbosity)
tools.PrepareOutputDir(None)
@@ -621,6 +623,19 @@ def Binman(args):
ReplaceEntries(args.image, args.filename, args.indir, args.paths,
do_compress=not args.compressed,
allow_resize=not args.fix_size, write_map=args.map)
+
+ if args.cmd == 'tool':
+ tools.SetToolPaths(args.toolpath)
+ if args.list:
+ bintool.Bintool.list_all()
+ elif args.fetch:
+ if not args.bintools:
+ raise ValueError(
+ "Please specify bintools to fetch or 'all' or 'missing'")
+ bintool.Bintool.fetch_tools(bintool.FETCH_ANY,
+ args.bintools)
+ else:
+ raise ValueError("Invalid arguments to 'tool' subcommand")
except:
raise
finally: