mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
dtoc: Allow syncing of the device tree back to a file
At present we require the caller to manually update the device tree using individual calls to libfdt functions. This is not ideal. It would be better if we could make changes using the Python structure and then call a Sync() function to write them back. Add this feature to the Fdt class. Update binman and the tests to match. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
0bfa7b09ba
commit
fa80c25c09
3 changed files with 91 additions and 10 deletions
|
@ -337,6 +337,7 @@ class TestProp(unittest.TestCase):
|
|||
self.node.AddZeroProp('one')
|
||||
self.node.AddZeroProp('two')
|
||||
self.node.AddZeroProp('three')
|
||||
self.dtb.Sync(auto_resize=True)
|
||||
|
||||
# Updating existing properties should be OK, since the device-tree size
|
||||
# does not change
|
||||
|
@ -344,12 +345,17 @@ class TestProp(unittest.TestCase):
|
|||
self.node.SetInt('one', 1)
|
||||
self.node.SetInt('two', 2)
|
||||
self.node.SetInt('three', 3)
|
||||
self.dtb.Sync(auto_resize=False)
|
||||
|
||||
# This should fail since it would need to increase the device-tree size
|
||||
self.node.AddZeroProp('four')
|
||||
with self.assertRaises(libfdt.FdtException) as e:
|
||||
self.node.SetInt('four', 4)
|
||||
self.dtb.Sync(auto_resize=False)
|
||||
self.assertIn('FDT_ERR_NOSPACE', str(e.exception))
|
||||
|
||||
def testAddNode(self):
|
||||
self.fdt.pack()
|
||||
|
||||
|
||||
class TestFdtUtil(unittest.TestCase):
|
||||
"""Tests for the fdt_util module
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue