View Full Version : Compiling Modules Into the Kernel

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)

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


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.

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.

12th March 2008, 03:45 PM

Thank you very much this document is much more helpful.