Chinaunix
标题:
请问如何编译
[打印本页]
作者:
netdoger
时间:
2011-07-20 20:37
标题:
请问如何编译
我抄了一个程序:
#include <linux/module.h> //所有模块都需要的头文件
#include <linux/init.h> // init&exit 相关宏
MODULE_LICENSE("GPL");
static int __init hello_init (void)
{
printk("Hello module init\n");
return 0;
}
static void __exit hello_exit (void)
{
printk("Hello module exit\n");
}
module_init(hello_init);
module_exit(hello_exit);
可是编译时,按照书上的编译通不过:
gcc –D__KERNEL__ -DMODULE –DLINUX –I /usr/local/src/linux2.4/include -c –o hello.o hello.c
我的系统是CentOS 5.3,
请问该怎么编译呢?(我发现我的/usr/local/src下为空的)
作者:
Trigger_Huang
时间:
2011-07-21 17:07
额,这种编译方式? 呵呵,为什么不套用LDD上面的Makefile模板?
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2