您的位置:程序门 -> linux/unix社区 -> 内核及驱动程序研究区



insmod: error insertion "test.o" :-1 unknown symbol in module


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


insmod: error insertion 'test.o' :-1 unknown symbol in module
发表于:2007-06-01 17:01:07 楼主
问题,insmod   test.o时,出现了:
warning:   insmod.old:i   am   not   the   old   version!
insmod:   error   insertion   'test.o '   :-1   unknown   symbol   in   module
这个问题怎么解决啊,谢谢  

我的内核是从2.4升级到2.6的
发表于:2007-06-01 18:06:511楼 得分:0
你的模块是老版本的吧,有mod_inc之类的宏吧
发表于:2007-06-01 23:28:362楼 得分:0
#define   __no_version__  

#include   <linux/module.h>  
#include   <linux/config.h>  
#include   <linux/version.h>  

#include   <asm/uaccess.h>  

#include   <linux/types.h>  
#include   <linux/fs.h>  
#include   <linux/mm.h>  
#include   <linux/errno.h>  
#include   <asm/segment.h>  

unsigned   int   test_major   =   0;  

static   ssize_t   read_test(struct   file   *file,char   *buf,size_t   count,loff_t   *f_pos)  

{   int   left;  

if   (verify_area(verify_write,buf,count)   ==   -efault   )  
return   -efault;  

for(left   =   count   ;   left   >   0   ;   left--)  
{  
__put_user(1,buf);  
buf++;  
}  

return   count;  
}  


static   ssize_t   write_test(struct   file   *file,   const   char   *buf,   size_t   count,   loff_t   *f_pos)  
{  
return   count;  
}  

static   int   open_test(struct   inode   *inode,struct   file   *file   )  

{  
mod_inc_use_count;  
return   0;  
}  

static   int   release_test(struct   inode   *inode,struct   file   *file   )  
{  
mod_dec_use_count;  
return   0;  
}  


struct   file_operations   test_fops   =   {  
read:read_test,  
write:write_test,  
open:   open_test,  
release:release_test  
};  

int   init_module(void)  
{  
int   result;  
result   =   register_chrdev(0,   "test ",   &test_fops);  
if   (result   <   0)   {  
printk(kern_info   "test:   can 't   get   major   number\n ");  
return   result;  

}  

if   (test_major   ==   0)   test_major   =   result;   /*   dynamic   */  

return   0;  

}  


void   cleanup_module(void)  

{  

unregister_chrdev(test_major,   "test ");  

}  


module_license( "gpl ");  
module_author( "beckham ");  
上面是源程序,用写的makefile可以在2.4内核下通过编译,用2.6内核通不过,说有很多东西没有定义之类的.
大家帮我看一下有什么问题,谢谢!
发表于:2007-06-02 08:19:363楼 得分:0
warning:   insmod.old:i   am   not   the   old   version!
insmod:   error   insertion   'test.o '   :-1   unknown   symbol   in   module

要用insmod   test.ko
用ldd3上的makefile编译
发表于:2007-06-02 13:46:454楼 得分:0
我再试一下,呵呵
发表于:2007-06-02 13:47:405楼 得分:0
对了,我用2.6内核试了,不行,估计程序有问题还是怎么的
发表于:2007-06-03 13:58:446楼 得分:0
哪些东西没有定义啊?
发表于:2007-06-07 14:19:447楼 得分:0
在日志文件中有具体的原因,去看看吧!
发表于:2007-06-07 16:39:518楼 得分:0
在2.6中
mod_inc_use_count   mod_dec_use_count改为

try_module_get(&module);
module_put();
发表于:2007-06-07 17:16:219楼 得分:0
我都说了,   你的模块是老版本,   mod_inc这个宏只在2.4以前的版本有.
2.6   以后要改
发表于:2007-07-25 11:51:4510楼 得分:0
在后面加上linuxversion。h
发表于:2007-07-28 23:18:2211楼 得分:0
哈,我也碰到过这个问题,原因是由于某个函数的引用不对,需要指明正确的头文件。
我出问题的是copy_to_user
发表于:2007-07-31 18:16:1712楼 得分:0
__put_user
改为__copy_to_user_ll
/proc/kallsyms     察看内核的函数


快速检索

最新资讯
热门点击