使用未定义的i2c_register_board_info警告构建Linux内核模块 [英] Build Linux Kernel module with warning i2c_register_board_info undefined

查看:403
本文介绍了使用未定义的i2c_register_board_info警告构建Linux内核模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循 kernel.org 中的示例来编写i2c驱动程序,但不幸的是,当我编译时,收到此警告

I follow an example in kernel.org to write an i2c driver but unfortunately when i compile i got this warning

警告:"[i2c_register_board_info]" [/home/pi/builddriver/samplei2c/pn535.ko]未定义!

WARNING: "i2c_register_board_info" [/home/pi/builddriver/samplei2c/pn535.ko] undefined!

尽管编译时出现1条警告且没有错误,但是我无法insmod模块.这是insmod时的错误

Although compile with 1 warning and no error, I cannot insmod module. this is error when insmod

insmod:错误:无法插入模块pn535.ko:无效的模块格式

insmod: ERROR: could not insert module pn535.ko: Invalid module format

我的问题是如何解决以上警告?,我认为它使.ko文件无效.这是我的源代码 pastebin

My question is how to solve the warning above?, I think it make .ko file to be invalid. Here is my source code on pastebin

感谢您的帮助!

推荐答案

在内核模块中这是不可能的,因为仅i2c_register_board_info函数没有从内核源树导出到内核模块(使用obj-m targets构建) ).您可以通过使用(obj-y targets)在内核源代码树中构建驱动程序来实现.

That is not possible in a kernel module simply because the function i2c_register_board_info is not exported from the kernel source tree to the kernel modules (built using obj-m targets). You can achieve this by building your driver within the kernel source tree using (obj-y targets).

这篇关于使用未定义的i2c_register_board_info警告构建Linux内核模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆