繁体   English   中英

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

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

我从硬件供应商那里下载了他们的 Linux 源代码树的压缩包(没有 Git 存储库元数据),有没有办法找出 Z50484C19F1AFDAF3841A0D821ED393D2 的版本号

版本号通常存储在源代码树的某个文件中吗?

我希望能够在不编译和运行 kernel 的情况下做到这一点。

您可以通过运行找到版本

make kernelversion

在源代码树中

检查顶层Makefile这里有一个例子。 在顶部,您应该会看到如下内容:

VERSION = 3
PATCHLEVEL = 1
SUBLEVEL = 0
EXTRAVERSION = -pax
NAME = Custom Pax Version

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

另一个解决方案:在较早的时候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

在 Linux 源树的根文件中,查看 Makefile 的内容。 在它的开始部分:

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

那么你linux源码树的版本是:4.14.67

暂无
暂无

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

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