主题 : insmod mini6410_leds.ko 失败,用的友善的源程序 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 59279
精华: 0
发帖: 84
金钱: 430 两
威望: 86 点
综合积分: 168 分
注册时间: 2011-11-22
最后登录: 2012-12-04
楼主  发表于: 2012-07-20 09:21

 insmod mini6410_leds.ko 失败,用的友善的源程序

    用的友善的源程序mini6410_leds.c  ,编译成mini6410_leds.ko 后拷到开发板中 ,却加载失败。(ls查看根目录下确实有mini6410_leds.ko)
超级终端中回显如下:
/ #  
/ # insmod mini6410_leds.ko                          
------------[ cut here ]------------                                    
WARNING: at fs/sysfs/dir.c:451 sysfs_add_one+0x64/0x8c()                                                        
sysfs: cannot create duplicate filename '/devices/virtual/misc/leds'                                                                    
Modules linked in: mini6410_leds(+) zd1211rw rt2800usb rt2800lib rt73usb rt2x00u                                                                                
sb rt2x00lib ath9k_htc ath9k_common mac80211 ath9k_hw ath libertas_sdio libertas                                                                                
cfg80211 compat                
[<c016a9a4>] (unwind_backtrace+0x0/0xe4) from [<c017f51c>] (warn_slowpath_common                                                                                
+0x4c/0x64)          
one_wire_status: 3                  
[<c017f51c>] (warn_slowpath_common+0x4c/0x64) from [<c017f5b4>] (warn_slowpath_f                                                                                
mt+0x2c/0x3c)            
[<c017f5b4>] (warn_slowpath_fmt+0x2c/0x3c) from [<c023148c>] (sysfs_add_one+0x64                                                                                
/0x8c)      
one_wire_status: 4                  
[<c023148c>] (sysfs_add_one+0x64/0x8c) from [<c0231510>] (create_dir+0x5c/0xac)                                                                              
[<c0231510>] (create_dir+0x5c/0xac) from [<c0231638>] (sysfs_create_dir+0xb8/0xe                                                                                
0)  
[<c0231638>] (sysfs_create_dir+0xb8/0xe0) from [<c02d73fc>] (kobject_add_interna                                                                                
l+0xec/0x1c8)            
one_wire_status: 4                  
[<c02d73fc>] (kobject_add_internal+0xec/0x1c8) from [<c02d77ac>] (kobject_add+0x                                                                                
68/0x8c)        
[<c02d77ac>] (kobject_add+0x68/0x8c) from [                                        
one_wire_status: 4                  
[<c03196e4>] (device_add+0xac/0x4a4) from [<c0319b64>] (device_create_vargs+0x70                                                                                
/0xb8)      
[<c0319b64>] (device_create_vargs+0x70/0xb8) from [<c0319bc8>] (device_create+0x                                                                                
1c/0x24)        
one_wire_status: 4                  
[<c0319bc8>] (device_create+0x1c/0x24) from [<c030711c>] (misc_register+0xbc/0x1                                                                                
28)  
[<c030711c>] (misc_register+0xbc/0x128) from [<bf16b044>] (dev_init+0x44/0x64 [m                                                                                
ini6410_leds])              
[<bf16b044>] (dev_init+0x44/0x64 [mini6410_leds]) from [<c01654fc>] (do_one_init                                                                                
call+0xbc/0x190)                
one_wire_status: 4                  
[<c01654fc>] (do_one_initcall+0xbc/0x190) from [<c01acfe8>] (sys_init_module+0x1                                                                                
598/0x1760)          
[<c01acfe8>] (sys_init_module+0x1598/0x1760) from [<c0165e60>] (ret_fast_syscall                                                                                
+0x0/0x30)          
one_wire_status: 4                  
---[ end trace 5273fb0808d6e10c ]---                                    
kobject_add_internal failed for leds with -EEXIST, don't try to register things                                                                              
with the same name in the same directory.                                        
one_wire_status: 4                  
[<c016a9a4>] (unwind_backtrace+0x0/0xe4) from [<c02d7498>] (kobject_add_internal                                                                                
+0x188/0x1c8)            
[<c02d7498>] (kobject_add_internal+0x188/                                      
x68/0x8c)        
[<c02d77ac>] (kobject_add+0x68/0x8c) from [<c03196e4>] (device_add+0xac/0x4a4)  
one_wire_status: 4
[<c03196e4>] (device_add+0xac/0x4a4) from [<c0319b64>] (device_create_vargs+0x70
/0xb8)
[<c0319b64>] (device_create_vargs+0x70/0xb8) from [<c0319bc8>] (device_create+0x
1c/0x24)
one_wire_status: 4
[<c0319bc8>] (device_create+0x1c/0x24) from [<c030711c>] (misc_register+0xbc/0x1
28)
[<c030711c>] (misc_register+0xbc/0x128) from [<bf16b044>] (dev_init+0x44/0x64 [m
ini6410_leds])
one_wire_status: 4
[<bf16b044>] (dev_init+0x44/0x64 [mini6410_leds]) from [<c01654fc>] (do_one_init
call+0xbc/0x190)
[<c01654fc>] (do_one_initcall+0xbc/0x190) from [<c01acfe8>] (sys_init_module+0x1
598/0x1760)
[<c01acfe8>] (sys_init_module+0x1598/0x1760) from [<c0165e60>] (ret_fast_syscall
+0x0/0x30)
one_wire_status: 4
leds    initialized
insmod: init_module 'mini6410_leds.ko' failed (File exists)
/ #


请问这是怎么回事?哪里出错了,我该怎么解决?谢谢哈
^很多问题的背后都是简单的原因......
级别: 荣誉会员
UID: 34780
精华: 0
发帖: 1219
金钱: 6230 两
威望: 1246 点
综合积分: 2438 分
注册时间: 2010-12-21
最后登录: 2017-09-18
1楼  发表于: 2012-07-20 09:52
sysfs: cannot create duplicate filename '/devices/virtual/misc/leds'
...
insmod: init_module 'mini6410_leds.ko' failed (File exists)

这2行已明确表明驱动已经存在了
级别: 侠客
UID: 59279
精华: 0
发帖: 84
金钱: 430 两
威望: 86 点
综合积分: 168 分
注册时间: 2011-11-22
最后登录: 2012-12-04
2楼  发表于: 2012-07-20 10:09

 回 1楼(911gt3) 的帖子

    哦,刚才我超级终端中查看了一下,没有看到 '/devices/virtual/misc/leds' 这些,还以为是因为系统不能生成,就自己建了这些文件夹,又试了一遍,结果还是上面那些回显……又没有成功
    
    但卸载却又卸不了,回显如下:    
/ #
/ # rmmod mini6410_leds
rmmod: delete_module 'mini6410_leds' failed (errno 2)
/ #

    刚刚开始学驱动,想从LED入手,谢谢哈~~~
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2012-07-20 10:39

 回 2楼(蔚蓝梦想) 的帖子

如果你用的是光盘上提供的内核镜像,那里面已经包含了led驱动,你不能再加载同样的驱动模块;
如果你希望用模块的方式加载mini6410_leds驱动,你可以重新配置内核源代码,将Device Drivers->Character devices->LED Support for Mini6410 GPIO LEDs选项配置成<M>, 重新编译内核镜像和模块。更新内核镜像后再加载生成的mini6410_leds.ko
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 侠客
UID: 59279
精华: 0
发帖: 84
金钱: 430 两
威望: 86 点
综合积分: 168 分
注册时间: 2011-11-22
最后登录: 2012-12-04
4楼  发表于: 2012-07-20 11:02

 回 3楼(kasim) 的帖子

    谢谢版主哈,我是这么做的,不过就遇到了上面的问题……
    
    选成<M>后保存退出后,我进入系统源码根目录,执行make zImage 生成系统内核,然后在源码根目录执行make modules,在drivers/char 目录下得到了mini6410_leds.ko  ,然后将mini6410_leds.ko 拷贝到Tiny6410 开发板上, 执行insmod mini6410_leds.ko 加载驱动 ,就出现了我最初说的那个问题……

    然后就不知道问题出在哪了,感觉前面做的没出什么问题,就insmod 这块出问题了
谢谢版主~~~
^很多问题的背后都是简单的原因......
级别: 荣誉会员
UID: 34780
精华: 0
发帖: 1219
金钱: 6230 两
威望: 1246 点
综合积分: 2438 分
注册时间: 2010-12-21
最后登录: 2017-09-18
5楼  发表于: 2012-07-20 11:10
你必须把新编译的不包含led驱动的内核烧写到板上
级别: 侠客
UID: 59279
精华: 0
发帖: 84
金钱: 430 两
威望: 86 点
综合积分: 168 分
注册时间: 2011-11-22
最后登录: 2012-12-04
6楼  发表于: 2012-07-23 14:57
我把原先的内核删了,把新生成的烧进开发板,还是无法加载这个led模块
lsmod看了一下,一模一样啊
把自己烧成的mini6410_leds.ko改名为leds.ko再insmod,也不行,lsmod也是和之前的一模一样

以下为lsmod的内容:
/ # lsmod
zd1211rw 46213 0 - Live 0xbf153000
rt2800usb 9954 0 - Live 0xbf149000
rt2800lib 35186 1 rt2800usb, Live 0xbf13a000
rt73usb 21772 0 - Live 0xbf12e000
rt2x00usb 8635 2 rt2800usb,rt73usb, Live 0xbf125000
rt2x00lib 31382 4 rt2800usb,rt2800lib,rt73usb,rt2x00usb, Live 0xbf115000
ath9k_htc 44551 0 - Live 0xbf102000
ath9k_common 2367 1 ath9k_htc, Live 0xbf0fc000
mac80211 208445 5 zd1211rw,rt2800lib,rt2x00usb,rt2x00lib,ath9k_htc, Live 0xbf0b8
000
ath9k_hw 288834 2 ath9k_htc,ath9k_common, Live 0xbf063000
ath 14379 2 ath9k_htc,ath9k_hw, Live 0xbf05a000
libertas_sdio 8363 0 - Live 0xbf051000
libertas 59273 1 libertas_sdio, Live 0xbf039000
cfg80211 141956 6 zd1211rw,rt2x00lib,ath9k_htc,mac80211,ath,libertas, Live 0xbf0
08000
compat 5282 2 mac80211,cfg80211, Live 0xbf000000
/ #

谢谢啊~~~
级别: 侠客
UID: 59279
精华: 0
发帖: 84
金钱: 430 两
威望: 86 点
综合积分: 168 分
注册时间: 2011-11-22
最后登录: 2012-12-04
7楼  发表于: 2012-07-23 15:55

 回 5楼(911gt3) 的帖子

我把原先的内核删了,把新生成的烧进开发板,还是无法加载这个led模块
lsmod看了一下,一模一样啊
把自己烧成的mini6410_leds.ko改名为leds.ko再insmod,也不行,lsmod也是和之前的一模一样

以下为lsmod的内容:
/ # lsmod
zd1211rw 46213 0 - Live 0xbf153000
rt2800usb 9954 0 - Live 0xbf149000
rt2800lib 35186 1 rt2800usb, Live 0xbf13a000
rt73usb 21772 0 - Live 0xbf12e000
rt2x00usb 8635 2 rt2800usb,rt73usb, Live 0xbf125000
rt2x00lib 31382 4 rt2800usb,rt2800lib,rt73usb,rt2x00usb, Live 0xbf115000
ath9k_htc 44551 0 - Live 0xbf102000
ath9k_common 2367 1 ath9k_htc, Live 0xbf0fc000
mac80211 208445 5 zd1211rw,rt2800lib,rt2x00usb,rt2x00lib,ath9k_htc, Live 0xbf0b8
000
ath9k_hw 288834 2 ath9k_htc,ath9k_common, Live 0xbf063000
ath 14379 2 ath9k_htc,ath9k_hw, Live 0xbf05a000
libertas_sdio 8363 0 - Live 0xbf051000
libertas 59273 1 libertas_sdio, Live 0xbf039000
cfg80211 141956 6 zd1211rw,rt2x00lib,ath9k_htc,mac80211,ath,libertas, Live 0xbf0
08000
compat 5282 2 mac80211,cfg80211, Live 0xbf000000
/ #

谢谢啊~~~
级别: 新手上路
UID: 114812
精华: 0
发帖: 2
金钱: 10 两
威望: 2 点
综合积分: 4 分
注册时间: 2015-04-25
最后登录: 2016-09-22
8楼  发表于: 2015-09-08 23:39
怎么后面又没人回答了!?