Forum Moderators: bakedjake

Message Too Old, No Replies

Failed to insert module in FC2

         

murali_ym

4:29 am on Feb 4, 2005 (gmt 0)

10+ Year Member



The following module got error when i tried to insert to kernel.
// hello.c
#include <linux/module.h> // required by all modules
#include <linux/kernel.h> // required by printk()
#include <linux/init.h>
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