PDA

View Full Version : Compiling Modules Into the Kernel



Matt1776
12th March 2008, 01:45 PM
I'm trying to write a device driver in C as a hobby, I plan to get an serially connected LED light board to display messages. Ignoring the interface, I'm just getting started writing the driver. I am using a so-so helpful guide but I believe it assumes an older version of linux or something more vanilla.


Unlike with previous versions of the kernel, itís now also necessary to compile the module using the same
kernel that youíre going to load and use the module with. To compile it, you can type:
$ make -C /usr/src/kernel-source-2.6.8 M=pwd modules

I cannot seem to find the equivalent in FC6. Any ideas how I could do this on FC6?

Am I in over my head here? In other words if I even have a chance in hell of succeeding is there something obvious about this process that I'm not understanding a priori?

I appreciate any help ;0)

Matt1776
12th March 2008, 02:21 PM
If it helps any further here is what exists in my /usr/src area:


2.6.19-1.2911.fc6-i586/
2.6.22.2-42.fc6-i586/

And under them are a bunch of directories such as 'kernel', 'drivers' etc

Because I don't know what I'm doing its a bit difficult/risky to just 'trial by fire' as I normally would.

markkuk
12th March 2008, 03:09 PM
See the Linux Kernel Module Programming Guide (http://tldp.org/LDP/lkmpg/2.6/html/index.html). Chapter 2.2 (http://tldp.org/LDP/lkmpg/2.6/html/x181.html) has the instructions for building a simple module. You must install the kernel-devel package that has the same version as your currently running kernel.

Matt1776
12th March 2008, 03:45 PM
Mark,

Thank you very much this document is much more helpful.