Re: [RFC 2/2] scripts: dtc: Handle outform dtbo

From: Rob Herring
Date: Tue Jan 05 2021 - 10:38:27 EST


On Tue, Jan 5, 2021 at 4:24 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> Update dtc compiler to accept dtbo as an outform.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
>
> ---
> I feel that this needs to go directly to
> https://git.kernel.org/pub/scm/utils/dtc/dtc.git
>
> Right ? I will send it separately if the idea is accepted here.

Yes, needs to go to devicetree-compiler list. I think this came up
before and IIRC David wasn't completely in agreement. I looked briefly
and couldn't find the thread though...

We really don't need a different extension because we could just
examine the dtb to determine if it is an overlay or not. That's less
obvious. We could also add meta-data to overlays defining what base
they apply to. If we had that, a tool could just list all overlays
that should apply to a base and we could use that info for build time
applying overlays. Of course, that and a dtbo extension/format are not
mutually exclusive.

> ---
> scripts/dtc/dtc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c
> index bdb3f5945699..40fa7128b3d6 100644
> --- a/scripts/dtc/dtc.c
> +++ b/scripts/dtc/dtc.c
> @@ -357,6 +357,8 @@ int main(int argc, char *argv[])
> #endif
> } else if (streq(outform, "dtb")) {
> dt_to_blob(outf, dti, outversion);
> + } else if (streq(outform, "dtbo")) {
> + dt_to_blob(outf, dti, outversion);
> } else if (streq(outform, "asm")) {
> dt_to_asm(outf, dti, outversion);
> } else if (streq(outform, "null")) {

You also need to extend guess_type_by_name().


Rob