Messages in this thread | | | Date | Sat, 21 Nov 2020 01:16:49 +0000 | Subject | [PATCH v1 0/2] Add support to capture external module's SCM version | From | Will McVicker <> |
| |
These two patches add module support to capture an external module's SCM version as a MODULE_INFO() attribute. This allows users to identity the SCM version of a given kernel module by using the modinfo tool or on the device via sysfs:
cat /sys/module/<module>/scmversion
It's important to note that the sysfs node is necessary in order to get the SCM version of modules that were loaded from the ramdisk in first stage init. I have updated scripts/setlocalversion to support this for git, mercurial, and subversion.
Here is the example output I used to test these patches with a simple module versioned with git, hg, and svn:
$ modinfo simple_module.ko | egrep 'scmversion|vermagic' scmversion: gbf35fd9b6412 vermagic: 5.10.0-rc4-00110-gd83461f36865 SMP mod_unload
$ modinfo simple_module.ko | egrep 'scmversion|vermagic' scmversion: hge5037af323b9 vermagic: 5.10.0-rc4-00110-gd83461f36865 SMP mod_unload
$ modinfo simple_module.ko | egrep 'scmversion|vermagic' scmversion: svn1 vermagic: 5.10.0-rc4-00110-gd83461f36865 SMP mod_unload
Will McVicker (2): scripts/setlocalversion: allow running in a subdir modules: add scmversion field
include/linux/module.h | 1 + kernel/module.c | 20 ++++++++++++++++++++ scripts/Makefile.modpost | 19 +++++++++++++++++-- scripts/mod/modpost.c | 28 +++++++++++++++++++++++++++- scripts/setlocalversion | 5 ++--- 5 files changed, 67 insertions(+), 6 deletions(-)
-- 2.29.2.454.gaff20da3a2-goog
| |