|
the kernel version shouldn't defined anywhere in the module - it should have headers to do that.
#include <linux/kernel.h>
#include <linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{
printk("hello world\n");
return 0;
}
void cleanup_module()
{
}
--- and, that's it for the hello world. it needs to be compiled with
CC=gcc
MODCFLAGS := -Wall -DMODULE -D__KERNEL__ -DLINUX
hello.o: hello.c /usr/include/linux/version.h
$(CC) $(MODFLAGS) -c hello.c
it doesn't do anything, but it should load and unload.
|