Problem Compiling Kernel Module
cdlaforc at centurytel.net
cdlaforc at centurytel.net
Thu Jan 6 15:07:09 UTC 2005
Hello,
I am currently reading a book called Beginning Linux Programming and
am trying to compile the a kernel module. This is the first one I've
had to do so when I had some problems I followed the directions in the
Fedora Core 3 realease notes to install the kernel source and build the
source tree. This is the gcc command I am trying at this time:
gcc -D__Kernel__ -I/lib/modules/$(uname -r)/build/include -DMODULE -Wall
-O2 -c hello.c -o hello.o
Here is my code for the module I am trying to compile(The first try it
out example in the Device Driver Chapter of my book):
#include <linux/module.h>
#if defined(CONFIG_SMP)
#define __SMP__
#endif
#if defined(CONFIG_MODVERSIONS)
#define MODVERSIONS
#include <linux/modversions.h>
#endif
#include <linux/kernel.h>
static __init int init_module(void)
{
printk(KERN_DEBUG "Hello, kernel!\n");
return 0;
}
static __exit void cleanup_module(void)
{
printk(KERN_DEBUG "Good-bye, kernel!\n");
Please let me know if you have any ideas I am getting a ton of errors
when I try to compile. I can post them if need be.
Thanks,
More information about the fedora-list
mailing list