Modinfo srcversion: How do I create this from my source?

I have a compiled version of the Linux module, and then I have about 20+ variants of its source. Through various stupid errors, I lost information about which version of the source was the actual one that I used to create the module.

I noticed that modinfo <module name> gives srcversion: <hash> , and somewhere I found some explanation that says "the sum of the source that created the module". It sounds perfect!

What should I do with my module sources to create this hash?

+5
module linux-kernel
source share
1 answer

srcversion defined by scripts/mod/modpost . I do not know the exact parameters that you need to provide modpost so that it displays this field. It should be something like scripts/mod/modpost -a -m vmlinux you_module.o (you can see scripts/Makefile.modpost for exact options). The output is then available in drivers/path/to/your_module.mod.c

I recommend that you set config MODULE_SRCVERSION_ALL to y (available in the Enable loadable module support submenu) so that srcversion is automatically created for all modules in your assembly. Then you can switch between the source options, rebuild your kernel with the new source version (only after you built the module only after it was built), and then directly look in the MODULE_INFO(srcversion, "<hash>"); field MODULE_INFO(srcversion, "<hash>"); at the end of your drivers/path/to/your_module.mod.c to search for the requested information.

+7
source share

All Articles