modinfo srcversion:如何从源代码生成此信息? [英] modinfo srcversion: How do I generate this from my source?

查看:246
本文介绍了modinfo srcversion:如何从源代码生成此信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个linux模块的编译版本,然后我有大约20多种版本的源代码.由于各种愚蠢的错误,我忘记了使用哪个版本的源代码才是制作模块的实际版本.

I have a compiled version of a linux module, and then I have about 20+ variations of its source. Through various foolish mistakes, I've lost track of which version of the source was the actual one I used to make the module.

我注意到modinfo <module name>给出了srcversion: <hash>,我在某处找到了一些解释,说它是产生模块的源之和".听起来很完美!

I noticed that modinfo <module name> gives srcversion: <hash>, and I found some explanation somewhere that says its the "Sum of the source that produced the module". Sounds perfect!

我该如何处理模块源以生成此哈希?

What do I do to my module sources to produce this hash?

推荐答案

srcversionscripts/mod/modpost程序定义.我不知道您必须为modpost提供确切的选项,以便它输出此字段.它必须类似于scripts/mod/modpost -a -m vmlinux you_module.o(您可以在scripts/Makefile.modpost中找到确切的选项).然后,输出在drivers/path/to/your_module.mod.c

The srcversion is defined by the scripts/mod/modpost program. I don't know the exact options that you have to give to modpost so that it outputs this field. It must be something similar to scripts/mod/modpost -a -m vmlinux you_module.o (you can look at scripts/Makefile.modpost for the exact options). The output is then available in drivers/path/to/your_module.mod.c

我建议您将config MODULE_SRCVERSION_ALL设置为y(在Enable loadable module support子菜单中可用),以便为构建的所有模块自动生成srcversion.然后,您可以在源代码的变体之间进行切换,使用新的源代码变体重建内核(在第一次构建后仅应重新构建模块),然后直接查看drivers/path/to/your_module.mod.c文件末尾的MODULE_INFO(srcversion, "<hash>");字段.查找所需的信息.

I recommend that you set the config MODULE_SRCVERSION_ALL to y (available in the Enable loadable module support submenu), so that srcversion is automatically produced for all the modules of your build. You can then switch between you variations of the source, rebuild your kernel with the new source variation (only your module should be rebuilt after the first build) and then directly look at the MODULE_INFO(srcversion, "<hash>"); field at the end of your drivers/path/to/your_module.mod.c file to find the requested info.

这篇关于modinfo srcversion:如何从源代码生成此信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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