[PATCH v4 04/22] tests/nopulate: Add an FDT_NOP before the root node
From: Herve Codina
Date: Thu Nov 26 2026 - 06:28:19 EST
An FDT_NOP tag can be present at offset 0 and so before the root node.
This is a legitimate case.
The nopulate tool adds an FDT_NOP tag after each tag encountered but it
doesn't add an FDT_NOP tag at offset 0.
Improve nopulate to fix this gap and add an FDT_NOP tag at offset 0.
Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
Reviewed-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>
---
tests/nopulate.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/nopulate.c b/tests/nopulate.c
index 32624a7b..b3a7184a 100644
--- a/tests/nopulate.c
+++ b/tests/nopulate.c
@@ -23,7 +23,10 @@ static int nopulate_struct(char *buf, const char *fdt)
uint32_t tag;
char *p;
+ /* Add a FDT_NOP before the root node (first node) */
p = buf;
+ *((fdt32_t *)p) = cpu_to_fdt32(FDT_NOP);
+ p += FDT_TAGSIZE;
do {
offset = nextoffset;
--
2.56.1