"""
fname = self.GetDefaultFilename()
return {self.GetFdtEtype(): [self, fname]}
+
+ def WriteData(self, data, decomp=True):
+ ok = Entry_blob.WriteData(self, data, decomp)
+
+ # Update the state module, since it has the authoritative record of the
+ # device trees used. If we don't do this, then state.GetFdtContents()
+ # will still return the old contents
+ state.UpdateFdtContents(self.GetFdtEtype(), data)
+ return ok
data = tools.ReadFile(pathname)
return pathname, data
+def UpdateFdtContents(etype, data):
+ """Update the contents of a particular device tree
+
+ The device tree is updated and written back to its file. This affects what
+ is returned from future called to GetFdtContents(), etc.
+
+ Args:
+ etype: Entry type (e.g. 'u-boot-dtb')
+ data: Data to replace the DTB with
+ """
+ dtb, fname, entry = output_fdt_info[etype]
+ dtb_fname = dtb.GetFilename()
+ tools.WriteFile(dtb_fname, data)
+ dtb = fdt.FdtScan(dtb_fname)
+ output_fdt_info[etype] = [dtb, fname, entry]
+
def SetEntryArgs(args):
"""Set the value of the entry args
node = Node(fdt, parent, offset, name, path)
return node
+ def GetFilename(self):
+ """Get the filename of the device tree
+
+ Returns:
+ String filename
+ """
+ return self._fname
+
def FdtScan(fname):
"""Returns a new Fdt object"""
dtb = Fdt(fname)
self.assertIn("node '/spl-test': Missing property 'one'",
str(e.exception))
+ def testGetFilename(self):
+ """Test the dtb filename can be provided"""
+ self.assertEqual(tools.GetOutputFilename('source.dtb'),
+ self.dtb.GetFilename())
+
class TestFdtUtil(unittest.TestCase):
"""Tests for the fdt_util module