On Mon, 2011-08-22 at 14:54 -0500, Jonathan Nieder wrote:
> Ben Hutchings wrote:
>
> > I think the problem is that many generic scripts that attempt to
> > capture the kernel version will not use 'uname -a', 'uname -rv', or
> > similar. If they were to use /proc/version, that would be sufficient,
> > but then the uname commands probably work for almost every other
> > distribution. A generic script won't check package status (which
> > in any case doesn't necessarily match the running kernel version).
> >
> > (We have an even worse problem with kernel tracebacks; they only show
> > the release e.g. '2.6.32-5-amd64'. But we could change that too.)
>
> Thanks for explaining. I fear this gets into thorny territory quickly
> --- the ideal behavior would be
>
> $ uname -r
> 3.0.0-2
>
> but it is not uncommon to want to examine the linux-image-$(uname -r)
> package and various scripts assume that modules live in
> /lib/modules/$(uname -r). Thus a proper fix involves finding a way
> for (out-of-tree) modules to be shared between kernels with different
> ABI as long as they are compatible with the module, so the ABI version
> could be bumped for every stable update. Which is something that was
> wanted anyway.
Right.
> In the short term, though, some hack like the following could help, to
> tweak "uname -v" output. (And maybe including UTS_VERSION in
> tracebacks as an additional patch, as you mentioned.)
[...]
We already patch scripts/mkcompile_h to add the Debian-specific
information to /proc/version (see debian/patches/debian/version.patch).
We definitely shouldn't replace any information in custom builds from
linux-source-*, but there isn't generally enough space to append the
full Debian version. So I would suggest something like:
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -58,6 +58,13 @@
if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
+
+DISTRIBUTION=$(lsb_release -is 2>/dev/null)
+DISTRIBUTION=${DISTRIBUTION:-Debian}
+
+if [ "$DISTRIBUTION_OFFICIAL_BUILD" ]; then
+ UTS_VERSION="#0 $DISTRIBUTION $DISTRIBUTION_VERSION"
+fi
# Truncate to maximum length
--- END ---
Ben.
Attachment:
signature.asc
Description: This is a digitally signed message part