usb网卡驱动编译无法找到__bad_udelay的错误

guoke25 2011-11-22 04:36:38
使用的系统:fedora 9
使用的开发板内核环境:linux 2.6.30.4版
问题:
将Makefile的内核目录指向开发板内核的目录并配置好mii.c和usbnet.c以后,编译usb网卡驱动时出现了以下警告:
make
Building QF9700 USB2NET chip driver...
make[1]: Entering directory `/opt/linux-2.6.30.4'
CC [M] /opt/drivertest/usbnet/qf9700.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "__bad_udelay" [/opt/drivertest/usbnet/qf9700.ko] undefined!
CC /opt/drivertest/usbnet/qf9700.mod.o
LD [M] /opt/drivertest/usbnet/qf9700.ko
make[1]: Leaving directory `/opt/linux-2.6.30.4'
结果在装载模块的时候无法装载。提示错误:
qf9700: Unknown symbol __bad_udelay
到内核代码里面去检查发现__bad_udelay这个函数是在arch的各个平台的asm目录下的delay.c里面。但是每个文件中都只有一个声明:
extern void __bad_udelay(void); /* deliberately undefined */
并没有具体的实现。
我试着在驱动源代码中添加头文件:
#include<asm/delay.h>
结果编译还是找不到__bad_udelay
也不知道是哪个文件中用到了这个函数报错。
由于代码有三个文件,贴上来不方便,我放到资源中心里了:
http://download.csdn.net/detail/guoke25/3827320
不知这种情况应该如何解决?
...全文
659 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
heyustudent 2012-02-15
  • 打赏
  • 举报
回复
udelay延时太长,凡是延时超过毫秒的都应该用msleep,否则就提示楼主所指示的错误
deep_pro 2011-11-24
  • 打赏
  • 举报
回复
还可以用ndelay
guoke25 2011-11-24
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 deep_pro 的回复:]

还可以用ndelay
[/Quote]
非常感谢!
guoke25 2011-11-24
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 deep_pro 的回复:]

还可以用ndelay
[/Quote]
这样啊?我去看看吧
guoke25 2011-11-22
  • 打赏
  • 举报
回复
精度不高,简单的加了个循环,解决了。再次感谢!
guoke25 2011-11-22
  • 打赏
  • 举报
回复
不过改掉udelay的参数真不知道会发生什么事情,现在对这个东西还是不太懂。。。无论如何还是感谢你
guoke25 2011-11-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 deep_pro 的回复:]

把__bad_udelay()替换成 udelay() 即可

/*
* This function intentionally does not exist; if you see references to
* it, it means that you're calling udelay() with an out of range value.
*
*……
[/Quote]
在你的提醒下终于看懂了!在驱动里面是有调用udelay的,结果调用的udelay参数太大,于是被故意设置为__bad_udelay(),内核编译太变态了。。。
deep_pro 2011-11-22
  • 打赏
  • 举报
回复
把__bad_udelay()替换成 udelay() 即可

/*
* This function intentionally does not exist; if you see references to
* it, it means that you're calling udelay() with an out of range value.
*
* With currently imposed limits, this means that we support a max delay
* of 2000us. Further limits: HZ<=1000 and bogomips<=3355
*/

4,434

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧