我正在构建linux内核,如果我的内核是git下的,那么内核版本每次都是:
Image Name: Linux-2.6.39+
如果我没有使用git,那么在最后没有任何加号就可以了。
我知道这是通过scripts/setlocalversion脚本完成的:
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
那么,有没有可能在不修改代码的情况下构建系统,而不需要在版本行的末尾添加"+“?
发布于 2014-01-13 02:37:55
版本字符串末尾的加号表示内核是从修改过的源代码构建的(即,存在未提交的更改)。scripts/setlocalversion
中的注释也表明了这一点。
为了避免附加'+‘,尽管有一个脏的工作目录,只需在运行make
时明确地设置LOCALVERSION
make LOCALVERSION=
在构建之前,您可能还必须在内核配置(.config
)中将配置选项CONFIG_LOCALVERSION_AUTO
更改为n
:
sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" .config
发布于 2015-09-22 00:17:21
为了防止脚本scripts/setlocalversion
将+
附加到内核本地版本的末尾,请在内核源代码的根目录下创建一个空的.scmversion
文件。
touch .scmversion
这样,您将能够在内核配置文件中保留LOCALVERSION,以防您想要将本地签名附加到内核名称。
发布于 2018-01-09 14:09:36
对我来说,操纵脚本/setlocalversion似乎是唯一的方法。在scm_version()
中强制返回
scm_version()
{
local short
short=false
**return**
https://stackoverflow.com/questions/19333918
复制相似问题