Linux kernel编译生成的版本多一个加号“+”

kernel版本出现一个加号(plug sign)的原因可能是如下两点,当然前提是使用Linux的GIT repository,且CONFIG_LOCALVERSION_AUTO和LOCALVERSION都没有设置。
(1)如果当前repository的commit ID不是某一个tag,则默认有一个加号。因为在最上层的Makefile中只有该repository中最近一次tag的版本信息,需要用加号(+)来标识它并非一个tag(如:3.5.0)。
(2)如果当前repository的commit ID刚好是一个tag,且其中有GIT管理下的文件被改动,这默认有一个加号(+)。
如果想避免这个烦人的加号,可以将scripts/setlocalversion脚本中带有’ echo “+” ‘和’ res=" r e s res res{scm:++}" '的这两行删掉即可。
To avoid the additional plus sign in kernel release version, just remove ’ echo “+” ’ line and ’ res=" r e s res res{scm:++}" ’ line in scripts/setlocalversion file.

实际测试注释掉 #res=" r e s res res{scm:++}" 再次 make kernelrelease就发下没有+好了
首先,Linux的顶层的Makefile关于版本的信息,以及对"make kernelrelease"的定义如下:

然后,我们执行“make kernelrelease”则会生成kernel发布的版本信息,如下:
#make kernelrelease
4.19.91+

这边也说到
http://blog.csdn.net/adaptiver/article/details/7225980

内核版本号显示svn或者git 的版本号,内核将宏选上CONFIG_LOCALVERSION_AUTO
$ make kernelrelease ARCH=arm CROSS_COMPILE=arm-himix200-linux-
4.9.37-svn560082

内核显示时间撮,CONFIG_PRINTK_TIME
Location: │
│ -> Kernel hacking │ -> printk and dmesg options

Guess you like

Origin blog.csdn.net/weixin_41884251/article/details/115304315