- From: David P. Mott <dpmott_at_sep.com>
- Date: Wed, 3 Aug 2005 15:11:12 -0500 (US Eastern Standard Time)
Hello --
I'm fairly new to both SuSE and comedi. I was recently asked to port a
SuSE 2.4 kernel module to work with the SuSE 2.6 kernel.
The module itself isn't terribly complicated, and I ported the basic
framework to 2.6 without much trouble. The basic principle is that it is
invoked every 50ms to check some user-space data (supplied via mmap) and
then drive some hardware outputs via comedi.
So, I have the part where the kernel module uses a kernel timer to do work
every 50ms. I can load the module with '/sbin/insmod watchdog' and I can
interact with it from user-space.
Now I'm trying to put the comedi calls back in and compile. The calls,
specifically are: comedi_open(), comedi_close(), comedi_dio_config(), and
comedi_dio_write().
Now, keep in mind that I'm a novice at this. My Makefile is as follows,
which compiles my (only) watchdog.c kernel module source file:
ifneq ($(KERNELRELEASE),)
obj-m := watchdog.o
else
KDIR := /usr/src/linux
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
endif
My lessons so far are:
1. in watchdog.c:
#include <linux/comedilib.h>
instead of just <comedilib.h>
2. in Makefile, add:
EXTRA_CFLAGS += <path to comedi-0.7.70>/include
because 'linux/comedilib.h' apparently isn't installed by default.
(Someone please let me know if I went down the wrong road there...)
Now, I have unresolved symbols. This makes sense, because I haven't told
the makefile where these symbols are yet:
comedi_dio_config, comedi_close, comedi_open, comedi_dio_write
Now, I'm a novice with Makefiles, so I've tried a variety of ways to
specify *something* in the makefile that will supply the correct symbols
for use in my kernel module, all of them unsuccessful.
For instance, I've tried this:
watchdog-objs := <path to lib/modules/kernelversion>/comedi/kcomedilib.ko
This gives me more unresolved symbols. This:
watchdog-objs := <path to lib/modules/kernelversion>/comedi/comedi.ko
actually lets me compile, but then when I '/sbin/insmod watchdog.ko', it
installs the comedi kernel module instead. (I guess I got the whole
comedi device driver instead of just the interface that I wanted). I then
have to '/sbin/rmmod comedi' to get it out, because '/sbin/rmmod watchdog'
doesn't work.
I'm at a loss. I don't know much about Makefiles, and I don't know what
object files/shared libraries/kernel modules/etc. that I should be linking
in, even if I did know how to specify them in the makefile.
Could anyone here please point me in the right direction?
Thanks,
-dpmott
Received on 2005-08-03Z19:11:12