Commit ea837f1c050344c3f884531a195c6e339b1a54e8

Authored by Sam Ravnborg
1 parent e94c5bde70

kbuild: make modpost processing configurable

On request from Al Viro make modpost processing configurable.

KBUILD_MODPOST_WARN can be set to make modpost warn instead of
error out in case on unresolved symbols in final module link.

KBUILD_MODPOST_NOFINAL can be set to avoid the final and timeconsuming
.c file generation and link of .ko files. This is solely useful for
speeding up when doing compile checks with for example allmodconfig

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Showing 1 changed file with 8 additions and 3 deletions Side-by-side Diff

scripts/Makefile.modpost
... ... @@ -32,6 +32,10 @@
32 32 # Step 4 is solely used to allow module versioning in external modules,
33 33 # where the CRC of each module is retrieved from the Module.symers file.
34 34  
  35 +# KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined
  36 +# symbols in the final module linking stage
  37 +# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
  38 +# This is solely usefull to speed up test compiles
35 39 PHONY := _modpost
36 40 _modpost: __modpost
37 41  
... ... @@ -46,7 +50,8 @@
46 50 __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
47 51 modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o)))
48 52  
49   -_modpost: $(modules)
  53 +# Stop after building .o files if NOFINAL is set. Makes compile tests quicker
  54 +_modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules))
50 55  
51 56  
52 57 # Step 2), invoke modpost
... ... @@ -58,7 +63,7 @@
58 63 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
59 64 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
60 65 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
61   - $(if $(KBUILD_EXTMOD),-w) \
  66 + $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
62 67 $(wildcard vmlinux) $(filter-out FORCE,$^)
63 68  
64 69 PHONY += __modpost
... ... @@ -92,7 +97,7 @@
92 97  
93 98 # Step 6), final link of the modules
94 99 quiet_cmd_ld_ko_o = LD [M] $@
95   - cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \
  100 + cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \
96 101 $(filter-out FORCE,$^)
97 102  
98 103 $(modules): %.ko :%.o %.mod.o FORCE