Hello Kernel Compiling Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
a 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__ -isystem/lib/modules/2.6.9-1.667/build/include/linux -
DMODULE -Wall -O2   -c -o hellokernel.o hellokernel.c

And I tried:

gcc -D__KERNEL__ -I/lib/modules/2.6.9-1.667/build/include/linux -
DMODULE-Wall -O2   -c -o hellokernel.o hellokernel.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.

Thanks in advance for any help!
-D


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux