Yur*_*uri 31 linux git linux-kernel
我正在构建linux内核,如果我的内核在git下,那么内核版本每次都是:
Image Name: Linux-2.6.39+
Run Code Online (Sandbox Code Playgroud)
如果我不使用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
Run Code Online (Sandbox Code Playgroud)
那么,没有代码更改就可以说构建系统不需要在版本行的末尾添加"+"?
Jon*_*set 26
版本字符串末尾的加号表示内核是根据修改后的源构建的(即,存在未提交的更改).这也是在评论中表明的scripts/setlocalversion.
尽管有一个脏的工作目录,为了避免附加'+',只需在运行时明确地设置LOCALVERSION make:
make LOCALVERSION=
Run Code Online (Sandbox Code Playgroud)
您可能还需要配置选项更改CONFIG_LOCALVERSION_AUTO到n你的内核配置(.config大厦前):
sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" .config
Run Code Online (Sandbox Code Playgroud)
Hap*_*tus 21
要防止脚本scripts/setlocalversion附加+到内核本地版本的末尾.scmversion,请在内核源的根目录中创建一个空文件.
touch .scmversion
Run Code Online (Sandbox Code Playgroud)
这样,您就可以在内核配置文件中保留LOCALVERSION,以防您想要将本地签名附加到内核名称.