aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass2021-12-08 09:55:35 -0700
committerSimon Glass2021-12-17 09:44:59 -0700
commit121cfe5a84d463893bd01da16417ab138f98666a (patch)
tree0d7723140a0fb6e4bd81656a89296d85e6a36d24 /include
parent70ab7b1799112398047be63cc113f93955f0f352 (diff)
fdtgrep: Handle an empty output tree
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@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/fdt_region.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/fdt_region.h b/include/fdt_region.h
index ff7a1ccb9af..d0c68760f78 100644
--- a/include/fdt_region.h
+++ b/include/fdt_region.h
@@ -77,6 +77,7 @@ struct fdt_region_state {
int max_regions; /* Maximum regions to find */
int can_merge; /* 1 if we can merge with previous region */
int start; /* Start position of current region */
+ bool have_node; /* True if any node is included */
struct fdt_region_ptrs ptrs; /* Pointers for what we are up to */
};