|
高手指点一下吧,找了好多帖子也没解决
#include
#include
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
gcc -D__KERNEL__ -DMODULE -DLINUX -I /usr/src/kernels/2.6.18-1.2798.fc6-i586/include -c -o dev_hello.o dev_hello.c
[root@localhost cc]# gcc -D__KERNEL__ -DMODULE -DLINUX -I /usr/src/kernels/2.6.18-1.2798.fc6-i586/include -c -o dev_hello.o dev_hello.c
In file included from /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/asm/thread_info.h:16,
from /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/thread_info.h:21,
from /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/preempt.h:9,
from /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/spinlock.h:49,
from /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/capability.h:45,
from /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/sched.h:44,
from /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/module.h:9,
from dev_hello.c:2:
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/asm/processor.h:80: 错误:‘CONFIG_X86_L1_CACHE_SHIFT’ 未声明 (不在函数内)
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/asm/processor.h:80: 错误:要求的对齐边界不是常量
在包含自 /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/sched.h:49 的文件中,
从 /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/module.h:9,
从 dev_hello.c:2:
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/jiffies.h:33:3: 错误:#error You lose.
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/jiffies.h:210:31: 错误:#if 中用零做除数
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/jiffies.h:210:31: 错误:#if 中用零做除数
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/jiffies.h:210:31: 错误:#if 中用零做除数
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/jiffies.h:210:31: 错误:#if 中用零做除数
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/jiffies.h:210:31: 错误:#if 中用零做除数
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/jiffies.h:210:31: 错误:#if 中用零做除数
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/jiffies.h:210:31: 错误:#if 中用零做除数
|
|