dtoc: Support adding subnodes alongside existing ones
authorSimon Glass <sjg@chromium.org>
Sun, 21 Mar 2021 05:24:38 +0000 (18:24 +1300)
committerSimon Glass <sjg@chromium.org>
Sat, 27 Mar 2021 03:26:48 +0000 (16:26 +1300)
commitf6176651bc1bad080d0512aeeed438e8763b951b
tree819268d4ffefbc31e14f0a771088b2cc003e3ffc
parent76677dd2b230ffb6d83e4acb85d2e7473ab74a4f
dtoc: Support adding subnodes alongside existing ones

So far we have only needed to add subnodes to empty notds, so have not
had to deal with ordering. However this feature is needed for binman's
expanded nodes, since there may be another node in the same section.

While libfdt adds new properties after existing properties, it adds new
subnodes before existing subnodes. This means that we must reorder the
nodes in the cached version, so that the ordering remains consistent.

Update the sync implementation to sync existing subnodes first, then
add new ones, then tidy up the ordering in the cached version. Update the
test to cover this behaviour.

Also improve the comment about property syncing while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/dtoc/fdt.py
tools/dtoc/test_fdt.py