diff mbox

Kbuild: Avoid DTB rebuilds if source files are untouched

Message ID 1364973141-16354-1-git-send-email-vgupta@synopsys.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vineet Gupta April 3, 2013, 7:12 a.m. UTC
Currently, for every ARC kernel build I see the following:

--------------->8-----------------
  DTB    arch/arc/boot/dts/angel4.dtb.S
  AS      arch/arc/boot/dts/angel4.dtb.o
  LD      arch/arc/boot/dts/built-in.o
rm arch/arc/boot/dts/angel4.dtb.S        <-- forces rebuild next iter
  CHK     kernel/config_data.h
--------------->8-----------------

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 scripts/Makefile.lib |    2 ++
 1 file changed, 2 insertions(+)

Comments

Vineet Gupta April 3, 2013, 7:14 a.m. UTC | #1
forgot to CC linux-arch

On 04/03/2013 12:42 PM, Vineet Gupta wrote:
> Currently, for every ARC kernel build I see the following:
>
> --------------->8-----------------
>   DTB    arch/arc/boot/dts/angel4.dtb.S
>   AS      arch/arc/boot/dts/angel4.dtb.o
>   LD      arch/arc/boot/dts/built-in.o
> rm arch/arc/boot/dts/angel4.dtb.S        <-- forces rebuild next iter
>   CHK     kernel/config_data.h
> --------------->8-----------------
>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> Cc: Michal Marek <mmarek@suse.cz>
> Cc: Stephen Warren <swarren@nvidia.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  scripts/Makefile.lib |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 07125e6..17f96f4 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -265,6 +265,8 @@ cmd_dt_S_dtb=						\
>  	echo '.balign STRUCT_ALIGNMENT'; 		\
>  ) > $@
>  
> +.PRECIOUS: $(obj)/%.dtb.S
> +
>  $(obj)/%.dtb.S: $(obj)/%.dtb
>  	$(call cmd,dt_S_dtb)
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Warren April 3, 2013, 4:18 p.m. UTC | #2
On 04/03/2013 01:14 AM, Vineet Gupta wrote:
> forgot to CC linux-arch
> 
> On 04/03/2013 12:42 PM, Vineet Gupta wrote:
>> Currently, for every ARC kernel build I see the following:
>>
>> --------------->8-----------------
>>   DTB    arch/arc/boot/dts/angel4.dtb.S
>>   AS      arch/arc/boot/dts/angel4.dtb.o
>>   LD      arch/arc/boot/dts/built-in.o
>> rm arch/arc/boot/dts/angel4.dtb.S        <-- forces rebuild next iter
>>   CHK     kernel/config_data.h
>> --------------->8-----------------

I assume that's because the file is an intermediate file, and only built
due to a chain of build rules, and hence make clean it up itself after
the build?

>> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib

>> +.PRECIOUS: $(obj)/%.dtb.S
>> +
>>  $(obj)/%.dtb.S: $(obj)/%.dtb
>>  	$(call cmd,dt_S_dtb)

I'm not sure if .PRECIOUS is correct here. That prevents make from
deleting the file if make is CTRL-C'd in the middle of generating it.
Couldn't that leave a stale/corrupt file around that'd break the build.
Judging by:

http://www.gnu.org/software/make/manual/html_node/Special-Targets.html

I think .SECONDARY might be a better choice? Does that solve the problem
you're seeing?
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vineet Gupta April 4, 2013, 5:30 a.m. UTC | #3
On 04/03/2013 09:48 PM, Stephen Warren wrote:
> On 04/03/2013 01:14 AM, Vineet Gupta wrote:
>> forgot to CC linux-arch
>>
>> On 04/03/2013 12:42 PM, Vineet Gupta wrote:
>>> Currently, for every ARC kernel build I see the following:
>>>
>>> --------------->8-----------------
>>>   DTB    arch/arc/boot/dts/angel4.dtb.S
>>>   AS      arch/arc/boot/dts/angel4.dtb.o
>>>   LD      arch/arc/boot/dts/built-in.o
>>> rm arch/arc/boot/dts/angel4.dtb.S        <-- forces rebuild next iter
>>>   CHK     kernel/config_data.h
>>> --------------->8-----------------
> I assume that's because the file is an intermediate file, and only built
> due to a chain of build rules, and hence make clean it up itself after
> the build?

Indeed - I should have made that explicit in the Changelog.

>>> +.PRECIOUS: $(obj)/%.dtb.S
>>> +
>>>  $(obj)/%.dtb.S: $(obj)/%.dtb
>>>  	$(call cmd,dt_S_dtb)
> I'm not sure if .PRECIOUS is correct here. That prevents make from
> deleting the file if make is CTRL-C'd in the middle of generating it.
> Couldn't that leave a stale/corrupt file around that'd break the build.
> Judging by:
>
> http://www.gnu.org/software/make/manual/html_node/Special-Targets.html
>
> I think .SECONDARY might be a better choice? Does that solve the problem
> you're seeing?

Technically .SECONDARY is better - however it doesn't seem to work.
Running make with various debug toggles doesn't seem to be helping with why
.PRECIOUS works but not this.
That is also likely reason for a bunch of other .PRECIOUS entries in the same file
but no .SECONDARY.

I presume this is something not specific to ARC kernel or my host.
Can you try the .SECONDARY locally to see if it works for you.

Thx,
-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 07125e6..17f96f4 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -265,6 +265,8 @@  cmd_dt_S_dtb=						\
 	echo '.balign STRUCT_ALIGNMENT'; 		\
 ) > $@
 
+.PRECIOUS: $(obj)/%.dtb.S
+
 $(obj)/%.dtb.S: $(obj)/%.dtb
 	$(call cmd,dt_S_dtb)