编译模块时出现的错误
模块源文件(hello.c)代码:
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void){
printk("<1>hello word!\n");
return 0;
}
void cleanup_module(void){
}
Makefile:
TARGET := hello
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/2.6.22.6-1/build/include/
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc
${TARGET}.o: ${TARGET}.c
.PHONY: clean
make时的错误提示:
gcc -O2 -DMODULE -D__KERNEL__ -W -Wall -Wstrict-prototypes -Wmissing-prototypes -isystem /lib/modules/2.6.22.6-1/build/include/ -c -o hello.o hello.c
In file included from /lib/modules/2.6.22.6-1/build/include/asm/thread_info.h:16,
from /lib/modules/2.6.22.6-1/build/include/linux/thread_info.h:21,
from /lib/modules/2.6.22.6-1/build/include/linux/preempt.h:9,
from /lib/modules/2.6.22.6-1/build/include/linux/spinlock.h:49,
from /lib/modules/2.6.22.6-1/build/include/linux/module.h:9,
from hello.c:1:
/lib/modules/2.6.22.6-1/build/include/asm/processor.h:83: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function)
/lib/modules/2.6.22.6-1/build/include/asm/processor.h:83: error: requested alignment is not a constant
In file included from /lib/modules/2.6.22.6-1/build/include/linux/module.h:21,
from hello.c:1:
/lib/modules/2.6.22.6-1/build/include/asm/module.h:64:2: error: #error unknown processor family
能帮帮我吗(linux为2.6.22.6-1)
[ 本帖最后由 linkstack 于 2008-3-17 11:27 编辑 ]