[PATCH v3 04/15] tests/nopulate: Add a FDT_NOP before the root node
From: Herve Codina
Date: Wed Aug 26 2026 - 04:37:08 EST
A FDT_NOP tag can be present at the offset 0 and so before the root
node. This is a legit case.
The nopulate tool adds FDT_NOP tag after each tag encountered but it
doesn't add a FDT_NOP tag at offset 0.
Improve nopulate to fix this lack and add a FDT_NOP tag at offset 0.
Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
---
tests/nopulate.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/nopulate.c b/tests/nopulate.c
index 06f8369a..050e69fb 100644
--- a/tests/nopulate.c
+++ b/tests/nopulate.c
@@ -22,7 +22,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.55.0