问题描述
我正在尝试从多个源文件编译内核模块。使用 make 时,出现以下错误,
make -C /lib/modules/5.4.0-47-generic/build M=/path_to_source_file modules
...
LD [M] /path_to_source_file/test.o
Building modules,stage 2.
MODPOST 1 modules
ERROR: "__udivti3" [/path_to_source_file/test.ko] undefined!
scripts/Makefile.modpost:93: recipe for target '__modpost' failed
make[2]: *** [__modpost] Error 1
我猜测问题出在我的 Makefile 。这是我正在使用的 Makefile ,
obj-m += test.o
test-objs := rtmModule.o aes.o bignum.o rsa.o memset1.o memory.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
sudo insmod test.ko
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
sudo rmmod test.ko
我的简单模块源代码 rtmModule.c 是
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/random.h>
#include <linux/string.h>
#include "cacheCryptoMain.h"
#include "config.h"
#include "aes.h"
#include "bignum.h"
#include "rsa.h"
MODULE_AUTHOR("XXX");
MODULE_DESCRIPTION("kernel");
MODULE_LICENSE("GPL");
static int __init hello_init(void) {
printk(KERN_INFO "Module Loaded!\n");
return 0;
}
static void __exit hello_cleanup(void) {
printk(KERN_INFO "Cleaning up module.\n");
}
module_init(hello_init);
module_exit(hello_cleanup);
正如我的源代码所示,我只是将一些其他源文件包含到主模块源代码文件中。就像我说的那样,我最好的猜测是问题在于 Makefile ,我只是想不出如何解决它。有帮助吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)