Kernel compilation probelm
Hi, new here, and having trouble with hello-1.c compliling.
I am using Fedora Core 4, and here is my hello-1.c
/*
* hello#8722;1.c #8722; The simplest kernel module
*/
#define KERN_INFO
module_LICENSE("GPL"); //also tried MODULE_LINCENSE("GPL");
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
here is my make file
CFLAGS = -D __KERNEL__ -D MODULE -isystem /lib/modules/`uname -r`/build/include/
$ hello-1.o: hello-1.c
gcc $(CFLAGS) -O2 -Wall -c hello-1.c
.PHONY: clean
clean:
rm -rf *.o a.out
gcc -D __KERNEL__ -D MODULE -isystem /lib/modules/`uname -r`/build/include/ -O2 -Wall -c hello-1.c
hello-1.c:5: error: syntax error before string constant
hello-1.c:5: warning: type defaults to âintâ in declaration of âmodule_LICENSEâ
hello-1.c:5: warning: data definition has no type or storage class
In file included from /usr/include/linux/module.h:10,
from hello-1.c:7:
/usr/include/linux/config.h:5:2: error: #error Incorrectly using glibc headers for a kernel module
hello-1.c: In function âinit_moduleâ:
hello-1.c:11: warning: implicit declaration of function âprintkâ
make: *** [hello-1.o] Error 1
Here is the output from the screen.
Thanks for the help.
smn
|