不要添加“+”到linux内核版本 [英] Don't add "+" to linux kernel version

查看:194
本文介绍了不要添加“+”到linux内核版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 图片名称:Linux下的Linux内核-2.6.39+ 

如果我没有使用git,那么在没有任何加号的情况下,结束。



我知道这是通过脚本/ setlocalversion脚本完成的:

 如果测试$ CONFIG_LOCALVERSION_AUTO=y;那么
#完全scm版本字符串
res =$ res $(scm_version)
else
#如果存储库不是干净的
,则附加一个加号#注释或签名的标签状态(因为git只描述
#查看签名或注释标签 - git tag -a / -s)和
#LOCALVERSION =未指定
如果测试$ {LOCALVERSION + set}!=set;然后
scm = $(scm_version - short)
res =$ res $ {scm:++}
fi
fi

因此,如果没有代码更改,就可以在不需要在版本行末尾添加+的情况下构建系统?

解决方案

你的版本字符串末尾的加号表示内核是由修改过的源构建的(也就是说,是未承诺的变化)。这也可以通过 scripts / setlocalversion 中的注释来指示。



为避免追加'+'一个肮脏的工作目录,运行 make 时简单地设置LOCALVERSION:

  make LOCALVERSION = 

您可能还必须更改配置选项 CONFIG_LOCALVERSION_AUTO n 在内核配置中( .config ):

  sed -is | CONFIG_LOCALVERSION_AUTO =。* | CONFIG_LOCALVERSION_AUTO = n | .config 


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?

解决方案

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

这篇关于不要添加“+”到linux内核版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆