user-mode Linux, __generic_copy_to_user problem
I am writing a small character device driver for a university course. The driver is somewhat similar to the "scull" module in _Linux Device Drivers_, from O'Reilly: it's basically just a linked list of 4,000-character text blocks. A user can write a text block to the driver or read a text block from the driver. The read and write operations use the copy_to_user and copy_from_user kernel functions.
I'm finding that I can compile and load my code on my regular Debian system, running kernel 2.4.19. However, the code has a bug, such that when I write to the device, the system immediately crashes. This makes debugging well-nigh impossible. To get around this, our professor provided user-mode Linux (Debian, kernel 2.4.20-8um) on a lab machine. When I compile for UML, I use the following flags:
gcc -D__KERNEL__ -I/usr/share/include -Wall -Wstrict-prototypes \
-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common \
-fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 \
-march=i686 -DMODULE -nostdinc -iwithprefix include \
This compiles with no errors or warnings. But when I try to insert the resulting object file into the kernel, I get this error:
(none):~# /sbin/insmod -f csmail.o
csmail.o: unresolved symbol __generic_copy_from_user
csmail.o: unresolved symbol __generic_copy_to_user
Hint: You are trying to load a module without a GPL compatible license
and it has unresolved symbols. Contact the module supplier for
assistance, only they can help you.
The puzzling thing is that the compiler seems to be finding the copy_to_user function in <asm/uaccess.h> - otherwise, I'd expect to get a warning that the function was implicitly defined. But I still get this error when I try to load.
Any help with this would be greatly appreciated- thank you in advance.