You are not logged in.
Pages: 1
i know it question may be posted for many time. but i hope someone can help me.
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init (void)
{
printk (KERN_ALERT "Hello World - this is the kernel speaking\n");
return 0;
}
static void hello_exit (void)
{
printk (KERN_ALERT "Short is the life of a kernel module\n");
}
module_init(hello_init);
module_exit(hello_exit);
Makefile :
CC=gcc
MODCFLAGS:=-O6 -Wall -DMODULE -D__KERNEL__ -DLINUX
hello.o:hello.c /usr/include/linux/version.h
$(CC) -I/usr/src/linux-2.6.35-ARCH/include/ -I/usr/src/linux-2.6.35-ARCH/arch/x86/include/ $(MODCFLAGS) -c hello.c
i got alot of warning but the last error is
/usr/src/linux-2.6.35-ARCH/arch/x86/include/asm/module.h:59:2: error: #error unknown processor family
make: *** [hello.o] Error 1
can anyone help ?
Offline
Just guessing based on the error message... it looks like you are probably missing a bunch of extra defines in your MODCFLAGS that define the processor architecture etc. Take a look at /usr/src/linux-2.6.35-ARCH/arch/x86/include/asm/module.h. You may be able to tell what you are missing based on where the error is.
Offline
Hi Chancho,
I was trying exactly the same thing yesterday. The problem is probably in your Makefile. Try:
obj-m += hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
This worked for me. See http://www.tldp.org/LDP/lkmpg/2.6/html/index.html.
Also, there's a bunch of information http://kernelnewbies.org/Drivers.
Offline
the Makefile do not work for me. i got "nothing to be done for 'all'. however, the command line :
make -C /lib/modules/2.6.35-ARCH/build M=$PWD modules
work ok.
i can insmod and rmmod now. it is a big step for me. thx.
Offline
hmm...
Try removing the empty line between 'all:' and 'make -C ...' .
Use exactly one tab between for the 'make -C...' line.
Offline
Pages: 1