Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remove the plus sign after the Linux Kernel version number

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to remove the plus sign after the Linux Kernel version number, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

The kernel version number is generated based on the numbers provided in Makefile. Open Makefile, and the file begins to see:

1 VERSION = 3

2 PATCHLEVEL = 10

3 SUBLEVEL = 28

4 EXTRAVERSION =

5 NAME = TOSSUG Baby Fish

The file related to kernel version number generation is scripts/setlocalversion, which contains 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)"

Else

# append a plus sign if the repository is not in a clean

# annotated or signed tagged state (as git describe only

# looks at signed or annotated tags-git tag-a Universe) and

# LOCALVERSION= is not specified

If test "${LOCALVERSION+set}"! = "set"; then

Scm=$ (scm_version-- short)

Res= "$res$ {scm:++}"

Fi

Fi

If

CONFIG_LOCALVERSION_AUTO

It is not configured, and LOCALVERSION has no values, so, according to the above script, the + sign will not be added.

When you actually compile the code, you can execute:

LOCALVERSION= make

In addition, in the file scripts/setlocalversion, there is a sentence:

If test-d. Git & & head= `git rev-parse-- verify-- short HEAD 2 "/ dev/ null`

Git rev-parse is used to retrieve 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

${LOCALVERSION+set} is variable expansion modfier.

It comes in several forms:

${variable:-word} if variable is set to a value that is not empty, then the value of this expression is the value of variable; otherwise, it is the value of word (the value of variable remains the same)

${variable:=word} if variale 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 (the value of variable is updated)

${variable:+word} if variable is set to a value that is not empty, then the value of this expression is the value of variable; otherwise, it is NULL.

${variable:offset} gets a substring of the string (since the variable string index is offset, the offset value is calculated from 0)

${variable:? Word} if variable is set to a value that is not empty, then the value of this expression is the value of variable; otherwise, print the value of word and exit.

${variable:offset:length} get the string of variable (starting with offset, the length is length)

The above is all the contents of the article "how to remove the plus sign after the Linux Kernel version number". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report