Re: [PATCH 1/3] of: always populate a root node

From: Clément Léger
Date: Tue May 17 2022 - 03:40:39 EST


Le Mon, 16 May 2022 23:11:03 -0400,
Frank Rowand <frowand.list@xxxxxxxxx> a écrit :

> On 5/3/22 08:45, Rob Herring wrote:
> > On Wed, Apr 27, 2022 at 11:45:00AM +0200, Clément Léger wrote:
> >> When enabling CONFIG_OF on a platform where of_root is not populated by
> >> firmware, we end up without a root node. In order to apply overlays and
> >> create subnodes of the root node, we need one. This commit creates an
> >> empty root node if not present.
> >
> > The existing unittest essentially does the same thing for running the
> > tests on non-DT systems. It should be modified to use this support
> > instead. Maybe that's just removing the unittest code that set of_root.
> >
> > I expect Frank will have some comments.
>
> My preference would be for unflatten_and_copy_device_tree() to
> use a compiled in FDT that only contains a root node, in the
> case that no valid device tree is found (in other words,
> "if (!initial_boot_params)".

Ok, so basically, instead of creating the root node manually, you
expect a device-tree which contains the following to be builtin the
kernel and unflattened if needed:

/ {

};

Maybe "chosen" and "aliases" nodes should also be provided as empty
nodes since the unittest are creating them anyway and the core DT code
also uses them.

Thanks,

Clément

>
> unflatten_and_copy_device_tree() calls unittest_unflatten_overlay_base()
> after unflattening the device tree passed into the booting kernel. This
> step is needed for a specific portion of the unittests.
>
> I'm still looking at the bigger picture of using overlays for the PCIe
> card, so more comments will be coming about that bigger picture.
>
> -Frank
>


--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com