[PATCH 1/1] UBUNTU: expose the debian changelog version number via the kernel build number

Andy Whitcroft apw at canonical.com
Tue Dec 2 14:46:03 UTC 2008

We currently expose the Ubuntu ABI via the basic kernel version
number (in /proc/version and uname) and expose the full version via
/proc/version_signature.  We do this to maintain stability in the naming
of our modules simplifying external module updates.  But this does mean
that the normal version is lacking some information needed to directly
identify the actual build, both to normal tools and more importantly in
the Oops/panic output:

  $ cat /proc/version
  Linux version 2.6.27-10-generic (root at dm) (gcc version 4.3.2 (Ubuntu
         4.3.2-1ubuntu11) ) #1 SMP Mon Dec 1 17:56:07 GMT 2008
  $ cat /proc/version_signature
  Ubuntu 2.6.27-10.21~lp276943apw1-generic

This patch additionally exposed the version suffix via the 'version'
field, the #1 SMP <date> section above as below.  This exposes the
upload number plus and relative updates:

  $ cat /proc/version
  Linux version 2.6.27-10-generic (root at dm) (gcc version 4.3.2 (Ubuntu
         4.3.2-1ubuntu11) ) #21~lp276943apw1 SMP Mon Dec 1 17:56:07 GMT 2008

This has the advantage that the oops reporter also reports the the
beginning of this field (up to the first space) as part of a panic so
they would then look like the below which should aid kernel

  Pid: 2847, comm: grub Not tainted 2.6.27-10-generic #21~lp276943apw1

For autobuilder generated builds we also add a -Ubuntu suffix indicating
they are offical releases.  This also appears with the upload number in

  Pid: 2847, comm: grub Not tainted 2.6.27-10-generic #21-Ubuntu

This may be enough for kerneloops to know they are ours.

Signed-off-by: Andy Whitcroft <apw at canonical.com>
 debian/rules.d/0-common-vars.mk |    9 ++++++++-
 debian/rules.d/1-maintainer.mk  |    1 +
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index f9d12e9..30721b1 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -53,6 +53,11 @@ prev_abinum	:= $(shell echo $(prev_revision) | sed -e 's/\..*//')$(abi_suffix)
 abi_release	:= $(release)-$(abinum)
+uploadnum	:= $(shell echo $(revision) | sed -e 's/.*\.//')
+ifneq ($(wildcard /CurrentlyBuilding),)
+  uploadnum	:= $(uploadnum)-Ubuntu
 # We force the sublevel to be exactly what we want. The actual source may
 # be an in development git tree. We want to force it here instead of
 # committing changes to the top level Makefile
@@ -91,7 +96,9 @@ conc_level		= -j$(CONCURRENCY_LEVEL)
 # target_flavour is filled in for each step
 kmake = make ARCH=$(build_arch) EXTRAVERSION=-$(abinum)-$(target_flavour) \
+	KBUILD_BUILD_VERSION="$(uploadnum)"
 ifneq ($(LOCAL_ENV_CC),)
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index eb95413..c8f473a 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -51,6 +51,7 @@ printenv:
 	@echo "release           = $(release)"
 	@echo "revisions         = $(revisions)"
 	@echo "revision          = $(revision)"
+	@echo "uploadnum         = $(uploadnum)"
 	@echo "prev_revisions    = $(prev_revisions)"
 	@echo "prev_revision     = $(prev_revision)"
 	@echo "abinum            = $(abinum)"

More information about the kernel-team mailing list