I recently picked up a copy of SuSE 9.0 Professional. I have never used or been familiar with a SuSE product before as I've only used Mandrake, Red Hat, and a bit of Debian. After using Red Hat for a while I decided to evaluate SuSE and I am now sorry for not having tried it sooner.
Permalink for comment
To read all comments associated with this story, please click here.
No preprocessor magic, no nothing. UTS_RELEASE always is set to the static value of 2.4.20-4GB. Oops.
BTW, before you say "But you should be looking in /lib/modules/`uname -r`/build/include for the header files!", I should point out that in SUSE, "/lib/modules/`uname -r`/build" is a symbolic link to /usr/src/linux-2.4.20.SuSE/. In Red Hat, the files in "/lib/modules/`uname -r`/build/include/linux" and /usr/src/linux-2.4.22-1.2115.nptl/include/linux/ happen to be the same.
That can't be correct, otherwise insmod would never complain about kernel version mismatches.
BTW, I take it back about me being wrong about SUSE screwing up. I found the problem.
Here's where Red Hat and SUSE stamp the module with the kernel version:
Lines 305-307 in /usr/src/linux-2.4.22-1.2115.nptl/include/linux/module.h from Red Hat:
305 #include <linux/version.h>
306 static const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
307 "kernel_version=" UTS_RELEASE;
Lines 299-301 in /usr/src/linux-2.4.20.SuSE/include/linux/module.h from SuSE:
299 #include <linux/version.h>
300 static const char __module_kernel_version[] __attribute__((unused, __section__(".modinfo"))) =
301 "kernel_version=" UTS_RELEASE;
Both use as the value for the kernel version the preprocessor macro UTS_RELEASE, which is defined in linux/version.h.
The /usr/src/linux-2.4.22-1.2115.nptl/include/linux/version.h from Red Hat:
#include <linux/rhconfig.h>
#if defined(__module__smp)
#define UTS_RELEASE "2.4.22-1.2115.nptlsmp"
#elif defined(__module__BOOT)
#define UTS_RELEASE "2.4.22-1.2115.nptlBOOT"
#elif defined(__module__bigmem)
#define UTS_RELEASE "2.4.22-1.2115.nptlbigmem"
#else
#define UTS_RELEASE "2.4.22-1.2115.nptl"
#endif
#define LINUX_VERSION_CODE 132118
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
Red Hat uses some #ifdefs to ensure that the value of UTS_RELEASE actually matches the value of "uname -r".
The /usr/src/linux-2.4.20.SuSE/include/linux/version.h from SUSE:
#define UTS_RELEASE "2.4.20-4GB"
#define LINUX_VERSION_CODE 132116
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
No preprocessor magic, no nothing. UTS_RELEASE always is set to the static value of 2.4.20-4GB. Oops.
BTW, before you say "But you should be looking in /lib/modules/`uname -r`/build/include for the header files!", I should point out that in SUSE, "/lib/modules/`uname -r`/build" is a symbolic link to /usr/src/linux-2.4.20.SuSE/. In Red Hat, the files in "/lib/modules/`uname -r`/build/include/linux" and /usr/src/linux-2.4.22-1.2115.nptl/include/linux/ happen to be the same.