Linux Kernel Version – Understanding Version Suffix and CONFIG_LOCALVERSION

compilinglinux-kernel

On system start up I currently see Linux 4.0.0-rc6yy and 4.0.0-rc6yy.old from the bootloader menu. I'm not certain where they came from. I suspect "yy" is arbitrary but can someone explain the ".old" suffix?

Also can someone explain what CONFIG_LOCALVERSION and CONFIG_LOCALVERSION_AUTO is from .config? I've looked them up but am still unclear about their use. Many thanks.

Best Answer

When you are installing your kernel the responsible script is copying kernel image and initramfs into your /boot directory. If a previous kernel image with the same name already exist, it is renamed by appending .old to its name.

CONFIG_LOCALVERSION:

Append an extra string to the end of your kernel version. This will show up when you type uname, for example. The string you set here will be appended after the contents of any files with a filename matching localversion* in your object and source tree, in that order. Your total string can be a maximum of 64 characters.

That means if you want you can give a special version number or name to your customized kernel. If you type "-MyNewKernel" your kernel should look: Linux 4.0.0-MyNewKernel.

CONFIG_LOCALVERSION_AUTO:

This will try to automatically determine if the current tree is a release tree by looking for git tags that belong to the current top of tree revision.
A string of the format -gxxxxxxxx will be added to the localversion appended after any matching localversion1 files, and after the value set in CONFIG_LOCALVERSION.

1 (The actual string used here is the first eight characters produced by running the command:

$ git rev-parse --verify HEAD

which is done within the script "scripts/setlocalversion".)

That means if it is enabled the unique SCM (source control management) tag reported by setlocalversion (or .scmversion) is appended to the kernel version, if it exists. For example if a git tree is found, the revision number will be appended if it exists. The result could look: Linux 4.0.0-MyNewKernel-ga2cfc42. For mores info you could check in your source tree scipts/setlocalversion.

Related Question