[PATCH 03/20] dtoc: Order the structures internally by name

Simon Glass sjg at chromium.org
Tue Oct 27 02:01:17 CET 2020


At present the structures are written in name order, but parents have to
be written before their children, so the file does not end up being in
order. The order of nodes in _valid_nodes matches the order of the
devicetree.

Update the code so that _valid_nodes is in sorted order, by C name of
the structure. This allows us to assign a sequential ordering to each
U_BOOT_DEVICE() declaration.

U-Boot's linker lists are also ordered alphabetically, which means that
the order in the driver_info list will match the order used by dtoc. This
defines an index ('idx') for the U_BOOT_DEVICE declarations. They appear
in alphabetical order, numbered from 0 in _valid_nodes and in the
driver_info linker list.

Add a comment against each declaration, showing the idx value.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/dtoc/dtb_platdata.py |  21 +++++---
 tools/dtoc/test_dtoc.py    | 105 ++++++++++++++++++++++++-------------
 2 files changed, 83 insertions(+), 43 deletions(-)

Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list