From: Attached is the patch (developed by Hannu Savolainen) that adds /proc/sys/kernel/vermagic to the kernel. This is required so that packages which ship precompiled modules can select the appropriate module for the current kernel. Apparently vendors tend to not install the kernel-source package by default so this info is otherwise hard to obtain. --- 25-akpm/include/linux/sysctl.h | 1 + 25-akpm/include/linux/vermagic.h | 2 ++ 25-akpm/kernel/module.c | 2 +- 25-akpm/kernel/sysctl.c | 10 ++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff -puN include/linux/sysctl.h~proc-sys-kernel-vermagic include/linux/sysctl.h --- 25/include/linux/sysctl.h~proc-sys-kernel-vermagic 2004-05-03 20:12:50.710928616 -0700 +++ 25-akpm/include/linux/sysctl.h 2004-05-03 20:12:50.718927400 -0700 @@ -133,6 +133,7 @@ enum KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */ KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */ KERN_HZ_TIMER=65, /* int: hz timer on or off */ + KERN_VERMAGIC=66, /* string: compile time info */ }; diff -puN include/linux/vermagic.h~proc-sys-kernel-vermagic include/linux/vermagic.h --- 25/include/linux/vermagic.h~proc-sys-kernel-vermagic 2004-05-03 20:12:50.711928464 -0700 +++ 25-akpm/include/linux/vermagic.h 2004-05-03 20:12:50.718927400 -0700 @@ -21,3 +21,5 @@ MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ MODULE_ARCH_VERMAGIC \ "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) + +extern const char vermagic[]; diff -puN kernel/module.c~proc-sys-kernel-vermagic kernel/module.c --- 25/kernel/module.c~proc-sys-kernel-vermagic 2004-05-03 20:12:50.713928160 -0700 +++ 25-akpm/kernel/module.c 2004-05-03 20:12:50.720927096 -0700 @@ -836,7 +836,7 @@ static int obsolete_params(const char *n } #endif /* CONFIG_OBSOLETE_MODPARM */ -static const char vermagic[] = VERMAGIC_STRING; +const char vermagic[] = VERMAGIC_STRING; #ifdef CONFIG_MODVERSIONS static int check_version(Elf_Shdr *sechdrs, diff -puN kernel/sysctl.c~proc-sys-kernel-vermagic kernel/sysctl.c --- 25/kernel/sysctl.c~proc-sys-kernel-vermagic 2004-05-03 20:12:50.714928008 -0700 +++ 25-akpm/kernel/sysctl.c 2004-05-03 20:13:57.171825024 -0700 @@ -40,6 +40,7 @@ #include #include #include +#include #ifdef CONFIG_ROOT_NFS #include @@ -636,6 +637,15 @@ static ctl_table kern_table[] = { .mode = 0444, .proc_handler = &proc_dointvec, }, + { + .ctl_name = KERN_VERMAGIC, + .procname = "vermagic", + .data = (char *)vermagic, + .maxlen = 100, + .mode = 0444, + .proc_handler = &proc_doutsstring, + .strategy = &sysctl_string, + }, { .ctl_name = 0 } }; _