diff options
author | Simon Glass <sjg@chromium.org> | 2018-09-14 04:57:19 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-09-28 11:09:01 -0600 |
commit | c55a50f558f13c6c018c0e5cc0f0d765711a3828 (patch) | |
tree | 5ba2ee5d52f3426569f33c199aab8d01e8d69a58 /tools/binman/control.py | |
parent | 6c234bfbf7a9c5b33c3bea92e037c45d37e94f35 (diff) | |
download | u-boot-c55a50f558f13c6c018c0e5cc0f0d765711a3828.zip u-boot-c55a50f558f13c6c018c0e5cc0f0d765711a3828.tar.gz u-boot-c55a50f558f13c6c018c0e5cc0f0d765711a3828.tar.bz2 |
binman: Move state information into a new module
At present the control module has state information in it, since it is the
primary user of this. But it is a bit odd to have entries and other
modules importing control to obtain this information.
It seems better to have a dedicated state module, which control can use as
well. Create a new module using code from control and update other modules
to use it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/control.py')
-rw-r--r-- | tools/binman/control.py | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/tools/binman/control.py b/tools/binman/control.py index ded1b71..00dcb8a 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -7,27 +7,19 @@ from collections import OrderedDict import os -import re import sys import tools import command import elf from image import Image +import state import tout # List of images we plan to create # Make this global so that it can be referenced from tests images = OrderedDict() -# Records the device-tree files known to binman, keyed by filename (e.g. -# '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 @@ -60,39 +52,15 @@ def _FindBinmanNode(dtb): return node return None -def GetFdt(fname): - """Get the Fdt object for a particular device-tree filename - - Binman keeps track of at least one device-tree file called u-boot.dtb but - can also have others (e.g. for SPL). This function looks up the given - filename and returns the associated Fdt object. +def WriteEntryDocs(modules, test_missing=None): + """Write out documentation for all entries Args: - fname: Filename to look up (e.g. 'u-boot.dtb'). - - Returns: - Fdt object associated with the filename + modules: List of Module objects to get docs for + test_missing: Used for testing only, to force an entry's documeentation + to show as missing even if it is present. Should be set to None in + normal use. """ - return fdt_files[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 WriteEntryDocs(modules, test_missing=None): from entry import Entry Entry.WriteDocs(modules, test_missing) @@ -141,7 +109,7 @@ def Binman(options, args): try: tools.SetInputDirs(options.indir) tools.PrepareOutputDir(options.outdir, options.preserve) - SetEntryArgs(options.entry_arg) + state.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 @@ -154,7 +122,7 @@ def Binman(options, args): dtb = fdt.FdtScan(fname) # Note the file so that GetFdt() can find it - fdt_files['u-boot.dtb'] = dtb + state.fdt_files['u-boot.dtb'] = dtb node = _FindBinmanNode(dtb) if not node: raise ValueError("Device tree '%s' does not have a 'binman' " |