aboutsummaryrefslogtreecommitdiff
path: root/pylibfdt
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-07-02 18:08:15 -0600
committerDavid Gibson <david@gibson.dropbear.id.au>2019-07-03 10:23:21 +1000
commit1c17714dbb3aa43e5b7927dfc073e5e88ae20655 (patch)
tree12ef530fe8e3a3309d7b83d247ee2d7043e184b6 /pylibfdt
parentad57e4574a379e8f383058f730e4e8e1939b4fc7 (diff)
downloaddtc-1c17714dbb3aa43e5b7927dfc073e5e88ae20655.zip
dtc-1c17714dbb3aa43e5b7927dfc073e5e88ae20655.tar.gz
dtc-1c17714dbb3aa43e5b7927dfc073e5e88ae20655.tar.bz2
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>
Diffstat (limited to 'pylibfdt')
-rw-r--r--pylibfdt/libfdt.i6
1 files changed, 4 insertions, 2 deletions
diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
index 643f95d..ecec4dd 100644
--- a/pylibfdt/libfdt.i
+++ b/pylibfdt/libfdt.i
@@ -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