Re: [PATCH v3 04/15] tests/nopulate: Add a FDT_NOP before the root node

From: David Gibson

Date: Tue Sep 01 2026 - 04:08:38 EST


On Wed, Aug 26, 2026 at 10:31:35AM +0200, Herve Codina wrote:
> 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>

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 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
>
>

--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature