diff mbox

[RFC] drm: rcar-du: keep temporary dtb files around during build

Message ID 20180315153730.3798004-1-arnd@arndb.de (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Arnd Bergmann March 15, 2018, 3:37 p.m. UTC
The *.dtb and *.dtb.S files get removed by 'make' during the build process,
and later seem to be missed during the 'modpost' stage:

rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
WARNING: could not open drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or directory

As a workaround, this adds all those files to the 'extra-y' target list,
but that's really ugly. Any ideas for a better fix?

Fixes: 81c0e3dd8292 ("drm: rcar-du: Fix legacy DT to create LVDS encoder nodes")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/rcar-du/Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Frank.Rowand@sony.com March 16, 2018, 1:39 a.m. UTC | #1
On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann [mailto:arnd@arndb.de]  wrote:
>
> The *.dtb and *.dtb.S files get removed by 'make' during the build
> process,
> and later seem to be missed during the 'modpost' stage:
>
> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
> WARNING: could not open
> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
> directory
>
> As a workaround, this adds all those files to the 'extra-y' target list,
> but that's really ugly. Any ideas for a better fix?

Does this work for you (untested, but the way it is done in
drivers/of/unittest-data/Makefile):

.PRECIOUS: \
        $(obj)/%.dtb.S \
        $(obj)/%.dtb


-Frank


>
> Fixes: 81c0e3dd8292 ("drm: rcar-du: Fix legacy DT to create LVDS encoder
> nodes")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/rcar-du/Makefile | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/rcar-du/Makefile
> b/drivers/gpu/drm/rcar-du/Makefile
> index 3e58ed93d5b1..e5fc6ec0b8cc 100644
> --- a/drivers/gpu/drm/rcar-du/Makefile
> +++ b/drivers/gpu/drm/rcar-du/Makefile
> @@ -12,6 +12,21 @@ rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)  += rcar_du_of.o \
>                                            rcar_du_of_lvds_r8a7793.dtb.o
> \
>                                            rcar_du_of_lvds_r8a7795.dtb.o
> \
>                                            rcar_du_of_lvds_r8a7796.dtb.o
> +
> +extra-y                                        +=
> rcar_du_of_lvds_r8a7790.dtb \
> +                                          rcar_du_of_lvds_r8a7790.dtb \
> +                                          rcar_du_of_lvds_r8a7791.dtb \
> +                                          rcar_du_of_lvds_r8a7793.dtb \
> +                                          rcar_du_of_lvds_r8a7795.dtb \
> +                                          rcar_du_of_lvds_r8a7796.dtb
> +
> +extra-y                                        +=
> rcar_du_of_lvds_r8a7790.dtb.S \
> +                                          rcar_du_of_lvds_r8a7790.dtb.S
> \
> +                                          rcar_du_of_lvds_r8a7791.dtb.S
> \
> +                                          rcar_du_of_lvds_r8a7793.dtb.S
> \
> +                                          rcar_du_of_lvds_r8a7795.dtb.S
> \
> +                                          rcar_du_of_lvds_r8a7796.dtb.S
> +
>  rcar-du-drm-$(CONFIG_DRM_RCAR_VSP)     += rcar_du_vsp.o
>
>  obj-$(CONFIG_DRM_RCAR_DU)              += rcar-du-drm.o
> --
> 2.9.0
Arnd Bergmann March 16, 2018, 8:25 a.m. UTC | #2
On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
> On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann [mailto:arnd@arndb.de]  wrote:
>>
>> The *.dtb and *.dtb.S files get removed by 'make' during the build
>> process,
>> and later seem to be missed during the 'modpost' stage:
>>
>> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
>> WARNING: could not open
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
>> directory
>>
>> As a workaround, this adds all those files to the 'extra-y' target list,
>> but that's really ugly. Any ideas for a better fix?
>
> Does this work for you (untested, but the way it is done in
> drivers/of/unittest-data/Makefile):
>
> .PRECIOUS: \
>         $(obj)/%.dtb.S \
>         $(obj)/%.dtb

Yes, that works and looks much better than my version.

      Arnd
Laurent Pinchart March 20, 2018, 1:15 p.m. UTC | #3
Hi Arnd,

On Friday, 16 March 2018 10:25:25 EET Arnd Bergmann wrote:
> On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
> > On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann wrote:
> >> The *.dtb and *.dtb.S files get removed by 'make' during the build
> >> process,
> >> and later seem to be missed during the 'modpost' stage:
> >> 
> >> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
> >> WARNING: could not open
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
> >> directory
> >> 
> >> As a workaround, this adds all those files to the 'extra-y' target list,
> >> but that's really ugly. Any ideas for a better fix?
> > 
> > Does this work for you (untested, but the way it is done in
> > drivers/of/unittest-data/Makefile):
> > 
> > .PRECIOUS: \
> > 
> >         $(obj)/%.dtb.S \
> >         $(obj)/%.dtb
> 
> Yes, that works and looks much better than my version.

Thank you for your patch, and sorry for breaking the build. Do you plan to 
submit a new version based on Frank's approach ?
Arnd Bergmann March 21, 2018, 7:38 a.m. UTC | #4
On Tue, Mar 20, 2018 at 9:15 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Arnd,
>
> On Friday, 16 March 2018 10:25:25 EET Arnd Bergmann wrote:
>> On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
>> > On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann wrote:
>> >> The *.dtb and *.dtb.S files get removed by 'make' during the build
>> >> process,
>> >> and later seem to be missed during the 'modpost' stage:
>> >>
>> >> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
>> >> WARNING: could not open
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
>> >> directory
>> >>
>> >> As a workaround, this adds all those files to the 'extra-y' target list,
>> >> but that's really ugly. Any ideas for a better fix?
>> >
>> > Does this work for you (untested, but the way it is done in
>> > drivers/of/unittest-data/Makefile):
>> >
>> > .PRECIOUS: \
>> >
>> >         $(obj)/%.dtb.S \
>> >         $(obj)/%.dtb
>>
>> Yes, that works and looks much better than my version.
>
> Thank you for your patch, and sorry for breaking the build. Do you plan to
> submit a new version based on Frank's approach ?

I'm currently at Linaro Connect and won't be able to send a tested patch
before mid next week. If you want it earlier, feel free to apply that patch
with my original description and 'Reported-by: Arnd Bergmann <arnd@arndb.de>'.

        Arnd
Laurent Pinchart March 21, 2018, 9:58 a.m. UTC | #5
Hi Arnd,

On Wednesday, 21 March 2018 09:38:35 EET Arnd Bergmann wrote:
> On Tue, Mar 20, 2018 at 9:15 PM, Laurent Pinchart wrote:
> > On Friday, 16 March 2018 10:25:25 EET Arnd Bergmann wrote:
> >> On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
> >>> On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann wrote:
> >>>> The *.dtb and *.dtb.S files get removed by 'make' during the build
> >>>> process, and later seem to be missed during the 'modpost' stage:
> >>>> 
> >>>> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
> >>>> WARNING: could not open
> >>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
> >>>> directory
> >>>> 
> >>>> As a workaround, this adds all those files to the 'extra-y' target
> >>>> list, but that's really ugly. Any ideas for a better fix?
> >>> 
> >>> Does this work for you (untested, but the way it is done in
> >>> drivers/of/unittest-data/Makefile):
> >>> 
> >>> .PRECIOUS: \
> >>>         $(obj)/%.dtb.S \
> >>>         $(obj)/%.dtb
> >> 
> >> Yes, that works and looks much better than my version.
> > 
> > Thank you for your patch, and sorry for breaking the build. Do you plan to
> > submit a new version based on Frank's approach ?
> 
> I'm currently at Linaro Connect and won't be able to send a tested patch
> before mid next week. If you want it earlier, feel free to apply that patch
> with my original description and 'Reported-by: Arnd Bergmann
> <arnd@arndb.de>'.

I was about to do so, but realized I can't reproduce the problem here. If you 
don't mind I'll let you submit a v2. Alternatively I can work on it if you 
give me instruction to reproduce the issue.
Geert Uytterhoeven March 22, 2018, 2:26 p.m. UTC | #6
Hi Frank,

On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
> On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann [mailto:arnd@arndb.de]  wrote:
>>
>> The *.dtb and *.dtb.S files get removed by 'make' during the build
>> process,
>> and later seem to be missed during the 'modpost' stage:
>>
>> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
>> WARNING: could not open
>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
>> directory
>>
>> As a workaround, this adds all those files to the 'extra-y' target list,
>> but that's really ugly. Any ideas for a better fix?
>
> Does this work for you (untested, but the way it is done in
> drivers/of/unittest-data/Makefile):
>
> .PRECIOUS: \
>         $(obj)/%.dtb.S \
>         $(obj)/%.dtb

Shouldn't that just be moved to scripts/Makefile.lib, just above the rule
to make dtb.S, like is done for other precious objects?

Gr{oetje,eeting}s,

                        Geert
Laurent Pinchart March 22, 2018, 2:50 p.m. UTC | #7
Hi Geert,

On Thursday, 22 March 2018 16:26:22 EET Geert Uytterhoeven wrote:
> On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
> > On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann wrote:
> >> The *.dtb and *.dtb.S files get removed by 'make' during the build
> >> process, and later seem to be missed during the 'modpost' stage:
> >> 
> >> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
> >> WARNING: could not open
> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
> >> directory
> >> 
> >> As a workaround, this adds all those files to the 'extra-y' target list,
> >> but that's really ugly. Any ideas for a better fix?
> > 
> > Does this work for you (untested, but the way it is done in
> > drivers/of/unittest-data/Makefile):
> > 
> > .PRECIOUS: \
> > 
> >         $(obj)/%.dtb.S \
> >         $(obj)/%.dtb
> 
> Shouldn't that just be moved to scripts/Makefile.lib, just above the rule
> to make dtb.S, like is done for other precious objects?

Without any implied acknowledgment that keeping those intermediate files is 
the right solution (I don't claim to master the kernel build system), I think 
such a rule would indeed be better in a core Makefile, as the rules to build 
the .dtb.o file comes from the core too. Could another option be to create a 
rule to compile a .dtb.o from the .dts file directly without going through 
intermediate files that will be removed automatically ?
Geert Uytterhoeven March 22, 2018, 3:13 p.m. UTC | #8
Hi Laurent,

CC Yamada-san

On Thu, Mar 22, 2018 at 3:50 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Thursday, 22 March 2018 16:26:22 EET Geert Uytterhoeven wrote:
>> On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
>> > On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann wrote:
>> >> The *.dtb and *.dtb.S files get removed by 'make' during the build
>> >> process, and later seem to be missed during the 'modpost' stage:
>> >>
>> >> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
>> >> WARNING: could not open
>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
>> >> directory
>> >>
>> >> As a workaround, this adds all those files to the 'extra-y' target list,
>> >> but that's really ugly. Any ideas for a better fix?
>> >
>> > Does this work for you (untested, but the way it is done in
>> > drivers/of/unittest-data/Makefile):
>> >
>> > .PRECIOUS: \
>> >
>> >         $(obj)/%.dtb.S \
>> >         $(obj)/%.dtb
>>
>> Shouldn't that just be moved to scripts/Makefile.lib, just above the rule
>> to make dtb.S, like is done for other precious objects?
>
> Without any implied acknowledgment that keeping those intermediate files is
> the right solution (I don't claim to master the kernel build system), I think

Me neither, but I think it is.

Cfr. .y => .tab.c => .tab.o with .tab.c marked PRECIOUS.

> such a rule would indeed be better in a core Makefile, as the rules to build
> the .dtb.o file comes from the core too. Could another option be to create a
> rule to compile a .dtb.o from the .dts file directly without going through
> intermediate files that will be removed automatically ?

Such a rules needs to execute two commands, which is more tricky, considering
error handling.
It's easier (to get right) to have two separate rules, and let make chain them
automatically.

Gr{oetje,eeting}s,

                        Geert
Masahiro Yamada March 22, 2018, 5:47 p.m. UTC | #9
2018-03-23 0:13 GMT+09:00 Geert Uytterhoeven <geert@linux-m68k.org>:
> Hi Laurent,
>
> CC Yamada-san
>
> On Thu, Mar 22, 2018 at 3:50 PM, Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> wrote:
>> On Thursday, 22 March 2018 16:26:22 EET Geert Uytterhoeven wrote:
>>> On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
>>> > On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann wrote:
>>> >> The *.dtb and *.dtb.S files get removed by 'make' during the build
>>> >> process, and later seem to be missed during the 'modpost' stage:
>>> >>
>>> >> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
>>> >> WARNING: could not open
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
>>> >> directory
>>> >>
>>> >> As a workaround, this adds all those files to the 'extra-y' target list,
>>> >> but that's really ugly. Any ideas for a better fix?
>>> >
>>> > Does this work for you (untested, but the way it is done in
>>> > drivers/of/unittest-data/Makefile):
>>> >
>>> > .PRECIOUS: \
>>> >
>>> >         $(obj)/%.dtb.S \
>>> >         $(obj)/%.dtb
>>>
>>> Shouldn't that just be moved to scripts/Makefile.lib, just above the rule
>>> to make dtb.S, like is done for other precious objects?
>>
>> Without any implied acknowledgment that keeping those intermediate files is
>> the right solution (I don't claim to master the kernel build system), I think
>
> Me neither, but I think it is.
>
> Cfr. .y => .tab.c => .tab.o with .tab.c marked PRECIOUS.
>
>> such a rule would indeed be better in a core Makefile, as the rules to build
>> the .dtb.o file comes from the core too. Could another option be to create a
>> rule to compile a .dtb.o from the .dts file directly without going through
>> intermediate files that will be removed automatically ?
>
> Such a rules needs to execute two commands, which is more tricky, considering
> error handling.
> It's easier (to get right) to have two separate rules, and let make chain them
> automatically.
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds



This has been in my TODO list for a while,
but I have not had time to finish it.


Some people use .PRECIOUS to suppress file removal,
but it is wrong IMO.

.SECONDARY is the right one, but one problem is,
this does not work with pattern rules.

I will send a patch soon for the core improvement.
Masahiro Yamada March 23, 2018, 1:27 p.m. UTC | #10
2018-03-23 0:13 GMT+09:00 Geert Uytterhoeven <geert@linux-m68k.org>:
> Hi Laurent,
>
> CC Yamada-san
>
> On Thu, Mar 22, 2018 at 3:50 PM, Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> wrote:
>> On Thursday, 22 March 2018 16:26:22 EET Geert Uytterhoeven wrote:
>>> On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
>>> > On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann wrote:
>>> >> The *.dtb and *.dtb.S files get removed by 'make' during the build
>>> >> process, and later seem to be missed during the 'modpost' stage:
>>> >>
>>> >> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
>>> >> WARNING: could not open
>>> >> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
>>> >> directory
>>> >>
>>> >> As a workaround, this adds all those files to the 'extra-y' target list,
>>> >> but that's really ugly. Any ideas for a better fix?
>>> >
>>> > Does this work for you (untested, but the way it is done in
>>> > drivers/of/unittest-data/Makefile):
>>> >
>>> > .PRECIOUS: \
>>> >
>>> >         $(obj)/%.dtb.S \
>>> >         $(obj)/%.dtb
>>>
>>> Shouldn't that just be moved to scripts/Makefile.lib, just above the rule
>>> to make dtb.S, like is done for other precious objects?
>>
>> Without any implied acknowledgment that keeping those intermediate files is
>> the right solution (I don't claim to master the kernel build system), I think
>
> Me neither, but I think it is.
>
> Cfr. .y => .tab.c => .tab.o with .tab.c marked PRECIOUS.
>
>> such a rule would indeed be better in a core Makefile, as the rules to build
>> the .dtb.o file comes from the core too. Could another option be to create a
>> rule to compile a .dtb.o from the .dts file directly without going through
>> intermediate files that will be removed automatically ?
>
> Such a rules needs to execute two commands, which is more tricky, considering
> error handling.
> It's easier (to get right) to have two separate rules, and let make chain them
> automatically.
>
> Gr{oetje,eeting}s,
>
>                         Geert
>


I submit the patches.
I'd like to queue them up for the next merge window,
so your problems will be fixed if Kbuild pull requests are pulled.

The driver Makefile has two problems.

[1] Objects are always rebuilt due to missing 'targets'
[2] Intermediate files are removed due to missing .SECONDARY (or .PRECIOUS)

If you want to fix them by yourself, you can.

But, those issues will be taken care of by the core Makefile.

Specifically, [1] will be fixed by
https://patchwork.kernel.org/patch/10304671/

and [2] by
https://patchwork.kernel.org/patch/10304651/
Frank Rowand March 24, 2018, 1:31 a.m. UTC | #11
Hi Geert,

On 03/22/18 07:26, Geert Uytterhoeven wrote:
> Hi Frank,
> 
> On Fri, Mar 16, 2018 at 2:39 AM,  <Frank.Rowand@sony.com> wrote:
>> On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann [mailto:arnd@arndb.de]  wrote:
>>>
>>> The *.dtb and *.dtb.S files get removed by 'make' during the build
>>> process,
>>> and later seem to be missed during the 'modpost' stage:
>>>
>>> rm drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7791.dtb.S
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7795.dtb.S
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7796.dtb.S
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7793.dtb.S
>>> WARNING: could not open
>>> drivers/gpu/drm/rcar-du/rcar_du_of_lvds_r8a7790.dtb.S: No such file or
>>> directory
>>>
>>> As a workaround, this adds all those files to the 'extra-y' target list,
>>> but that's really ugly. Any ideas for a better fix?
>>
>> Does this work for you (untested, but the way it is done in
>> drivers/of/unittest-data/Makefile):
>>
>> .PRECIOUS: \
>>         $(obj)/%.dtb.S \
>>         $(obj)/%.dtb
> 
> Shouldn't that just be moved to scripts/Makefile.lib, just above the rule
> to make dtb.S, like is done for other precious objects?
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 

Thank you for adding Yamada-san (later in this thread).

I acked his patch series that does what you suggest.

-Frank
diff mbox

Patch

diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
index 3e58ed93d5b1..e5fc6ec0b8cc 100644
--- a/drivers/gpu/drm/rcar-du/Makefile
+++ b/drivers/gpu/drm/rcar-du/Makefile
@@ -12,6 +12,21 @@  rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)	+= rcar_du_of.o \
 					   rcar_du_of_lvds_r8a7793.dtb.o \
 					   rcar_du_of_lvds_r8a7795.dtb.o \
 					   rcar_du_of_lvds_r8a7796.dtb.o
+
+extra-y					+= rcar_du_of_lvds_r8a7790.dtb \
+					   rcar_du_of_lvds_r8a7790.dtb \
+					   rcar_du_of_lvds_r8a7791.dtb \
+					   rcar_du_of_lvds_r8a7793.dtb \
+					   rcar_du_of_lvds_r8a7795.dtb \
+					   rcar_du_of_lvds_r8a7796.dtb
+
+extra-y					+= rcar_du_of_lvds_r8a7790.dtb.S \
+					   rcar_du_of_lvds_r8a7790.dtb.S \
+					   rcar_du_of_lvds_r8a7791.dtb.S \
+					   rcar_du_of_lvds_r8a7793.dtb.S \
+					   rcar_du_of_lvds_r8a7795.dtb.S \
+					   rcar_du_of_lvds_r8a7796.dtb.S
+
 rcar-du-drm-$(CONFIG_DRM_RCAR_VSP)	+= rcar_du_vsp.o
 
 obj-$(CONFIG_DRM_RCAR_DU)		+= rcar-du-drm.o