← Back to team overview

kernel-packages team mailing list archive

[Bug 1327619] Re: kernel version detection in module build

 

lucid has seen the end of its life and is no longer receiving any
updates. Marking the lucid task for this ticket as "Won't Fix".

** Changed in: linux (Ubuntu Lucid)
       Status: New => Won't Fix

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1327619

Title:
  kernel version detection in module build

Status in linux package in Ubuntu:
  Fix Released
Status in linux source package in Lucid:
  Won't Fix
Status in linux source package in Precise:
  New
Status in linux source package in Trusty:
  Fix Released
Status in linux source package in Utopic:
  Fix Released

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/generated/uapi/linux/version.h and then I can use something like:
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
  /* 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_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
  #define RHEL_MAJOR 6
  #define RHEL_MINOR 5
  #define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b))
  #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://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=commitdiff;h=f4c342cdce8acfaef2d89a800bb6a10128d802c8

  Adding some version to the kernel will help the backports project.
  https://backports.wiki.kernel.org/

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1327619/+subscriptions


References