Execution method
insmod /module_version.ko cat /sys/modules/module_version/version
Tested this setting in the kernel 4.9.6.
version
version is given by the expression MODULE_VERSION . The file does not exist if MODULE_VERSION not specified.
srcversion
srcversion is an MD4 hash of the source code used to compile the kernel module. It is calculated automatically during build from https://github.com/torvalds/linux/blob/v4.9/scripts/mod/modpost.c#L1978 using https://github.com/torvalds/linux/blob/ v4.9 / scripts / mod / sumversion.c # L400
To enable it, follow these steps:
- set
MODULE_VERSION for the module - compile with
CONFIG_MODULE_SRCVERSION_ALL . srcversion then generated for all modules, including without MODULE_VERSION set: modinfo srcversion: How do I generate this from my source?
srcversion present only on job.
Then you can verify that the built-in .ko matches the built-in:
modinfo mymod.ko
This is a very useful health check when you develop your own kernel modules and copy modules between machines.
Ciro Santilli ๅ
ๅญ ้ฒ ๅฎช ๅ
ญๅ ไบไปถ ๆณ่ฝฎๅ
source share