Driver porting: compiling external modules
Driver porting: compiling external modules
Posted Nov 9, 2004 0:57 UTC (Tue) by kabbalah (guest, #25930)Parent article: Driver porting: compiling external modules
hi there
I installed SuSe 9.1 with 2.6.4-52-default kernel and I'm having some problems writing modules for it.
I've read these articles and still can't find the answer....
that's my module
//#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
//MODULE_LICENSE("Dual BSD/GPL");
static int module_init(void)
{
printk("<1>Hello world 1.\n");
return 0;
}
static void module_exit(void)
{
printk("Goodbye world 1.\n");
}
and that's the makefile
ifneq ($(KERNELRELEASE),)
obj-m:= h.o
else
KDIR:= /lib/modules/$(shell uname -r)/build
PWD:= $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
endif
When I compile it I get these
h.c:10: error: parse error before "__initcall_void"
h.c:10: error: parse error before "void"
h.c:19: error: parse error before "__exitcall_void"
h.c:19: error: redefinition of `__attribute_used__'
h.c:10: error: `__attribute_used__' previously defined here
h.c:19: error: parse error before "void"
make: *** [h] Error 1
any ideas why this happens ?
