(Again) Revert module directory hierarchy and depmod invocation
PATCH 1/1 (Again) Revert module directory hierarchy and depmod invocation
[As Greg Kroah-Hartman pointed out, wrong patch appended last time.]
Linus, please apply.
While the kernel, depmod et. al. don't care, other tools want the directory hierarchy under /lib/modules/uname -r/. Sure, it's bogus for them to rely on kernel source layout, but noone has come up with a better alternative, so revert.
NOTE: You *still* can't have two modules of the same name! (You never could).
Thanks,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Revert depmod and hierarchy changes
Author: Rusty Russell
Status: Tested on 2.5.51
D: module-init-tools 0.9 and newer supply a replacement depmod, so
D: it's safe to run again. Also, some external programs like PCMCIA
D: and mkinitrd really want the directory hierarchy in /lib/modules
D: back again: it makes no difference to the tools (since 0.9), so
D: revert it.
Makefile +16 -1
@@ -157,6 +157,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump AWK = awk GENKSYMS = /sbin/genksyms +DEPMOD = /sbin/depmod KALLSYMS = scripts/kallsyms PERL = perl MODFLAGS = -DMODULE
@@ -534,7 +535,7 @@ modules: $(SUBDIRS) # Install modules .PHONY: modules_install -modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) +modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post .PHONY: _modinst_ _modinst_:
@@ -542,6 +543,20 @@ _modinst_: @rm -f $(MODLIB)/build @mkdir -p $(MODLIB)/kernel @ln -s $(TOPDIR) $(MODLIB)/build + +# If System.map exists, run depmod. This deliberately does not have a +# dependency on System.map since that would run the dependency tree on +# vmlinux. This depmod is only for convenience to give the initial +# boot a modules.dep even before / is mounted read-write. However the +# boot script depmod is the master version. +ifeq "$(strip $(INSTALL_MOD_PATH))" "" +depmod_opts := +else +depmod_opts := -b $(INSTALL_MOD_PATH) -r +endif +.PHONY: _modinst_post +_modinst_post: + if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi .PHONY: $(patsubst %, _modinst_%, $(SUBDIRS)) $(patsubst %, _modinst_%, $(SUBDIRS)) :
scripts/Makefile.modinst +2 -2
@@ -16,8 +16,8 @@ include scripts/Makefile.lib # ========================================================================== quiet_cmd_modules_install = INSTALL $(obj-m:.o=.ko) - cmd_modules_install = mkdir -p $(MODLIB)/kernel && \ - cp $(obj-m:.o=.ko) $(MODLIB)/kernel/ + cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \ + cp $(obj-m:.o=.ko) $(MODLIB)/kernel/$(obj) modules_install: $(subdir-ym) ifneq ($(obj-m:.o=.ko),)