X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Fbinman%2Fetype%2Fcbfs.py;h=e9aed8310c7cba9a6a537fa37677d9dd14db00a0;hb=04da42770b0cc3bea8841972bfc9568299ece826;hp=d73c706c444649259a42d0a81ee22e0fef9e37ba;hpb=c6bd6e235ac6d6a35e9ad8f3db49db7ba27f7650;p=platform%2Fkernel%2Fu-boot.git diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py index d73c706..e9aed83 100644 --- a/tools/binman/etype/cbfs.py +++ b/tools/binman/etype/cbfs.py @@ -7,11 +7,10 @@ from collections import OrderedDict -import cbfs_util -from cbfs_util import CbfsWriter -from entry import Entry -import fdt_util -import state +from binman import cbfs_util +from binman.cbfs_util import CbfsWriter +from binman.entry import Entry +from dtoc import fdt_util class Entry_cbfs(Entry): """Entry containing a Coreboot Filesystem (CBFS) @@ -164,12 +163,17 @@ class Entry_cbfs(Entry): 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 + from binman import state + Entry.__init__(self, section, etype, node) self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86') self._cbfs_entries = OrderedDict() self._ReadSubnodes() + self.reader = None - def ObtainContents(self): + def ObtainContents(self, skip=None): arch = cbfs_util.find_arch(self._cbfs_arg) if arch is None: self.Raise("Invalid architecture '%s'" % self._cbfs_arg) @@ -179,7 +183,7 @@ class Entry_cbfs(Entry): for entry in self._cbfs_entries.values(): # First get the input data and put it in a file. If not available, # try later. - if not entry.ObtainContents(): + if entry != skip and not entry.ObtainContents(): return False data = entry.GetData() cfile = None @@ -202,7 +206,7 @@ class Entry_cbfs(Entry): def _ReadSubnodes(self): """Read the subnodes to find out what should go in this IFWI""" for node in self._node.subnodes: - entry = Entry.Create(self.section, node) + entry = Entry.Create(self, node) entry.ReadNode() entry._cbfs_name = fdt_util.GetString(node, 'cbfs-name', entry.name) entry._type = fdt_util.GetString(node, 'cbfs-type') @@ -262,3 +266,19 @@ class Entry_cbfs(Entry): def GetEntries(self): return self._cbfs_entries + + def ReadData(self, decomp=True): + data = Entry.ReadData(self, True) + return data + + def ReadChildData(self, child, decomp=True): + if not self.reader: + data = Entry.ReadData(self, True) + self.reader = cbfs_util.CbfsReader(data) + reader = self.reader + cfile = reader.files.get(child.name) + return cfile.data if decomp else cfile.orig_data + + def WriteChildData(self, child): + self.ObtainContents(skip=child) + return True