mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
MODULE_VERSION and srcversion
This commit is contained in:
28
kernel_module/module_version.c
Normal file
28
kernel_module/module_version.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
https://stackoverflow.com/questions/4839024/how-to-find-the-version-of-a-compiled-kernel-module/42556565#42556565
|
||||
|
||||
insmod /module_version.ko
|
||||
cat /sys/modules/module_version/version
|
||||
# => 1.0
|
||||
cat /sys/module/module_version/srcversion
|
||||
# => AB0F06618BC3A36B687CDC5
|
||||
modinfo /module_version.ko | grep -E '^(src|)version'
|
||||
# => version: 1.0
|
||||
# => srcversion: AB0F06618BC3A36B687CDC5
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
static int myinit(void)
|
||||
{
|
||||
pr_info(__FILE__ "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void myexit(void) {}
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_VERSION("1.0");
|
||||
MODULE_LICENSE("GPL");
|
||||
Reference in New Issue
Block a user