Hello. I'm trying to get into module programming, so I picked up both of the guides at the LDP. They were good guides, but for 2.4 or so I assume. I'm using 2.6 and whenever I insmod a module I write, It throws the error at me: "-1 Invalid module format" So I have the suspicition that I'm using old syntax that isn't used anymore. Some previous threads have transgressed this fact, but didn't offer a solution to the problem. Could anyone direct me to a guide for 2.6 (I couldn't find one) or correct this simple hello world code?
Code:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
static int hello_2_init(void)
{
printk(KERN_ALERT "Hello, world.\n");
return 0;
}
static void hello_2_exit(void)
{
printk(KERN_ALERT "Goodbye, world.\n");
}
module_init(hello_2_init);
module_exit(hello_2_exit);