Driver compiling questions

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
DavidBell
Posts: 132
Joined: Fri 24 Nov 2006, 21:44

Driver compiling questions

#1 Post by DavidBell »

I'm trying to modify my topuchscreen driver a little, but I have a couple of questions.

First is, what is the syntax for compiling a single source (.c) file into a driver? currently I am using

Code: Select all

make modules
from /usr/src/linux, and it works but it goes through checking them all which takes an age when I only want to change one. So if anyone knows the command to compile just one I'd be grateful. I think it's actually two commands - first uses gcc to go from .c to .o, then a second converts to .ko? I tried to look at the makefile but it's incomprehensible to me.

Second problem is /usr/include doesn't seem to be in the default include path when compiling modules, so if I add lines like

Code: Select all

#include <stdio.h>
/*or*/
#include <syslog.h>
/*yes, these are the two I want :-)*/
... the files are in /usr/include, but the compiler can't find them. So it there an environmental variable somewhere that sets default include paths, or is it all done in the compile command?

Thanks for any help. DB

DavidBell
Posts: 132
Joined: Fri 24 Nov 2006, 21:44

#2 Post by DavidBell »

For those wondering, you can get a simple makefile that you can modify for individual drviers at http://tldp.org/LDP/lkmpg/2.6/html/index.html (chapter 2.2)

Also found out stdio.h isn't allowed in kernel modules, you have to use kernel functions like printk instead.

DB

Post Reply