大佬教程收集整理的这篇文章主要介绍了linux – 引用内核模块中的console_loglevel错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) dump_my_message(dev,my_msg);
但是当在linux-next中构建这个代码时,它将抛出以下错误:
CHK include/generated/uapi/linux/version.h Kernel: arch/x86/boot/bzImage is ready (#2) Building modules,stage 2. MODPOST 2738 modules ERROR: "console_printk" [drivers/mymodule.ko] undefined! scripts/Makefile.modpost:91: recipe for target '__modpost' Failed make[1]: *** [__modpost] Error 1 Makefile:1117: recipe for target 'modules' Failed make: *** [modules] Error 2
你能帮忙找出如何使这项工作?谢谢!!!
但是,您真正应该使用的是Dynamic debug功能及其pr_debug()/ dev_dbg()函数.
基本上你需要的是确保你的内核中启用了CONfig_DYNAMIC_DEBUG,在你想要编写一些调试代码的所有地方使用dev_dbg(),然后动态启用你的调试消息,例如:
>要启用模块中的所有消息,请在insmod / modprobe调用结束时添加dyndbg = p.
>要有选择地仅启用某些消息,请使用文档中描述的查询语言.例如,要仅启用模块中函数foo()和bar()的消息,请使用:
insmod mymodule.ko dyndbg="func foo +p; func bar +p"
以上是大佬教程为你收集整理的linux – 引用内核模块中的console_loglevel错误全部内容,希望文章能够帮你解决linux – 引用内核模块中的console_loglevel错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。