[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Module names?
In detail, the attached Makefile works for kernels 2.6.5 and below. But when
running a newer kernel (2.6.8 or 2.6.10) then compilation and installation
via insmod works fine. But unfortunately the name which is depicted by
lsmod is: KBUILD_MODNAME.
The Makefile calls the script "modpost" which is kernel specific.
Furthermore, I tried to figure out what the script "modpost" is doing in
detail but ...
So I wonder what the script is doing and if the script might produce the
error.
Thanks for helping
regards Andreas
ifndef MODULE
MODULE = fctrl fidran
EXEC = fman generic
endif
ifndef KERNELDIR
KERNELDIR = /usr/src/linux
endif
GCC = -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB \
-nostdinc -iwithprefix include -Wall -Wstrict-prototypes -Wno-trigraphs\
-fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 \
-march=`uname -m` -O2 -fomit-frame-pointer
ifdef CONFIG_SMP
GCC += -D__SMP__ -DSMP
endif
ifdef CONFIG_MODVERSIONS
GCC += -DMODVERSIONS -include $(KERNELDIR)/include/linux/modversions.h
endif
INCLUDE = -I$(KERNELDIR) \
-I/lib/modules/`uname -r`/build/include \
-I/lib/modules/`uname -r`/build/include/asm-i386/mach-default \
-I. -I..
ifeq ($(KERNELDIR)/.config,$(wildcard $(KERNELDIR))/.config)
include $(KERNELDIR)/.config
endif
compile: $(MODULE:=.o) $(EXEC)
.c.o:
@echo making $(<:.c=.ko)
@gcc $(GCC) -DKBUILD_BASENAME=$(<:.c=) -DKBUILD_MODNAME=$(<:.c=)
$(INCLUDE) -c -o $(<:.c=.o) $<
@/lib/modules/`uname -r`/build/scripts/modpost $(<:.c=.o)
@gcc $(GCC) -DKBUILD_BASENAME=$(<:.c=) $(INCLUDE) -c -o $(<:.c=.mod.o)
$(<:.c=.mod.c)
@ld -r -o $(<:.c=.ko) $(<:.c=.o) $(<:.c=.mod.o)
@rm -f $(<:.c=.o) $(<:.c=.mod.*)
$(MODULE:=.ko):
@echo making $@
@gcc $(GCC) -DKBUILD_BASENAME=$(@:.ko=) -DKBUILD_MODNAME=$(@:.ko=)
$(INCLUDE) -c -o $(@:.ko=.o) $(@:.ko=.c)
@/lib/modules/`uname -r`/build/scripts/modpost $(@:.ko=.o)
@gcc $(GCC) -DKBUILD_BASENAME=$(@:.ko=) $(INCLUDE) -c -o
$(@:.ko=.mod.o) $(@:.ko=.mod.c)
@ld -r -o $@ $(@:.ko=.o) $(@:.ko=.mod.o)
@rm -f $(@:.ko=.o) $(@:.ko=.mod.*)
$(MODULE):
@echo making $(@:=.ko)
@gcc $(GCC) -DKBUILD_BASENAME=$@ -DKBUILD_MODNAME=$@ $(INCLUDE) -c -o
$(@:=.o) $(@:=.c)
@/lib/modules/`uname -r`/build/scripts/modpost $(@:=.o)
@gcc $(GCC) -DKBUILD_BASENAME=$@ $(INCLUDE) -c -o $(@:=.mod.o)
$(@:=.mod.c)
@ld -r -o $(@:=.ko) $(@:=.o) $(@:=.mod.o)
@rm -f $(@:=.o) $(@:=.mod.*)
$(EXEC):
@echo making $@
@gcc -o $@ $(@:=.c)
clean:
@rm -f *~ depend core *.o *.ko *.mod.* fman generic
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/