免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1815 | 回复: 2
打印 上一主题 下一主题

[驱动] 驱动程序编译时提示内核不匹配 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-09-19 13:25 |只看该作者 |倒序浏览
驱动程序编译时提示内核不匹配
驱动程序为
#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");
3
}
module_init(hello_init);
module_exit(hello_exit);


makefile编译内容为
gcc –D__KERNEL__ -DMODULE –DLINUX –I /usr/local/src/linux2.4/include -c –o hello.o
hello.c

错误提示为:kernel-module version dismatch
                 hello.o was compiled for kernel version 2.4.20
            while this kernel is version 2.4.20-8.     

求众位大侠指导

jietu.jpg (11.58 KB, 下载次数: 35)

jietu.jpg

论坛徽章:
5
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:2815-16赛季CBA联赛之四川
日期:2018-12-17 14:10:21
2 [报告]
发表于 2012-09-19 15:34 |只看该作者
指定的KDIR目录不对

论坛徽章:
0
3 [报告]
发表于 2012-09-20 10:52 |只看该作者
谢版主指导了     
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP