Commit 12715d20 authored by Sam Ravnborg's avatar Sam Ravnborg Committed by Sam Ravnborg

kbuild: modpost on vmlinux regardless of CONFIG_MODULES

Based on patch from: Magnus Damm <magnus@valinux.co.jp>
This has the advantage that all section mismatch checks are run regardless
of modules being enabled or not.

When running modpost on vmlinux output:
MODPOST vmlinux

When running modpost on modules output count of modules like this:
MODPOST 5 modules
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 9e157a5a
...@@ -736,6 +736,7 @@ endif # ifdef CONFIG_KALLSYMS ...@@ -736,6 +736,7 @@ endif # ifdef CONFIG_KALLSYMS
# vmlinux image - including updated kernel symbols # vmlinux image - including updated kernel symbols
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
$(call if_changed_rule,vmlinux__) $(call if_changed_rule,vmlinux__)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
$(Q)rm -f .old_version $(Q)rm -f .old_version
# The actual objects are generated when descending, # The actual objects are generated when descending,
......
...@@ -19,7 +19,7 @@ always := $(hostprogs-y) ...@@ -19,7 +19,7 @@ always := $(hostprogs-y)
hostprogs-y += unifdef hostprogs-y += unifdef
subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-$(CONFIG_MODULES) += mod subdir-y += mod
# Let clean descend into subdirs # Let clean descend into subdirs
subdir- += basic kconfig package subdir- += basic kconfig package
...@@ -51,19 +51,25 @@ _modpost: $(modules) ...@@ -51,19 +51,25 @@ _modpost: $(modules)
# Step 2), invoke modpost # Step 2), invoke modpost
# Includes step 3,4 # Includes step 3,4
quiet_cmd_modpost = MODPOST quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
cmd_modpost = scripts/mod/modpost \ cmd_modpost = scripts/mod/modpost \
$(if $(CONFIG_MODVERSIONS),-m) \ $(if $(CONFIG_MODVERSIONS),-m) \
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(filter-out FORCE,$^) $(wildcard vmlinux) $(filter-out FORCE,$^)
PHONY += __modpost PHONY += __modpost
__modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE __modpost: $(modules:.ko=.o) FORCE
$(call cmd,modpost) $(call cmd,modpost)
quiet_cmd_kernel-mod = MODPOST $@
cmd_kernel-mod = $(cmd_modpost)
vmlinux: FORCE
$(call cmd,kernel-mod)
# Declare generated files as targets for modpost # Declare generated files as targets for modpost
$(symverfile): __modpost ; $(symverfile): __modpost ;
$(modules:.ko=.mod.c): __modpost ; $(modules:.ko=.mod.c): __modpost ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment