diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2003-01-24 09:52:47 -0600 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2003-01-24 09:52:47 -0600 |
| commit | e4ccd604a353b3d4e61e99d04ac9a2bdd8b66ec4 (patch) | |
| tree | c49b53a7701f5fa94e43a7194fa8df9a3d7660d9 | |
| parent | caa9e0e04c20ce4f6884066cb2f4d4e33db07178 (diff) | |
kbuild: Don't build final .ko yet when descending with CONFIG_MODVERSIONING
With CONFIG_MODVERSIONING, we need to record the versions of the unresolved
symbols in the final <module>.ko, which we only know after we finished
the descending build. So we only build <module>.o in that case.
Also, keep track of the modules we built, the post-processing step needs
a list of all modules. Keeping track is done by touching
.tmp_versions/path/to/module.ko
| -rw-r--r-- | Makefile | 24 | ||||
| -rw-r--r-- | scripts/Makefile.build | 25 |
2 files changed, 48 insertions, 1 deletions
@@ -260,6 +260,20 @@ ifndef CONFIG_FRAME_POINTER CFLAGS += -fomit-frame-pointer endif +# When we're building modules with modversions, we need to consider +# the built-in objects during the descend as well, in order to +# make sure the checksums are uptodate before we use them. + +ifdef CONFIG_MODVERSIONING +ifeq ($(KBUILD_MODULES),1) +ifneq ($(KBUILD_BUILTIN),1) + KBUILD_BUILTIN := 1 +endif +endif +endif + +export MODVERDIR := .tmp_versions + # # INSTALL_PATH specifies where to place the updated kernel and system map # images. Uncomment if you want to place them anywhere other than root. @@ -388,6 +402,16 @@ $(SUBDIRS): prepare .PHONY: prepare prepare: include/linux/version.h include/asm include/config/MARKER +ifdef CONFIG_MODVERSIONING +ifdef KBUILD_MODULES +ifeq ($(origin SUBDIRS),file) + $(Q)rm -rf $(MODVERDIR) +else + @echo '*** Warning: Overriding SUBDIRS on the command line can cause' + @echo '*** inconsistencies with module symbol versions' +endif +endif +endif @echo ' Starting the build. KBUILD_BUILTIN=$(KBUILD_BUILTIN) KBUILD_MODULES=$(KBUILD_MODULES)' # We need to build init/vermagic.o before descending since all modules diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9581629c08bf..1c2a3d057b40 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -45,8 +45,15 @@ O_TARGET := $(obj)/built-in.o endif endif +ifdef CONFIG_MODVERSIONING +modules := $(obj-m) +touch-module = @mkdir -p $(MODVERDIR)/$(@D); touch $(MODVERDIR)/$(@:.o=.ko) +else +modules := $(obj-m:.o=.ko) +endif + __build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \ - $(if $(KBUILD_MODULES),$(obj-m:.o=.ko)) \ + $(if $(KBUILD_MODULES),$(modules)) \ $(subdir-ym) $(build-targets) @: @@ -152,6 +159,15 @@ else $(call if_changed_dep,cc_o_c) endif +# For modversioning, we need to special case single-part modules +# to mark them in $(MODVERDIR) + +ifdef CONFIG_MODVERSIONING +$(single-used-m): %.o: %.c FORCE + $(touch-module) + $(call if_changed_rule,vcc_o_c) +endif + quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \ @@ -242,6 +258,11 @@ targets += $(multi-used-y) $(multi-used-m) # # Rule to link modules ( .o -> .ko ) # + +# With CONFIG_MODVERSIONING, generation of the final .ko is handled +# by scripts/Makefile.modver +ifndef CONFIG_MODVERSIONING + quiet_cmd_link_module = LD [M] $@ cmd_link_module = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $< init/vermagic.o @@ -255,6 +276,8 @@ $(single-used-m:.o=.ko) $(multi-used-m:.o=.ko): %.ko: %.o init/vermagic.o FORCE targets += $(single-used-m:.o=.ko) $(multi-used-m:.o=.ko) +endif + # Compile programs on the host # =========================================================================== # host-progs := bin2hex |
