在哪里可以找到 Linux 内核源代码树的版本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12151694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where do I find the version of a Linux kernel source tree?
提问by Maks
I have downloaded from a hardware vendor just a tarball of their Linux source tree (no Git repository metadata), is there a way to find out the version number of the kernel?
我从硬件供应商那里下载了他们的 Linux 源代码树的 tarball(没有 Git 存储库元数据),有没有办法找出内核的版本号?
Is the version number usually stored in a file somewhere in the source tree?
版本号通常存储在源代码树中的某个文件中吗?
I'd like to be able to do this without compiling and running the kernel.
我希望能够在不编译和运行内核的情况下做到这一点。
采纳答案by Adrian Cornish
You can find the version by running
您可以通过运行找到版本
make kernelversion
In the source tree
在源树中
回答by paxdiablo
Check the top-level Makefile
, an example of which is here. At the top of that, you should see something like:
检查顶级Makefile
,其示例是here。最重要的是,您应该看到如下内容:
VERSION = 3
PATCHLEVEL = 1
SUBLEVEL = 0
EXTRAVERSION = -pax
NAME = Custom Pax Version
The (admittedly minor) advantage of this method is that you only need the ability to view the files themselves rather than having to run a build process.
这种方法的(不可否认的)优点是您只需要能够查看文件本身,而不必运行构建过程。
回答by peterh - Reinstate Monica
Yet another solution: in the older times include/linux/version.h
, currently include/generated/uapi/linux/version.h
, but only after at least a partially successful compilation.
另一个解决方案:在较旧的时代include/linux/version.h
,目前include/generated/uapi/linux/version.h
,但至少在部分成功编译之后。