Forum Moderators: bakedjake
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Zoe");
// Start/Init function
static int hello_init(void) {
printk("<1>Hello world!\n"); // A logging mechanism for kernel
return 0; // A non-zero return means hello_init failed; the module can't be loaded.
}
// End/Cleanup function
static void hello_exit(void) {
printk("<1>Goodbye world!\n");
}
module_init(hello_init);
module_exit(hello_exit);
I got the following message when I have tried to install into kernel using insmod::
insmod -f ./hello.o
insmod: error inserting './hello.o': -1 Invalid module format
cc -O2 -DMODULE -D__KERNEL__ -c hello.c
In file included from /usr/include/linux/module.h:10,
from hello.c:2:
/usr/include/linux/config.h:5:2: #error Incorrectly using glibc headers for a kernel module
if i commpiled with out __KERNEL__.its compiled correctly without error but i can't install module into kernel.if i try i got this error message.
insmod ./hello.o
insmod: error inserting './hello.o': -1 Invalid module format
Pls give me suggestion.