diff mbox series

[v4,07/11] kbuild: use 'include' directive to load auto.conf from top Makefile

Message ID 1532072796-7947-8-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit 0a16d2e8cb7e6310debc208d42ff725361ae1911
Headers show
Series kbuild/kconfig: do not update config during installation | expand

Commit Message

Masahiro Yamada July 20, 2018, 7:46 a.m. UTC
When you build targets that require the kernel configuration, dot-config
is set to 1, then the top-level Makefile includes auto.conf.  However,
Make considers its inclusion is optional because the '-include' directive
is used here.

If a necessary configuration file is missing for the external module
building, the following error message is displayed:

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

However, Make still continues building; /bin/false let the creation of
'include/config/auto.config' fail, but Make can ignore the error since
it is included by the '-include' directive.

I guess the reason of using '-include' directive was to suppress
the warning when you build the kernel from a pristine source tree:

  Makefile:605: include/config/auto.conf: No such file or directory

The previous commit made sure include/config/auto.conf exists after
the 'make *config' stage.  Now, we can use the 'include' directive
without showing the warning.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

Changes in v4: None

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

Comments

Borislav Petkov Sept. 3, 2018, 9:39 a.m. UTC | #1
Hey,

On Fri, Jul 20, 2018 at 04:46:32PM +0900, Masahiro Yamada wrote:
> When you build targets that require the kernel configuration, dot-config

> is set to 1, then the top-level Makefile includes auto.conf.  However,

> Make considers its inclusion is optional because the '-include' directive

> is used here.

> 

> If a necessary configuration file is missing for the external module

> building, the following error message is displayed:

> 

>   ERROR: Kernel configuration is invalid.

>          include/generated/autoconf.h or include/config/auto.conf are missing.

>          Run 'make oldconfig && make prepare' on kernel src to fix it.

> 

> However, Make still continues building; /bin/false let the creation of

> 'include/config/auto.config' fail, but Make can ignore the error since

> it is included by the '-include' directive.

> 

> I guess the reason of using '-include' directive was to suppress

> the warning when you build the kernel from a pristine source tree:

> 

>   Makefile:605: include/config/auto.conf: No such file or directory

> 

> The previous commit made sure include/config/auto.conf exists after

> the 'make *config' stage.  Now, we can use the 'include' directive

> without showing the warning.

> 

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

> ---

> 

> Changes in v4: None

> 

>  Makefile | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


This complains here:

[boris@zn: ~/kernel/linux> git clean -dqfx
[boris@zn: ~/kernel/linux> cp ../configs/config-4.19-rc1 .config
'../configs/config-4.19-rc1' -> '.config'
[boris@zn: ~/kernel/linux> make
Makefile:605: include/config/auto.conf: No such file or directory

I guess because I'm skipping the "make oldconfig" step but that should
not be necessary since it should do oldconfig automatically before
building...

It still works - it is just the warning that is new.

Thx.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
Masahiro Yamada Sept. 3, 2018, 9:54 a.m. UTC | #2
Hi,

2018-09-03 18:39 GMT+09:00 Borislav Petkov <bp@alien8.de>:
> Hey,

>

> On Fri, Jul 20, 2018 at 04:46:32PM +0900, Masahiro Yamada wrote:

>> When you build targets that require the kernel configuration, dot-config

>> is set to 1, then the top-level Makefile includes auto.conf.  However,

>> Make considers its inclusion is optional because the '-include' directive

>> is used here.

>>

>> If a necessary configuration file is missing for the external module

>> building, the following error message is displayed:

>>

>>   ERROR: Kernel configuration is invalid.

>>          include/generated/autoconf.h or include/config/auto.conf are missing.

>>          Run 'make oldconfig && make prepare' on kernel src to fix it.

>>

>> However, Make still continues building; /bin/false let the creation of

>> 'include/config/auto.config' fail, but Make can ignore the error since

>> it is included by the '-include' directive.

>>

>> I guess the reason of using '-include' directive was to suppress

>> the warning when you build the kernel from a pristine source tree:

>>

>>   Makefile:605: include/config/auto.conf: No such file or directory

>>

>> The previous commit made sure include/config/auto.conf exists after

>> the 'make *config' stage.  Now, we can use the 'include' directive

>> without showing the warning.

>>

>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

>> ---

>>

>> Changes in v4: None

>>

>>  Makefile | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> This complains here:

>

> [boris@zn: ~/kernel/linux> git clean -dqfx

> [boris@zn: ~/kernel/linux> cp ../configs/config-4.19-rc1 .config

> '../configs/config-4.19-rc1' -> '.config'

> [boris@zn: ~/kernel/linux> make

> Makefile:605: include/config/auto.conf: No such file or directory

>

> I guess because I'm skipping the "make oldconfig" step but that should

> not be necessary since it should do oldconfig automatically before

> building...

>

> It still works - it is just the warning that is new.



You are right - I missed this usecase,
but I still want to excuse "it is rare enough".


Thanks.

-- 
Best Regards
Masahiro Yamada
Borislav Petkov Sept. 3, 2018, 10 a.m. UTC | #3
On Mon, Sep 03, 2018 at 06:54:12PM +0900, Masahiro Yamada wrote:
> You are right - I missed this usecase,

> but I still want to excuse "it is rare enough".


Isn't there a Makefile way to check file existence before including it?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
Segher Boessenkool Sept. 5, 2018, 10:53 p.m. UTC | #4
On Mon, Sep 03, 2018 at 12:00:21PM +0200, Borislav Petkov wrote:
> On Mon, Sep 03, 2018 at 06:54:12PM +0900, Masahiro Yamada wrote:

> > You are right - I missed this usecase,

> > but I still want to excuse "it is rare enough".

> 

> Isn't there a Makefile way to check file existence before including it?


Sure there is, you can use $(wildcard ) .


Segher
Masahiro Yamada Sept. 6, 2018, 12:46 a.m. UTC | #5
2018-09-06 7:53 GMT+09:00 Segher Boessenkool <segher@kernel.crashing.org>:
> On Mon, Sep 03, 2018 at 12:00:21PM +0200, Borislav Petkov wrote:

>> On Mon, Sep 03, 2018 at 06:54:12PM +0900, Masahiro Yamada wrote:

>> > You are right - I missed this usecase,

>> > but I still want to excuse "it is rare enough".

>>

>> Isn't there a Makefile way to check file existence before including it?

>

> Sure there is, you can use $(wildcard ) .



If you work around it by $(wildcard ),
we need something else that terminates building
in case auto.conf is really missing.


I do not want to revert

commit 2063945fdc3d4c0ac8f9319d942eda720d02aabe
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date:   Fri Jul 20 16:46:36 2018 +0900

    kbuild: remove auto.conf from prerequisite of phony targets





-- 
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 5c8e9a3..2fa9830 100644
--- a/Makefile
+++ b/Makefile
@@ -585,7 +585,7 @@  virt-y		:= virt/
 endif # KBUILD_EXTMOD
 
 ifeq ($(dot-config),1)
--include include/config/auto.conf
+include include/config/auto.conf
 endif
 
 # The all: target is the default when no target is given on the