简体   繁体   English

< insmod:错误:无法插入模块 GSM.ko:模块中的未知符号。 > 如何解决?

[英]< insmod: ERROR: could not insert module GSM.ko: Unknown symbol in module. > How to fix it?

I have written a simple loadable kernel module.我编写了一个简单的可加载 kernel 模块。 To create a character device file in /dev/ and a related class directory.在 /dev/ 和相关的 class 目录中创建字符设备文件。 The following lines I have added in the project.我在项目中添加了以下几行。

MODULE_DESCRIPTION("GSM driver");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Guruprasad");
MODULE_DESCRIPTION("A simple driver");
MODULE_VERSION("0.1");

While building I got the following warning在构建时,我收到以下警告

WARNING: modpost: missing MODULE_LICENSE() in /home/.../char_dev_gsm/GSM.o

While inserting I got the following error:插入时出现以下错误:

insmod: ERROR: could not insert module GSM.ko: Unknown symbol in module

Please help me with this.请帮我解决一下这个。

The project has one main file (GSM.c) and an include file (device.c and device.h)该项目有一个主文件 (GSM.c) 和一个包含文件 (device.c 和 device.h)

Please get the files from the following link.请从以下链接获取文件。 https://github.com/guruprasad-92/Device-Driver https://github.com/guruprasad-92/Device-Driver

I've tried with adding the line MODULE_LICENSE("Dual BSD/GPL");我尝试添加MODULE_LICENSE("Dual BSD/GPL"); in file device.c which results no warning messages and no error messages as well, but while inserting the module it neither creates the device file /dev/gsm0 nor updating the $dmesg with printk() related messages.在文件 device.c 中,这不会导致警告消息和错误消息,但是在插入模块时,它既不会创建设备文件/dev/gsm0 ,也不会使用printk()相关消息更新$dmesg

I have also tried with writing the functions register_dev() and unregister_dev() in the file GSM.c which did not results any warning, and created the the device /dev/gsm0 and class directory in /sys/class/我还尝试在文件 GSM.c 中编写函数register_dev()unregister_dev() ,但没有产生任何警告,并在 /sys/class/ 中创建了设备/dev/gsm0和 class 目录

But I want to know why the file inclusion is giving warning while building.但我想知道为什么文件包含在构建时会发出警告。

The main problem is that the module is GSM.ko is built from multiple.c files (GSM.c and device.c), and the basename of the module is the same as the basename of one of the.c files (which is only allowed when the module is built from a single.c file). The main problem is that the module is GSM.ko is built from multiple.c files (GSM.c and device.c), and the basename of the module is the same as the basename of one of the.c files (which is仅当模块从单个.c 文件构建时才允许)。

To fix it, you can rename GSM.c to (for example) gsm.c and change the GSM-objs line in the Makefile:要修复它,您可以将 GSM.c 重命名为(例如)gsm.c 并更改 ZB67911656EF5D18C4AE36CB6741B7 中的GSM-objs objs 行

obj-m := GSM.o
GSM-objs = gsm.o device.o

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 insmod:错误:无法插入模块rtl8723be.ko:模块中的未知符号 - insmod: ERROR: could not insert module rtl8723be.ko: Unknown symbol in module OpenOnload 驱动程序错误“insmod:错误:无法插入模块.......模块中的未知符号” - OpenOnload driver error "insmod: ERROR: could not insert module........Unknown symbol in module" insmod:错误:无法插入模块 kernel.ko:无效参数 - 与内核模块命名方案相关的错误 - insmod: ERROR: could not insert module kernel.ko: Invalid parameters - Error related to naming scheme of kernel module 使用insmod时出错“无法插入模块hello_world.ko:模块格式无效” - Error using insmod “Could not insert module hello_world.ko: Invalid module format” Insmod:模块问题中的未知符号 - Insmod: Unknown symbol in module issue insmod:错误:无法插入模块kprobe_example.ko:不允许的操作 - insmod: ERROR: could not insert module kprobe_example.ko: Operation not permitted insmod 失败并显示“模块中的未知符号” - insmod fails with “Unknown symbol in module” insmod:错误:无法插入模块:没有这样的设备 - insmod: ERROR: Could not insert module : No such device 对于另一个模块中定义的符号,insmod 失败并显示“模块中的未知符号” - insmod fails with "Unknown symbol in module" for a symbol defined in another module modprobe/insmod - 错误:无法插入模块 操作不允许以 root 权限安装 kernel 空间模块 - modprobe/insmod - ERROR: could not insert module Operation not permitted installing a kernel space module with root privileges
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM