Skip to content

Commit

Permalink
kbuild: refactor the check for missing config files
Browse files Browse the repository at this point in the history
This commit refactors the check for missing configuration files, making
it easier to add more files to the list.

The format of the error message has been slightly changed, as follows:

[Before]

    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.

[After]

  ***
  ***  ERROR: Kernel configuration is invalid. The following files are missing:
  ***    - include/generated/autoconf.h
  ***    - include/config/auto.conf
  ***  Run "make oldconfig && make prepare" on kernel source to fix it.
  ***

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Tested-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
Masahiro Yamada committed Nov 4, 2024
1 parent 5390d99 commit ec873a4
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -781,17 +781,22 @@ $(KCONFIG_CONFIG):
else # !may-sync-config
# External modules and some install targets need include/generated/autoconf.h
# and include/config/auto.conf but do not care if they are up-to-date.
# Use auto.conf to trigger the test
# Use auto.conf to show the error message

checked-configs := include/generated/autoconf.h include/config/auto.conf
missing-configs := $(filter-out $(wildcard $(checked-configs)), $(checked-configs))

ifdef missing-configs
PHONY += include/config/auto.conf

include/config/auto.conf:
@test -e include/generated/autoconf.h -a -e $@ || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or $@ are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
@echo >&2 '***'
@echo >&2 '*** ERROR: Kernel configuration is invalid. The following files are missing:'
@printf >&2 '*** - %s\n' $(missing-configs)
@echo >&2 '*** Run "make oldconfig && make prepare" on kernel source to fix it.'
@echo >&2 '***'
@/bin/false
endif

endif # may-sync-config
endif # need-config
Expand Down

0 comments on commit ec873a4

Please sign in to comment.