Results 1 to 2 of 2
Hello,
I've been trying to implement the hello world code from the device
drivers chapter of "Beginning Linux Programming". I'm trying to create
module that I can test with the ...
- 10-09-2007 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 6
Hello Kernel Compiling Error
Hello,
I've been trying to implement the hello world code from the device
drivers chapter of "Beginning Linux Programming". I'm trying to create
module that I can test with the insmod command. I keep getting errors
because I'm compiling using the wrong header:
In file included from /usr/include/linux/module.h:10,
from hellokernel.c:3:
/usr/include/linux/config.h:5:2: #error Incorrectly using glibc headers
for a kernel module
However, I've invoked the compiler as follows:
gcc -D__KERNEL__ -DMODULE -DMODVERSIONS -O2 -Wall -I /usr/src/linux/include -o samplerw.o -c samplerw.c
But, despite my providing what I think should be a directory in which to
search for *.h files (which I believe are the correct ones for my
system, a Fedora Core 3 install) for kernel compilations, I keep getting
the error above based on gcc including the wrong header file
My system details are as below.
# uname -a
Linux wiprosdm 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux
If some body could help that would be appreciable.
Thanks in advance.
- Mani
- 10-10-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Try this makefile, save it in the directory you're working (before the make commands you must have real tabs, not spaces):
To compile type "make", to cleanup the files type "make clean".Code:obj-m += samplerw.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Regards


Reply With Quote
