简体   繁体   English

在哪里可以找到 Linux kernel 源代码树的版本?

[英]Where do I find the version of a Linux kernel source tree?

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 源代码树的压缩包(没有 Git 存储库元数据),有没有办法找出 Z50484C19F1AFDAF3841A0D821ED393D2 的版本号

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.我希望能够在不编译和运行 kernel 的情况下做到这一点。

You can find the version by running您可以通过运行找到版本

make kernelversion

In the source tree在源代码树中

Check the top-level Makefile , an example of which is here .检查顶层Makefile这里有一个例子。 At the top of that, you should see something like:在顶部,您应该会看到如下内容:

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.此方法的(不可否认的次要)优点是您只需要能够查看文件本身,而不必运行构建过程。

另一个解决方案:在较早的时候include/linux/version.h ,当前是include/generated/uapi/linux/version.h ,但只有在至少部分成功编译之后。

In the kernel source tree, check the root directory Makefile to get the kernel version as below.

Example as below:

 $ head Makefile
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 5
 PATCHLEVEL = 18
 SUBLEVEL = 0
 EXTRAVERSION = -rc3
 NAME = Superb Owl
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
 # More info can be located in ./README

From the above we get the source code version is 5.18.0-rc3

In the Linux source tree's root file, check the Makefile content.在 Linux 源树的根文件中,查看 Makefile 的内容。 In its beginning part:在它的开始部分:

# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 14
SUBLEVEL = 67

Then you linux source tree's version is: 4.14.67那么你linux源码树的版本是:4.14.67

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM