binman: Rename fdt variable to dtb

Since fdt is the name of a module, use a different name for variables to
avoid a conflict.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2017-05-27 07:38:29 -06:00
parent 7b75b4482d
commit ec3f378a31
3 changed files with 11 additions and 12 deletions

View file

@ -40,15 +40,15 @@ def _ReadImageDesc(binman_node):
images['image'] = Image('image', binman_node) images['image'] = Image('image', binman_node)
return images return images
def _FindBinmanNode(fdt): def _FindBinmanNode(dtb):
"""Find the 'binman' node in the device tree """Find the 'binman' node in the device tree
Args: Args:
fdt: Fdt object to scan dtb: Fdt object to scan
Returns: Returns:
Node object of /binman node, or None if not found Node object of /binman node, or None if not found
""" """
for node in fdt.GetRoot().subnodes: for node in dtb.GetRoot().subnodes:
if node.name == 'binman': if node.name == 'binman':
return node return node
return None return None
@ -92,8 +92,8 @@ def Binman(options, args):
try: try:
tools.SetInputDirs(options.indir) tools.SetInputDirs(options.indir)
tools.PrepareOutputDir(options.outdir, options.preserve) tools.PrepareOutputDir(options.outdir, options.preserve)
fdt = fdt_select.FdtScan(dtb_fname) dtb = fdt.FdtScan(dtb_fname)
node = _FindBinmanNode(fdt) node = _FindBinmanNode(dtb)
if not node: if not node:
raise ValueError("Device tree '%s' does not have a 'binman' " raise ValueError("Device tree '%s' does not have a 'binman' "
"node" % dtb_fname) "node" % dtb_fname)

View file

@ -44,9 +44,8 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob):
fd.write(self.data) fd.write(self.data)
# Remove the microcode # Remove the microcode
fdt = fdt_select.FdtScan(fname) dtb = fdt.FdtScan(fname)
fdt.Scan() ucode = dtb.GetNode('/microcode')
ucode = fdt.GetNode('/microcode')
if not ucode: if not ucode:
raise self.Raise("No /microcode node found in '%s'" % fname) raise self.Raise("No /microcode node found in '%s'" % fname)
@ -64,8 +63,8 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob):
self.ucode_offset = data_prop.GetOffset() + 12 self.ucode_offset = data_prop.GetOffset() + 12
self.ucode_size = len(data_prop.bytes) self.ucode_size = len(data_prop.bytes)
if self.collate: if self.collate:
fdt.Pack() dtb.Pack()
fdt.Flush() dtb.Flush()
# Make this file the contents of this entry # Make this file the contents of this entry
self._pathname = fname self._pathname = fname

View file

@ -658,8 +658,8 @@ class TestFunctional(unittest.TestCase):
fname = tools.GetOutputFilename('test.dtb') fname = tools.GetOutputFilename('test.dtb')
with open(fname, 'wb') as fd: with open(fname, 'wb') as fd:
fd.write(second) fd.write(second)
fdt = fdt_select.FdtScan(fname) dtb = fdt.FdtScan(fname)
ucode = fdt.GetNode('/microcode') ucode = dtb.GetNode('/microcode')
self.assertTrue(ucode) self.assertTrue(ucode)
for node in ucode.subnodes: for node in ucode.subnodes:
self.assertFalse(node.props.get('data')) self.assertFalse(node.props.get('data'))