[PATCH 2/2] fdtgrep: Handle an empty output tree

Simon Glass sjg at chromium.org
Fri Dec 17 17:46:15 CET 2021

In strange cases it is possible for fdtgrep to find nothing to output.
Typically this means that the resulting SPL device tree is not going to
allow anything to boot, but at present the tree is actually invalid,
since it only has an END tag in the struct region.

The FDT spec requires at least a root node. So add a special case to
include at least this, if the FDT_REG_SUPERNODES flag is set.

This ensures that grepping an empty tree still produces a valid tree.

Also add comments to the enum since it is not completely obvious from
the names now.

The typical symptom of this problem is a message from binman:

   pylibfdt error -11: FDT_ERR_BADSTRUCTURE

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

 boot/fdt_region.c    | 43 +++++++++++++++++++++++++++++++++++++------
 include/fdt_region.h |  1 +
 2 files changed, 38 insertions(+), 6 deletions(-)

Applied to u-boot-dm/next, thanks!

More information about the U-Boot mailing list