Re: [RFC 0/2] kbuild: Add support to build overlays (%.dtbo)

From: Frank Rowand
Date: Mon Jan 11 2021 - 19:33:38 EST


On 1/5/21 9:21 AM, Rob Herring wrote:
> On Tue, Jan 5, 2021 at 4:24 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>>
>> Hello,
>>
>> Here is an attempt to make some changes in the kernel to allow building
>> of device tree overlays.
>>
>> While at it, I would also like to discuss about how we should mention
>> the base DT blobs in the Makefiles for the overlays, so they can be
>> build tested to make sure the overlays apply properly.
>>
>> A simple way is to mention that with -base extension, like this:
>>
>> $(overlay-file)-base := platform-base.dtb
>>
>> Any other preference ?
>
> I think we'll want something similar to how '-objs' works for modules:
>
> foo-board-1-dtbs := foo-board.dtb foo-overlay1.dtbo
> foo-board-2-dtbs := foo-board.dtb foo-overlay2.dtbo
> foo-board-1-2-dtbs := foo-board.dtb foo-overlay1.dtbo foo-overlay2.dtbo
> dtbs-y += foo-board-1.dtb foo-board-2.dtb foo-board-1-2.dtb

(Thinking ahead....) I'm not sure how to fit connector nodes and the
corresponding plugin overlays into this model. A single plugin .dtbo
will need to be relocated onto one or more connector nodes. fdtoverlay
and the run time overlay apply code do not know how to do this yet.

-Frank

>
> (One difference here is we will want all the intermediate targets
> unlike .o files.)
>
> You wouldn't necessarily have all the above combinations, but you have
> to allow for them. I'm not sure how we'd handle applying any common
> overlays where the base and overlay are in different directories.
>
> Another thing here is adding all the above is not really going to
> scale on arm32 where we have a single dts directory. We need to move
> things to per vendor/soc family directories. I have the script to do
> this. We just need to agree on the vendor names and get Arnd/Olof to
> run it. I also want that so we can enable schema checks by default
> once a vendor is warning free (the whole tree is going to take
> forever).
>
>> Also fdtoverlay is an external entity right now, and is not part of the
>> kernel. Do we need to make it part of the kernel ? Or keep using the
>> external entity ?
>
> Part of the kernel. We just need to add it to the dtc sync script and
> makefile I think.
>
> Rob
>