A lot of people compile Linux Kernel, the version number in the generated RPM package is inexplicably with a plus sign, which may be due to the modification of the files in Linux.git. So how do you remove the plus sign after the Linux Kernel version number? You can refer to the following methods.
kernel version is based on figures provided by the Makefile generated. Open the Makefile and the file will start to see:
1 VERSION = 3
2 PATCHLEVEL = 10
3 SUBLEVEL = 28
4 EXTRAVERSION =
5 NAME = TOSSUG Baby Fish
The file associated with kernel version number generation is scripts/setlocalversion, which has the following partial scripts:
# scm version string if not at a Tagged commit
if test “$CONFIG_LOCALVERSION_AUTO” = “y”; then
# full scm version string
res=“$res$(scm_version)&rdquo ;
else
# append a plus sign if the repository is not in a clean
# annotated or signed tagged state (as git describe only
#口 at signed or annotated tags - git tag -a/-s) and
# LOCALVERSION= is not specified
if test “${LOCALVERSION+set}” ! = “set”; then
scm=$(scm_version --short)
res=“$res${scm:++}”
fi
fi
If
CONFIG_LOCALVERSION_AUTO
is not configured, LOCALVERSION has no value, then, according to the above script, the + sign will not be added. It is.
Actually, when compiling the code, you can execute it:
LOCALVERSION= make
In addition, in the scripts/setlocalversion file, there is a sentence:
if Test -d .git && head=`git rev-parse --verify --short HEAD 2》/dev/null`;
git rev-parse is to get the id of the most recent commit:
$ git rev-parse --verify --short HEAD
e77fcc1
charles@taotao:~/code/linux-3.10.28$ git rev-parse - -verify HEAD
e77fcc1e9be7a0ab373f96d5b9d58e1136c8c4b0
Or use:
$ git log --pretty=format:‘%h’ -n 1
e77fcc1< Br>
${LOCALVERSION+set} is variable expansion modfier.
It has several forms:
${variable:–word} If variable is set to one If the value is null, then the value of this expression is the value of variable; otherwise, it is the value of word (the value of variable is unchanged)
${variable:=word} if varial If e is set or the value is not empty, then the value of this expression is the value of variable; otherwise, it is the value of word (variable value is updated)
${variable:+word} if variable is set A value that is not null, then the value of this expression is the value of variable; otherwise, it is NULL.
${variable:offset} Get a substring of the string (starting from the variable string index as offset, offset value starting from 0)
${variable:? Word} If variable is set to a value that is not null, then the value of this expression is the value of variable; otherwise, print the value of word and exit.
${variable:offset:length} Get the variable string (starting from offset, length is length)
The above is the reason for the addition of a plus sign after the Linux Kernel version number. The method, although the Linux Kernel version number seems to have no effect on the use, but it also has deep-seated reasons, you can use the method in the text to clear the plus sign.
Sometimes you want to sniff HTTP traffic for some kind of need, so how do you sniff
Many users want to install a tool to view chm under Ubuntu. The chmsee in deepin is a relatively goo
In Linux, many people dont understand the meaning of the variable parameter $ in th
Every user who has certain mastery of Linux system must start to learn some common commands of Linux
Linux how to use vim for advanced editing
Linux installation using the monitoring software Collectl method
How to sort the connector ld link under Linux
Linux using the example of the watch command
Techniques for setting up multiple network cards as virtual network cards under Linux
How to use function to get ns level time under Linux
Solution for unusable xmanager passive function under Linux
How to use the web page editor CKEditor under Linux
How to regularly clean up Nginx logs in Linux system
Ubuntu configuration steps using OpenDNS
Two methods to easily solve the problem of Win7 without administrator rights
Win7 system AHCI is turned on and restarts. Blue screen cannot be started or crashed. Solution
Win8 system help document can not open the solution to the problem
Why is the win7 c disk space getting smaller and smaller
How does win10 modify the system date and time?
Use the DISM command to solve the problem that the Win8.1 system application store cannot open
Win7 system notebook can not check the status bar how to do
Microsoft: Rethinking WP8.1 Cortana Push Program
A new chapter in Win10! Microsoft Build2015 Developer Conference comprehensive observation