kernel version detection in module build
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Fix Released
|
Low
|
Andy Whitcroft | ||
Lucid |
Won't Fix
|
Low
|
Unassigned | ||
Precise |
Won't Fix
|
Low
|
Unassigned | ||
Trusty |
Fix Released
|
Low
|
Unassigned | ||
Utopic |
Fix Released
|
Low
|
Andy Whitcroft |
Bug Description
When building an external kernel module against an Ubuntu kernel it would help to be able to include some special code for some specific Ubuntu kernel version.
I want to ship a kernel module in source code which the user should be able to compile against mainline kernels and various distribution kernels like the Ubuntu kernel, it would help if there is some way to identify the version of the Ubuntu kernel.
To identify the kernel version it creates a file in include/
#if LINUX_VERSION_CODE >= KERNEL_
/* some code */
#else
/* some code */
#endif
The problem is that your kernel is not 100% API compatible with the mainline kernel and in some cases such a detection is also needed based on the Ubuntu kernel version used.
RedHat extended this file with some version information about the RHEL kernel in use:
#define LINUX_VERSION_CODE 132640
#define KERNEL_
#define RHEL_MAJOR 6
#define RHEL_MINOR 5
#define RHEL_RELEASE_
#define RHEL_RELEASE_CODE 1541
#define RHEL_RELEASE "430"
I would like to see something like this also in the Ubuntu kernel (e.g. 3.13.0-27-generic) and in the long term kernel versions (e.g. 3.13.11.2) provided by Canonical.
My current problem is that I do not know if the kernel I am compiling against has this backport in or not:
http://
Adding some version to the kernel will help the backports project. https:/
This problem effects at least trusty, but probably all versions, having such a feature in Debian would also be nice, but I have not checked. SLES already has a similar feature.
Changed in linux (Ubuntu Trusty): | |
status: | New → In Progress |
tags: | added: patch |
Changed in linux (Ubuntu Trusty): | |
importance: | Undecided → Low |
Changed in linux (Ubuntu Precise): | |
importance: | Undecided → Low |
Changed in linux (Ubuntu Lucid): | |
importance: | Undecided → Low |
tags: | removed: verification-needed-trusty |
This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:
apport-collect 1327619
and then change the status of the bug to 'Confirmed'.
If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.
This change has been made by an automated script, maintained by the Ubuntu Kernel Team.