Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't add "+" to linux kernel version

I am building linux kernel, if my kernel under git, then kernel version every time is:

Image Name:   Linux-2.6.39+ 

If I am not using git, then everything is OK without any plus at the end.

I know that this done by scripts/setlocalversion script:

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/-s) and     # LOCALVERSION= is not specified     if test "${LOCALVERSION+set}" != "set"; then         scm=$(scm_version --short)             res="$res${scm:++}"         fi fi 

So, it is possible without code changes say to build system that no need to add "+" at the end of version line?

like image 715
Yuri Avatar asked Oct 12 '13 11:10

Yuri


People also ask

What is a dirty kernel?

If Linux kernel images are being built with "-dirty" on the end of the version string, this simply means that modifications in the source directory have not been committed. Use git status to check for uncommitted files.

What is Kbuild in kernel?

"kbuild" is the build system used by the Linux kernel. Modules must use kbuild to stay compatible with changes in the build infrastructure and to pick up the right flags to "gcc." Functionality for building modules both in-tree and out-of-tree is provided.

Can you modify Linux kernel?

changing linux kernel involves two things: Downloading the source code, compiling the kernel. Here when you compile the kernel for first time it will take time. I have attached link to start compiling kernel and install it. Now-a-days its quiet easy.

Is Linux version and kernel version same?

Similary,Ubuntu OS or fedora OS etc a distro working on various shell using Linux kernel. Shell or a distro does not make Kernel more user friendly to use but it makes it usable for user. So now,simply you can say Linux is a kernel.


2 Answers

The plus sign at the end of your version string is there as an indicator that the kernel was built from modified sources (that is, there were non-committed changes). This is also indicated by the comments in scripts/setlocalversion.

To avoid the '+' being appended despite having a dirty working directory, simply set LOCALVERSION explicityly when running make:

make LOCALVERSION= 

You may also have to change the configuration option CONFIG_LOCALVERSION_AUTO to n in your kernel config (.config) before building:

sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" .config 
like image 170
Jon Gjengset Avatar answered Nov 08 '22 19:11

Jon Gjengset


To prevent the script scripts/setlocalversion to append the + to the end of the kernel local version, create an empty .scmversion file in the root of the kernel sources.

touch .scmversion 

this way, you'll be able to leave LOCALVERSION as is in the kernel configuration file, in case you want to append a local signature to the kernel name.

like image 28
HappyCactus Avatar answered Nov 08 '22 21:11

HappyCactus