简体   繁体   English

Linux内核修补程序版本宏定义

[英]Linux Kernel Patch Version Macro Definition

I'd like to build my kernel modules for centos 7 kernels. 我想为centos 7内核构建内核模块。 But I have problem with some function prototype. 但是我对某些函数原型有疑问。 It's different in kernel-3.10.0- 327.36.3.el7 and kernel-3.10.0- 514.el7 . 在kernel-3.10.0- 327.36.3.el7和kernel-3.10.0- 514.el7中有所不同 I know how to use Linux Kernel Version Macro Definition . 我知道如何使用Linux内核版本宏定义 But I need to check kernel Patch Version and linux directory name. 但是我需要检查内核补丁版本和linux目录名称。

Some body know preprocessor macro for checking kernel's patch version? 有人知道预处理器宏可用于检查内核的补丁程序版本吗?

I've just found some information. 我刚刚找到了一些信息。 We can use some predefined variables from Makefile in kernel headers. 我们可以在内核头文件中使用Makefile中的一些预定义变量。 For example in centos 7 we have kernel-3.10.0-514.16.1.el7. 例如,在centos 7中,我们有kernel-3.10.0-514.16.1.el7。 There are variables in file /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/Makefile: 文件/usr/src/kernels/3.10.0-514.16.1.el7.x86_64/Makefile中包含变量:

VERSION = 3
PATCHLEVEL = 10
SUBLEVEL = 0
EXTRAVERSION = -514.16.1.el7.x86_64
NAME = Unicycling Gorilla
RHEL_MAJOR = 7
RHEL_MINOR = 3
RHEL_RELEASE = 514.16.1
...

In our Makefile for kernel module we can put it in our source code by -DPATCH_VERSION=${RHEL_RELEASE} gcc parametr(or example in centos 7). 在我们的内核文件Makefile中,我们可以通过-DPATCH_VERSION = $ {RHEL_RELEASE} gcc参数(或在centos 7中的示例)将其放入源代码中。 But need to check distro because in debian there isn't RHEL_RELEASE variable. 但是需要检查发行版,因为在debian中没有RHEL_RELEASE变量。

I think there is better way. 我认为有更好的方法。

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

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