3

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?

Alexander Vogt
  • 17,879
  • 13
  • 52
  • 68
user1646441
  • 31
  • 1
  • 1
  • 3
  • Perhaps you have a `.version` file in your kernel source tree. – Basile Starynkevitch Oct 14 '13 at 14:15
  • 2
    I'm quite sure that you can change this when you do a "make menuconfig" . There is an option like "Local version string" – Cillier Oct 14 '13 at 14:15
  • 1
    There is a CONFIG_LOCALVERSION, but that will let you set what 'uname -r' displays, not 'uname -v'. – Peter L. Oct 14 '13 at 16:16
  • There is a file `include/generated/compile.h` which contains the definition of UTS_VERSION which contains the timestamp. This file is generated everytime the kernel is built. If you search for this define, then you will see that it is used in couple of places to form the version string of the kernel. If you have to change this timestamp, then you have to modify the source files where this define is used and use your own. You can edit the `.version` file to change the `#1` part you have mentioned. – Vivek S Oct 15 '13 at 16:29

1 Answers1

3

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.

pevik
  • 4,523
  • 3
  • 33
  • 44