aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-12-07 07:04:30 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:14:35 -0500
commit551559e13af1ccd19d0525cb2b0f308905170647 (patch)
treedf0cf86a47d0014747ab1c4f23bac71f384d3f4e /scripts/Makefile.build
parent9e233625fbee1f977929a5406533b96011f1a06b (diff)
kbuild: implement modules.order
When multiple built-in modules (especially drivers) provide the same capability, they're prioritized by link order specified by the order listed in Makefile. This implicit ordering is lost for loadable modules. When driver modules are loaded by udev, what comes first in modules.alias file is selected. However, the order in this file is indeterministic (depends on filesystem listing order of installed modules). This causes confusion. The solution is two-parted. This patch updates kbuild such that it generates and installs modules.order which contains the name of modules ordered according to Makefile. The second part is update to depmod such that it generates output files according to this file. Note that both obj-y and obj-m subdirs can contain modules and ordering information between those two are lost from beginning. Currently obj-y subdirs are put before obj-m subdirs. Sam Ravnborg cleaned up Makefile modifications and suggested using awk to remove duplicate lines from modules.order instead of using separate C program. Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Cc: Bill Nottingham <notting@redhat.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Jon Masters <jonathan@jonmasters.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r--scripts/Makefile.build17
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index de9836eee8bb..db38ef465a63 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -83,10 +83,12 @@ ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
83builtin-target := $(obj)/built-in.o 83builtin-target := $(obj)/built-in.o
84endif 84endif
85 85
86modorder-target := $(obj)/modules.order
87
86# We keep a list of all modules in $(MODVERDIR) 88# We keep a list of all modules in $(MODVERDIR)
87 89
88__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ 90__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
89 $(if $(KBUILD_MODULES),$(obj-m)) \ 91 $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \
90 $(subdir-ym) $(always) 92 $(subdir-ym) $(always)
91 @: 93 @:
92 94
@@ -276,6 +278,19 @@ targets += $(builtin-target)
276endif # builtin-target 278endif # builtin-target
277 279
278# 280#
281# Rule to create modules.order file
282#
283# Create commands to either record .ko file or cat modules.order from
284# a subdirectory
285modorder-cmds = \
286 $(foreach m, $(modorder), \
287 $(if $(filter %/modules.order, $m), \
288 cat $m;, echo kernel/$m;))
289
290$(modorder-target): $(subdir-ym) FORCE
291 $(Q)(cat /dev/null; $(modorder-cmds)) > $@
292
293#
279# Rule to compile a set of .o files into one .a file 294# Rule to compile a set of .o files into one .a file
280# 295#
281ifdef lib-target 296ifdef lib-target