dtoc: Allow adding variable-sized data to a dtb

Add a method for adding a property containing arbitrary bytes. Make sure
that the tree can expand as needed in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-07-09 18:39:44 -06:00
parent 152b246298
commit c063917906
2 changed files with 19 additions and 2 deletions

View File

@@ -417,6 +417,10 @@ class TestProp(unittest.TestCase):
self.node.SetData('empty', b'123')
self.assertEqual(b'123', prop.bytes)
# Trying adding a lot of data at once
self.node.AddData('data', tools.GetBytes(65, 20000))
self.dtb.Sync(auto_resize=True)
def testFromData(self):
dtb2 = fdt.Fdt.FromData(self.dtb.GetContents())
self.assertEqual(dtb2.GetContents(), self.dtb.GetContents())