For those of you brave enough to 'add foreign modules' to your existing 
kernel, here's some info you need to stop depmod squealing about dependencies.

The example I'm using is ov511.c, a sorta kinda generic webcam video module 
that comes with kernel 2.4.x series but is very out of date versus the 
'latest' version available from the maintainers. It is quite typical of your 
need to improve specific drivers for your purposes in Linux, remember usb? 
pcmcia? ultra66?. These 'updates' are classed as a 'foreign' modules. They 
are 'foreign' to the kernel build and depmod/modprobe will scream.

Don't be overly fussed about the ov511, the information here is generic to 
any updates you might choose to do.

The 'problem' is as follows:

you can successfully compile code such that it 'works' in your running 
kernel. There isn't much to that. A five minute read of the 
module-programming-howto, would have any C programmer installing a "hello 
world" module, within the hour.

However, in order for depmod to include your module in it's library, it needs 
additional information that is not normally supplied. The criteria here is 
you don't just want to insert a module by hand, you want it to be included 
automatically.

Here is a typical Makefile snippet that is supplied by any maintainer and is 
generally sufficient to ensure a succesful compile.

------
INCLUDEDIR = /usr/include

CFLAGS = -D__KERNEL__ -DMODULE -O2 -Wall -Wstrict-prototypes 
-fomit-frame-pointer -I$(INCLUDEDIR) 
-----------

The 'important bits' here are 1) the statement that this will be a KERNEL and 
a MODULE compile, and the location of the header tree (/usr/include)

You'll find additional sexy bits in your specific Makefile (such as i686 eg) 
but the above is the raw material.

Here's what you need to ADD to make modprobe a happy camper (tm)

----------

INCLUDE = /usr/include
INCLUDE2 = /usr/src/<version>/include

CFLAGS = -D__KERNEL__ -DMODULE -O2 -Wall -Wstrict-prototypes 
-fomit-frame-pointer -I$(INCLUDE) 
-I$(INCLUDE2) 
-DMODVERSIONS  
-include /usr/src/<version>/include/linux/modversions.h 

----

It is the last two lines that do all the hard work. You are telling the 
compiler to generate symbol linformation that depmod can use.

The second INCLUDE2 is required because of internal references that 
modversions.h goes looking for.

And finally ! <version> is obviously? the symlink to whatever is the source 
tree to your current running kernel. It USED to be 'linux'. On a redhat 
system (eg) it can be any naming convention that they dreamed up this week.


-- 
http://linux.nf

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

_______________________________________________
http://linux.nf -- [EMAIL PROTECTED]
Archives, Subscribe, Unsubscribe, Digest, Etc 
->http://linux.nf/mailman/listinfo/linux-users

Reply via email to