diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-03-16 03:37:12 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-03-25 13:01:22 -0400 |
commit | 07a422bb213adb7ee1afbb2347ce6922c60a558a (patch) | |
tree | cdc621b641d4afba9b79316c28286324f676f204 | |
parent | d8821622c889d9dbc1a31b16e726717394954596 (diff) |
kbuild: restore autoksyms.h touch to the top Makefile
Commit d3fc425e819b ("kbuild: make sure autoksyms.h exists early")
moved the code that touches autoksyms.h to scripts/kconfig/Makefile
with obscure reason.
From Nicolas' comment [1], he did not seem to be sure about the root
cause.
I guess I figured it out, so here is a fix-up I think is more correct.
According to the error log in the original post [2], the build failed
in scripts/mod/devicetable-offsets.c
scripts/mod/Makefile is descended from scripts/Makefile, which is
invoked from the top-level Makefile by the 'scripts' target.
To build vmlinux and/or modules, Kbuild descend into $(vmlinux-dirs).
This depends on 'prepare' and 'scripts' as follows:
$(vmlinux-dirs): prepare scripts
Because there is no dependency between 'prepare' and 'scripts', the
parallel building can execute them simultaneously.
'prepare' depends on 'prepare1', which touched autoksyms.h, while
'scripts' descends into script/, then scripts/mod/, which needs
<generated/autoksyms.h> if CONFIG_TRIM_UNUSED_KSYMS. It was the
reason of the race.
I am not happy to have unrelated code in the Kconfig Makefile, so
getting it back to the top Makefile.
I removed the standalone test target because I want to use it to
create an empty autoksyms.h file. Here is a little improvement;
unnecessary autoksyms.h is not created when CONFIG_TRIM_UNUSED_KSYMS
is disabled.
[1] https://lkml.org/lkml/2016/11/30/734
[2] https://lkml.org/lkml/2016/11/30/531
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | scripts/kconfig/Makefile | 2 |
2 files changed, 7 insertions, 7 deletions
@@ -1019,9 +1019,11 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS | |||
1019 | "$(MAKE) -f $(srctree)/Makefile vmlinux" | 1019 | "$(MAKE) -f $(srctree)/Makefile vmlinux" |
1020 | endif | 1020 | endif |
1021 | 1021 | ||
1022 | # standalone target for easier testing | 1022 | autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) |
1023 | include/generated/autoksyms.h: FORCE | 1023 | |
1024 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true | 1024 | $(autoksyms_h): |
1025 | $(Q)mkdir -p $(dir $@) | ||
1026 | $(Q)touch $@ | ||
1025 | 1027 | ||
1026 | ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) | 1028 | ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) |
1027 | 1029 | ||
@@ -1065,7 +1067,7 @@ include/config/kernel.release: include/config/auto.conf FORCE | |||
1065 | # in parallel | 1067 | # in parallel |
1066 | PHONY += scripts | 1068 | PHONY += scripts |
1067 | scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ | 1069 | scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ |
1068 | asm-generic gcc-plugins | 1070 | asm-generic gcc-plugins $(autoksyms_h) |
1069 | $(Q)$(MAKE) $(build)=$(@) | 1071 | $(Q)$(MAKE) $(build)=$(@) |
1070 | 1072 | ||
1071 | # Things we need to do before we recursively start building the kernel | 1073 | # Things we need to do before we recursively start building the kernel |
@@ -1095,7 +1097,7 @@ endif | |||
1095 | # that need to depend on updated CONFIG_* values can be checked here. | 1097 | # that need to depend on updated CONFIG_* values can be checked here. |
1096 | prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic | 1098 | prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic |
1097 | 1099 | ||
1098 | prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ | 1100 | prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h \ |
1099 | include/config/auto.conf | 1101 | include/config/auto.conf |
1100 | $(cmd_crmodverdir) | 1102 | $(cmd_crmodverdir) |
1101 | 1103 | ||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index cb3ec53a7c29..eb139a17383c 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -38,8 +38,6 @@ nconfig: $(obj)/nconf | |||
38 | # for external use. | 38 | # for external use. |
39 | silentoldconfig: $(obj)/conf | 39 | silentoldconfig: $(obj)/conf |
40 | $(Q)mkdir -p include/config include/generated | 40 | $(Q)mkdir -p include/config include/generated |
41 | $(Q)test -e include/generated/autoksyms.h || \ | ||
42 | touch include/generated/autoksyms.h | ||
43 | $< $(silent) --$@ $(Kconfig) | 41 | $< $(silent) --$@ $(Kconfig) |
44 | 42 | ||
45 | localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 43 | localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf |