|
insmod error: unresolved symbol
I am learning how to write linux device driver and wrote a simple usb driver for my Microchip PIC 32 usb starter board.
In the "probe" and "disconnect" function of my kernel module code, several usb functions (interface_to_usbdev, usb_get_intfdata, usb_get_dev, usb_set_intfdata, usb_put_dev) are used.
Compiling succeeded (there are some warnings though). However, when I tried to load the module with "insmod mydriver.o", I got the following error messages:
mydriver.o: unresolved symbol interface_to_usbdev
mydriver.o: unresolved symbol usb_get_intfdata
mydriver.o: unresolved symbol usb_get_dev
mydriver.o: unresolved symbol usb_set_intfdata
mydriver.o: unresolved symbol usb_put_dev
I googled for a while without any luck. Somebody said kernel source should be installed. But I already had kernel-source-2.4.20-8.i386.rpm installed. I am using redhat9 with kernel 2.4.20-8.
I also checked the loaded modules and made sure that usbcore module has been loaded.
Below is my Makefile:
------------------------------------------------------
TARGET := mydriver
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc
${TARGET}.o: ${TARGET}.c
.PHONY: clean
clean:
rm -rf ${TARGET}.o
----------------------------------------------------------
Anybody has an idea of how to solve this problem? Thanks in advance.
|