How to modify the Linux kernel to change the version string that uname returns?

user1646441 picture user1646441 · Oct 14, 2013 · Viewed 11.1k times · Source

I'm working with an old (2.6.33.2) version of embedded Linux and have been asked to change the kernel so that differently patched kernel images can be told apart. At the moment, uname -v outputs e.g."#1 Wed Sep 11 07:07:51 BST 2013.

Hence I'd like to change this so that any subsequent patches change the #1 part to a revision number defined as part of the patch (and to change the date part to be the date of the latest kernel patch), but I can't see where in the kernel this is set up.

What file(s) should I be looking at to do this?

Answer

pevik picture pevik · Feb 10, 2014

Try to set KBUILD_BUILD_TIMESTAMP. Default is `date`, so it could be something like

export KBUILD_BUILD_TIMESTAMP="r3 `date`"

#1 at the beginning is from .version file, it's incremented after every configuration / build.

See file scripts/mkcompile_h for more info.