加载驱动模块时Device or resource busy的解决方法

加载驱动模块时Device or resource busy的解决方法

加载驱动模块时Device or resource busy的解决方法

加载驱动模块时Device or resource busy的解决方法
insmod或modprobe驱动模块时Device or resource busy的解决方法

在编译好memdev驱动模块后,通过insmod加载模块时发现以下错误提示
#insmod memdev.ko
insmod: error inserting 'memdev.ko': -1 Device or resource busy

这种情况一般都是驱动的设备号已经被系统使用了。
我回头查看memdev模块的主设备号,我定义的是254,然后查看系统设备列表。
#cat /proc/devices
Character devices:
1 mem
2 pty
3 ttyp
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
6 lp
7 vcs
10 misc
13 input
21 sg
29 fb
128 ptm
136 pts
180 usb
189 usb_device
254 vmci

Block devices:
1 ramdisk
2 fd
7 loop
8 sd
9 md
22 ide1
65 sd
66 sd
67 sd
68 sd
69 sd
70 sd
71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
253 device-mapper
254 mdp

此时发现字符设别驱动的254已经被使用了。

解决方法:更换一个上表未使用的的主设备号,或者直接让系统自动分配。
-----------------------------------------------------------------------------------------

另外值得注意的是,编译内核模块的时候,必须有一个已经配置好并编译过的内核源代码树。否则会出现以下错误:
Building modules, stage 2.
/xxx/linux-2.6.29/scripts/Makefile.modpost:43: include/config/auto.conf: No such file or directory
make[2]: *** No rule to make target 'include/config/auto.conf'.
make[1]: *** [modules] Error 2
make[1]: Leaving directory '/xxx/linux-2.6.29'
make: *** [all] Error 2

解决方法:先配置编译内核源代码树,然后再编译内核模块或者驱动模块。

免责声明:本网信息来自于互联网,目的在于传递更多信息,并不代表本网赞同其观点。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,并请自行核实相关内容。本站不承担此类作品侵权行为的直接责任及连带责任。如若本网有任何内容侵犯您的权益,请及时联系我们,本站将会在24小时内处理完毕。
相关文章
返回顶部