2018-03-15 15:40:34

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

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 <[email protected]>
---
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



2018-03-16 01:41:25

by Rowand, Frank

[permalink] [raw]
Subject: RE: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann [mailto:[email protected]] 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 <[email protected]>
> ---
> 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

2018-03-16 08:26:46

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> wrote:
> On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann [mailto:[email protected]] 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

2018-03-20 13:16:41

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

Hi Arnd,

On Friday, 16 March 2018 10:25:25 EET Arnd Bergmann wrote:
> On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> 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 ?

--
Regards,

Laurent Pinchart


2018-03-21 07:39:44

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

On Tue, Mar 20, 2018 at 9:15 PM, Laurent Pinchart
<[email protected]> wrote:
> Hi Arnd,
>
> On Friday, 16 March 2018 10:25:25 EET Arnd Bergmann wrote:
>> On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> 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 <[email protected]>'.

Arnd

2018-03-21 09:59:03

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

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, <[email protected]> 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
> <[email protected]>'.

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.

--
Regards,

Laurent Pinchart


2018-03-22 14:36:15

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

Hi Frank,

On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> wrote:
> On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann [mailto:[email protected]] 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

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

2018-03-22 15:01:44

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

Hi Geert,

On Thursday, 22 March 2018 16:26:22 EET Geert Uytterhoeven wrote:
> On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> 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 ?

--
Regards,

Laurent Pinchart


2018-03-22 15:14:56

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

Hi Laurent,

CC Yamada-san

On Thu, Mar 22, 2018 at 3:50 PM, Laurent Pinchart
<[email protected]> wrote:
> On Thursday, 22 March 2018 16:26:22 EET Geert Uytterhoeven wrote:
>> On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> 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 -- [email protected]

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

2018-03-22 17:49:40

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

2018-03-23 0:13 GMT+09:00 Geert Uytterhoeven <[email protected]>:
> Hi Laurent,
>
> CC Yamada-san
>
> On Thu, Mar 22, 2018 at 3:50 PM, Laurent Pinchart
> <[email protected]> wrote:
>> On Thursday, 22 March 2018 16:26:22 EET Geert Uytterhoeven wrote:
>>> On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> 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 -- [email protected]
>
> 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.


--
Best Regards
Masahiro Yamada

2018-03-23 13:29:28

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

2018-03-23 0:13 GMT+09:00 Geert Uytterhoeven <[email protected]>:
> Hi Laurent,
>
> CC Yamada-san
>
> On Thu, Mar 22, 2018 at 3:50 PM, Laurent Pinchart
> <[email protected]> wrote:
>> On Thursday, 22 March 2018 16:26:22 EET Geert Uytterhoeven wrote:
>>> On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> 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/




--
Best Regards
Masahiro Yamada

2018-03-24 01:32:14

by Frank Rowand

[permalink] [raw]
Subject: Re: [PATCH] [RFC] drm: rcar-du: keep temporary dtb files around during build

Hi Geert,

On 03/22/18 07:26, Geert Uytterhoeven wrote:
> Hi Frank,
>
> On Fri, Mar 16, 2018 at 2:39 AM, <[email protected]> wrote:
>> On Thursday, March 15, 2018 8:37 AM, Arnd Bergmann [mailto:[email protected]] 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