2

I'd like to build my kernel modules for centos 7 kernels. 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. I know how to use Linux Kernel Version Macro Definition. But I need to check kernel Patch Version and linux directory name.

Some body know preprocessor macro for checking kernel's patch version?

andreykyz
  • 327
  • 3
  • 10

1 Answers1

0

I've just found some information. We can use some predefined variables from Makefile in kernel headers. For example in centos 7 we have 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:

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). But need to check distro because in debian there isn't RHEL_RELEASE variable.

I think there is better way.

andreykyz
  • 327
  • 3
  • 10