views:

44

answers:

1

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.

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?

+2  A: 

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

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.

Longfield