Reputation: 331
I am currently trying to write some Kernel Module code. I am using the functions of an existing Kernel Module. The hearders are included in my .c file but I dont know how to link my code with the Kernel Module properly
in normal userspace Makefiles I would know but not how to do this with Kernel Modules
Any suggestions?
Here's my Makefile
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
INC := -I/usr/src/kernels/$(shell uname -r)/include
obj-m := scif.o
all:
$(MAKE) V=1 -C $(KERNELDIR) M=$(PWD) modules
clean:
make -C $(KERNELDIR) M=$(PWD) clean
Upvotes: 0
Views: 89
Reputation: 1267
You do not 'link' code between modules. Beside including the header files, a module can call only functions that are exported (with EXPORT_SYMBOL or EXPORT_SYMBOL_GPL ..etc) either in the main Kernel or in other modules. Also, make sure that module dependencies in modeules.dep
are correct or the module will complain when it is loaded.
Upvotes: 1