devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Record of original components for fdtoverlay
@ 2024-01-09  6:20 Masahiro Yamada
  2024-01-09 10:51 ` David Gibson
  2024-01-09 20:23 ` Rob Herring
  0 siblings, 2 replies; 4+ messages in thread
From: Masahiro Yamada @ 2024-01-09  6:20 UTC (permalink / raw)
  To: Devicetree Compiler

Hi.

Sorry for a stupid question.


When you get a DTB by using fdtoverlay, there is no way to
know how it was produced later. Correct?

For instance, this case:

 $ fdtoverlay --input base.dtb ovl.dtbo --output foo.dtb

Once you get foo.dtb, you will never know whether it was
assembled from base.dtb + ovl.dtbo, or it was directly
generated from a single source, foo.dts.

In my understanding, there is no room in DTB to record
such metadata, and it is impossible to disassemble foo.dtb
into the original components, base.dtb and ovl.dtbo.

Please let me confirm that I did not miss anything.


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Record of original components for fdtoverlay
  2024-01-09  6:20 Record of original components for fdtoverlay Masahiro Yamada
@ 2024-01-09 10:51 ` David Gibson
  2024-01-17  1:51   ` Masahiro Yamada
  2024-01-09 20:23 ` Rob Herring
  1 sibling, 1 reply; 4+ messages in thread
From: David Gibson @ 2024-01-09 10:51 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Devicetree Compiler

[-- Attachment #1: Type: text/plain, Size: 1600 bytes --]

On Tue, Jan 09, 2024 at 03:20:12PM +0900, Masahiro Yamada wrote:
> Hi.
> 
> Sorry for a stupid question.
> 
> 
> When you get a DTB by using fdtoverlay, there is no way to
> know how it was produced later. Correct?

More or less, yes.  Depending on the exact situation there might be
some clues that an overlay has been applied, but there's certainly no
easy or reliable way to tell.

> For instance, this case:
> 
>  $ fdtoverlay --input base.dtb ovl.dtbo --output foo.dtb
> 
> Once you get foo.dtb, you will never know whether it was
> assembled from base.dtb + ovl.dtbo, or it was directly
> generated from a single source, foo.dts.

Correct.

> In my understanding, there is no room in DTB to record
> such metadata, and it is impossible to disassemble foo.dtb
> into the original components, base.dtb and ovl.dtbo.

Yes and no.  It would certainly be possible to add special property
into the dtb to record a listing of the overlays applied.  However,
that would only be accurate if the tools used to apply updated it
correctly, and of course the current ones don't.

Even with that, it wouldn't be possible to "unapply" overlays -
overlays can overwrite data in the base tree so it's no longer
available.  There's not really any natural way of making that possible
within the dtb + overlay model.

> Please let me confirm that I did not miss anything.
> 
> 

-- 
David Gibson			| 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Record of original components for fdtoverlay
  2024-01-09  6:20 Record of original components for fdtoverlay Masahiro Yamada
  2024-01-09 10:51 ` David Gibson
@ 2024-01-09 20:23 ` Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Rob Herring @ 2024-01-09 20:23 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Devicetree Compiler

On Tue, Jan 9, 2024 at 12:20 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Hi.
>
> Sorry for a stupid question.
>
>
> When you get a DTB by using fdtoverlay, there is no way to
> know how it was produced later. Correct?
>
> For instance, this case:
>
>  $ fdtoverlay --input base.dtb ovl.dtbo --output foo.dtb
>
> Once you get foo.dtb, you will never know whether it was
> assembled from base.dtb + ovl.dtbo, or it was directly
> generated from a single source, foo.dts.

That is correct.

If the results are the same, why do you care?

> In my understanding, there is no room in DTB to record
> such metadata, and it is impossible to disassemble foo.dtb
> into the original components, base.dtb and ovl.dtbo.
>
> Please let me confirm that I did not miss anything.

The kernel has the ability to un-apply overlays. I think that only
depends on having the original overlay and not any state from having
applied the overlay. fdtoverlay could be extended to do something
similar if you wanted to get base.dtb from foo.dtb and ovl.dtbo. If
you can't un-apply the overlay, then it would be a hint that it wasn't
created by applying the overlay.

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Record of original components for fdtoverlay
  2024-01-09 10:51 ` David Gibson
@ 2024-01-17  1:51   ` Masahiro Yamada
  0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2024-01-17  1:51 UTC (permalink / raw)
  To: David Gibson; +Cc: Devicetree Compiler

On Thu, Jan 11, 2024 at 2:48 PM David Gibson
<david@gibson.dropbear.id.au> wrote:
>
> On Tue, Jan 09, 2024 at 03:20:12PM +0900, Masahiro Yamada wrote:
> > Hi.
> >
> > Sorry for a stupid question.
> >
> >
> > When you get a DTB by using fdtoverlay, there is no way to
> > know how it was produced later. Correct?
>
> More or less, yes.  Depending on the exact situation there might be
> some clues that an overlay has been applied, but there's certainly no
> easy or reliable way to tell.
>
> > For instance, this case:
> >
> >  $ fdtoverlay --input base.dtb ovl.dtbo --output foo.dtb
> >
> > Once you get foo.dtb, you will never know whether it was
> > assembled from base.dtb + ovl.dtbo, or it was directly
> > generated from a single source, foo.dts.
>
> Correct.
>
> > In my understanding, there is no room in DTB to record
> > such metadata, and it is impossible to disassemble foo.dtb
> > into the original components, base.dtb and ovl.dtbo.
>
> Yes and no.  It would certainly be possible to add special property
> into the dtb to record a listing of the overlays applied.  However,
> that would only be accurate if the tools used to apply updated it
> correctly, and of course the current ones don't.
>
> Even with that, it wouldn't be possible to "unapply" overlays -
> overlays can overwrite data in the base tree so it's no longer
> available.  There's not really any natural way of making that possible
> within the dtb + overlay model.


Thanks.
The answers are what I expected.


We can assemble a DTB from a base and overlays,
but cannot do the opposite.

So, I was thinking that it would be sensible to
support installation of base and overlay files
instead of assembled ones.

https://lore.kernel.org/linux-kbuild/20240109120738.346061-1-masahiroy@kernel.org/T/#ma9017aeb05462996177434cd4a1daa1c2fbe09cd


There was no comment so far, though.












> > Please let me confirm that I did not miss anything.
> >
> >
>
> --
> David Gibson                    | 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



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-17  1:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09  6:20 Record of original components for fdtoverlay Masahiro Yamada
2024-01-09 10:51 ` David Gibson
2024-01-17  1:51   ` Masahiro Yamada
2024-01-09 20:23 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).