pylibfdt: Correct the FdtSw example

At present this example is incorrect since it is missing the call to
finish_reservemap() and does not add a root node. Fix these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
Message-Id: <20190703000815.102459-1-sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Simon Glass 2019-07-02 18:08:15 -06:00 committed by David Gibson
parent ad57e4574a
commit 1c17714dbb
1 changed files with 4 additions and 2 deletions

View File

@ -727,8 +727,10 @@ class FdtSw(FdtRo):

# First create the device tree with a node and property:
sw = FdtSw()
with sw.add_node('node'):
sw.property_u32('reg', 2)
sw.finish_reservemap()
with sw.add_node(''):
with sw.add_node('node'):
sw.property_u32('reg', 2)
fdt = sw.as_fdt()

# Now we can use it as a real device tree