我正在构建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
那么,有没有可能在不修改代码的情况下构建不需要在版本行末尾添加“+”的系统?
最佳答案
版本字符串末尾的加号表示内核是根据修改的源构建的(即存在未提交的更改)。 scripts/setlocalversion
中的注释也表明了这一点。
为了避免在工作目录脏的情况下附加“+”,只需在运行 make
时显式设置 LOCALVERSION:
make LOCALVERSION=
在构建之前,您可能还必须在内核配置 (.config
) 中将配置选项 CONFIG_LOCALVERSION_AUTO
更改为 n
:
sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" .config
关于linux - 不要将 "+"添加到 linux 内核版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19333918/