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)
import cbfs_util
import command
import elf
-from image import Image
-import state
import tout
# List of images we plan to create
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)
Args:
args: Command line arguments Namespace object
"""
+ global Image
+ global state
+
if args.full_help:
pager = os.getenv('PAGER')
if not pager:
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)
import sys
import fdt_util
-import state
import tools
from tools import ToHex, ToHexSize
import tout
orig_size: Original size value read from node
"""
def __init__(self, section, etype, node, name_prefix=''):
+ # Put this here to allow entry-docs and help to work without libfdt
+ global state
+ import state
+
self.section = section
self.etype = etype
self._node = node
base = entry.Entry.Create(None, self.GetNode(), 'blob-dtb')
self.assertTrue(base.WriteChildData(base))
+ def testReadChildData(self):
+ """Test the ReadChildData() method of the base class"""
+ base = entry.Entry.Create(None, self.GetNode(), 'blob-dtb')
+ self.assertIsNone(base.ReadChildData(base))
+
if __name__ == "__main__":
unittest.main()
from entry import Entry
import fdt_util
-import state
import tools
import tout
# Entry-type module for U-Boot device tree files
#
-import state
-
from entry import Entry
from blob import Entry_blob
'state' module.
"""
def __init__(self, section, etype, node):
+ # Put this here to allow entry-docs and help to work without libfdt
+ global state
+ import state
+
Entry_blob.__init__(self, section, etype, node)
def ObtainContents(self):
from cbfs_util import CbfsWriter
from entry import Entry
import fdt_util
-import state
class Entry_cbfs(Entry):
"""Entry containing a Coreboot Filesystem (CBFS)
both of size 1MB.
"""
def __init__(self, section, etype, node):
+ # Put this here to allow entry-docs and help to work without libfdt
+ global state
+ import state
+
Entry.__init__(self, section, etype, node)
self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86')
self._cbfs_entries = OrderedDict()
image.
"""
-import libfdt
-
from entry import Entry
-from fdt import Fdt
-import state
import tools
import tout
added as necessary. See the binman README.
"""
def __init__(self, section, etype, node):
+ # Put these here to allow entry-docs and help to work without libfdt
+ global libfdt
+ global state
+ global Fdt
+
+ import libfdt
+ import state
+ from fdt import Fdt
+
Entry.__init__(self, section, etype, node)
def _GetFdtmap(self):
from section import Entry_section
import fdt_util
-import state
import tools
at run-time so you can obtain the file positions.
"""
def __init__(self, section, etype, node):
+ # Put this here to allow entry-docs and help to work without libfdt
+ global state
+ import state
+
Entry_section.__init__(self, section, etype, node)
self._pattern = fdt_util.GetString(self._node, 'pattern')
if not self._pattern:
from entry import Entry
from blob_dtb import Entry_blob_dtb
-import state
import tools
class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
it available to u_boot_ucode.
"""
def __init__(self, section, etype, node):
+ # Put this here to allow entry-docs and help to work without libfdt
+ global state
+ import state
+
Entry_blob_dtb.__init__(self, section, etype, node)
self.ucode_data = b''
self.collate = False