FYI, Jeff/Dave, I did something a bit differently to deal with
this problem when I noticed it; here's my modules/Makefile.  I
must caution, however, that my top-level Makefile may also have
changed, so you may not be able to use this directly.

On Jeff's comment about 'time-sensitivity'; I don't think I was
clear in my previous message, that module loading had (or has,
in mainline LiS) other bugs that make it seem time-sensitive.
Unfortunately, I'd have to refresh my memory to comment in any
detail.  But I will say that it's not going to be easy to sort
that out, without first making sure that how LiS relates to and
deals with module reference counts is compatible with what both
2.4 and 2.6 kernels do.  Unfortunately, the 2.4 logic was both
broken and incomplete (in the kernel, that is), and there is at
least one bug-by omission that I know of in the 2.6 kernels as
of 2.6.7.

-John

Jeff Goldszer wrote:
Gentlmen,



Currently I am testing with Red Hat 8, Kernel 2.4.21 SMP.



I have stumbled on to what I believe is a time sensitive bug that is in modutils version 2.4.18.



I have a LiS streams loadable modules (call it module modA) and another loadable module which modA is dependent on (call it module modB).



Modprobe “modA” always seems to work, however writing a program which opens a device associated with modA is another story. ModA fails to load because modB fails mysteriously fails to load.



There is a warning that displays when insmod (insmod –s) output is directed to syslogd:

insmod: symlink to directory is not allowed, misc ignored



This message is telling us there is a recursive link misc->/lib/modules/2.4.x/misc.



Removing the recursive links seems to cure the problem.





This recursive link is created from LiS-2.17/modules/Makefile Line 44-45:

    $(Q)(cd $(DESTDIR)$(pkgdatadir)/linux-$(KVER) && \

        $(LN) $(MOD_INST_DIR) modules)



Modifying LiS-2.17/modules/Makefile Line 44-45 as shown below, eliminates the recursive link

    $(Q)(cd $(DESTDIR)$(pkgdatadir)/linux-$(KVER) && \

        $(LN) $(MOD_INST_DIR) modules && rm -f modules/misc )





For completeness I show excerpts below of /etc/module.conf



alias           char-major-8   modB

install modB insmod -v -s -f -m modB major=8 >/tmp/modb.map



alias           char-major-23   modA

install modA insmod -f -m modA major=23 >/tmp/modA.map





Jeff Goldszer

Senior Software Engineer

Alebra Technologies

64-5 Brook Avenue

Deer Park, NY 11729

Phone: 631-254-1386

FAX: 631-242-7786



include .config

default: all
        $(nothing)

all: modules
        $(nothing)

install: modules_install
        $(nothing)

HERE       = $(shell pwd)
MODVERDIR  = $(HERE)/.tmp_versions
MODULES    = $(shell find $(SRCDIR) -name .modules -exec cat {} \;)

# construct the old hardcoded dest directory, for comparison
#
OLD_INST_DIR = $(dir $(MOD_INST_DIR:%/=%))misc


ifneq ($(KBUILD),y)

obj-m = $(addprefix $(shell pwd)/,$(notdir $(MODULES)))

#
# default module subdir may have changed from .../misc - if so,
# we'll remove old modules
#
ifneq ($(MOD_INST_DIR),$(OLD_INST_DIR))
ifeq ($(DESTDIR),)
OLD_MODULES = $(wildcard $(addprefix $(OLD_INST_DIR)/,$(notdir $(MODULES))))
endif
endif

modules_install: $(MODULES)
ifneq ($(MOD_INST_DIR),$(OLD_INST_DIR))
ifneq ($(OLD_MODULES),)
#       $(Q_ECHO) $(qtag_RM)$(OLD_MODULES)
        -$(Q)rm -f $(OLD_MODULES)
endif
endif
        $(Q_ECHO) $(qtag_INSTALL)"[modules]" $(relpwd)
        $(Q)install -d $(DESTDIR)$(MOD_INST_DIR)
        $(Q)install $(obj-m) $(DESTDIR)$(MOD_INST_DIR)/.
#       symlink to the installed modules directory
        $(Q)install -d $(DESTDIR)$(pkgdatadir)/linux-$(KVER)
        $(Q)(cd $(DESTDIR)$(pkgdatadir)/linux-$(KVER) && \
                rm -f modules && $(LN) $(MOD_INST_DIR) modules)

modules: $(MODULES)
        $(nothing)

endif   # !KBUILD


ifeq ($(KBUILD),y)

ifeq ($(KERNELRELEASE),)

MODULES    = $(shell find $(SRCDIR) -name .modules -exec cat {} \;)

obj-m := $(addprefix $(shell pwd)/,$(notdir $(MODULES)))

ifeq ($(KBUILD_NEEDS_SYMVERS),y)
SYMVERS = $(HERE)/symvers
endif

#
# default module subdir may have changed from .../misc - if so,
# we'll remove old modules
#
ifneq ($(MOD_INST_DIR),$(OLD_INST_DIR))
ifeq ($(DESTDIR),)
OLD_MODULES = $(wildcard $(addprefix $(OLD_INST_DIR)/,$(notdir $(MODULES:.o=.ko))))
endif
endif

# we make modules_install depend on the .ko files that result from the
# 'modules' target instead of the 'modules' target itself, to avoid
# remaking them if they already exist
#
modules_install: $(obj-m:.o=.ko)
ifneq ($(MOD_INST_DIR),$(OLD_INST_DIR))
ifeq ($(DESTDIR),)
ifneq ($(OLD_MODULES),)
#       $(Q_ECHO) $(qtag_RM)$(OLD_MODULES)
        -$(Q)rm -f $(OLD_MODULES)
endif
endif
endif
        $(Q_ECHO) $(qtag_INSTALL)"[modules]" $(relpwd)
        $(Q)install -d $(DESTDIR)$(MOD_INST_DIR)
        $(Q)install $(obj-m:.o=.ko) $(DESTDIR)$(MOD_INST_DIR)/.
#       symlink to the installed modules directory
        $(Q)install -d $(DESTDIR)$(pkgdatadir)/linux-$(KVER)
        $(Q)(cd $(DESTDIR)$(pkgdatadir)/linux-$(KVER) && \
                rm -f modules && $(LN) $(MOD_INST_DIR) modules)

$(obj-m:.o=.ko): modules
        $(nothing)

modules: $(obj-m:.o=.mod) symvers
        $(Q_ECHO) $(qtag_KBUILD)"[modules]"
ifeq ($(KBUILD_NEEDS_SYMVERS),y)
        $(Q)$(MAKE) -C $(KSRC) SUBDIRS=$(HERE) MODVERDIR=$(MODVERDIR) \
                symverfile=$(SYMVERS) modules
else
        $(Q_ECHO) "*** Ignore the "Overriding SUBDIRS" warning(s)..."
        $(Q)$(MAKE) -C $(KSRC) SUBDIRS=$(HERE) MODVERDIR=$(MODVERDIR) modules
endif

$(obj-m:.o=.mod): $(MODVERDIR) $(MODULES)
#       $(Q_ECHO) $(qtag__m_)$(reltarget)
        $(Q){ echo $(@:.mod=.ko); echo $(@:.mod=.o); } > $(MODVERDIR)/$(@F)

$(MODVERDIR):
#       $(Q_ECHO) $(qtag_MKDIR)$(call _relpath,$(MODVERDIR))
        $(Q)mkdir -p $(MODVERDIR)

symvers: $(SYMVERS)
        $(nothing)

ifeq ($(KBUILD_NEEDS_SYMVERS),y)
#
# As of linux-2.6.6, KBUILD's modpost generates lots of warnings about
# missing LiS symbols; the file it uses, KSRC/Module.symvers, doesn't include
# them.  We remedy this by building our own file by using 'modpost -o' on each
# LiS module object to collect new 'symvers' definitions, then combining all
# of them with those in the kernel's file.  We pass this more complete file
# to KBUILD (above).
#
$(SYMVERS): $(MODULES) $(obj-m:.o=.symvers)
        $(Q_ECHO) $(qtag_SYMVERS)$(relpwd)
        $(Q)cat $(obj-m:.o=.symvers) $(KSRC)/Module.symvers > $(@F)

$(obj-m:.o=.symvers):
#       $(Q_ECHO) $(qtag_SYMVERS)$(relpwdtarget:.symvers=)
        $(Q)$(KSRC)/scripts/modpost -o $(@F) $(@:.symvers=.o)
        $(Q)rm -f $(@F:.symvers=.mod.c) $(@F:.symvers=.mod.o)
#
endif

endif   # KERNELRELEASE

endif   # KBUILD


#
# the following just makes the input .o files local.  It can either copy
# them, or symlink to them
#
$(MODULES): FORCE
        $(Q)$(LN) $(addprefix $(SRCDIR)/,$@) $(@F)

clean:
        $(Q_ECHO) $(qtag_CLEAN)$(relpwd)
        -$(Q)rm -f *.ko *.o *.mod.o *.mod.c ./.*.cmd *symvers
        -$(Q)rm -rf .tmp_versions

FORCE:

Reply via email to