当前位置: 技术问答>linux和unix
还是模块编程问题,unresolved symbol
来源: 互联网 发布时间:2015-07-02
本文导语: /*procfs.c a module programm*/ /* the program runing under kernel mod and it is a module*/ //#include //#include #define MODVERSIONS #include #include #include #include #define BUF_LEN 512 struct proc_dir_entry my_mod_proc_file={ 0, 9, "m...
/*procfs.c a module programm*/
/* the program runing under kernel mod and it is a module*/
//#include
//#include
#define MODVERSIONS
#include
#include
#include
#include
#define BUF_LEN 512
struct proc_dir_entry my_mod_proc_file={
0,
9,
"my_module",
S_IFREG | S_IRUGO,
1,
0,
0,
BUF_LEN,
NULL,
0,
NULL
};
/* the init function*/
int init_module() {
printk("hello world!n");
printk("I have runing in a kerner mode!!n");
printk("And now I add a file my_module to /devn");
return proc_register(&proc_root, &my_mod_proc_file);
}
/* the distory function*/
int cleanup_module(){
printk("The my_module file will be removedn");
printk("I will shut down myself in kernerl moden");
proc_unregister(&proc_root,my_mod_proc_file.low_ino);
return 0;
}
*****************************************************
Makefile:# a makefile for a module
CC=gcc
MODCFLAGS=-DMODULE -D__KERNEL__ -I/usr/src/linux-2.4/include
all:procfs.o
procfs.o:procfs.c Makefile
$(CC) $(MODCFLAGS) -c procfs.c
*******************************************************
procfs.o: unresolved symbol proc_register
procfs.o: unresolved symbol proc_unregister
procfs.o: unresolved symbol proc_root_R128619da
procfs.o:
Hint: You are trying to load a module without a GPL compatible license
and it has unresolved symbols. Contact the module supplier for
assistance, only they can help you.
/* the program runing under kernel mod and it is a module*/
//#include
//#include
#define MODVERSIONS
#include
#include
#include
#include
#define BUF_LEN 512
struct proc_dir_entry my_mod_proc_file={
0,
9,
"my_module",
S_IFREG | S_IRUGO,
1,
0,
0,
BUF_LEN,
NULL,
0,
NULL
};
/* the init function*/
int init_module() {
printk("hello world!n");
printk("I have runing in a kerner mode!!n");
printk("And now I add a file my_module to /devn");
return proc_register(&proc_root, &my_mod_proc_file);
}
/* the distory function*/
int cleanup_module(){
printk("The my_module file will be removedn");
printk("I will shut down myself in kernerl moden");
proc_unregister(&proc_root,my_mod_proc_file.low_ino);
return 0;
}
*****************************************************
Makefile:# a makefile for a module
CC=gcc
MODCFLAGS=-DMODULE -D__KERNEL__ -I/usr/src/linux-2.4/include
all:procfs.o
procfs.o:procfs.c Makefile
$(CC) $(MODCFLAGS) -c procfs.c
*******************************************************
procfs.o: unresolved symbol proc_register
procfs.o: unresolved symbol proc_unregister
procfs.o: unresolved symbol proc_root_R128619da
procfs.o:
Hint: You are trying to load a module without a GPL compatible license
and it has unresolved symbols. Contact the module supplier for
assistance, only they can help you.
|
去掉#define MODVERSIONS,再试试
|
http://www.spinics.net/lists/newbies/msg07329.html
|
你看看Hints,写的很明白
|
up
|
关注中。。。