GoogleCloudPlatform/compute-virtual-ethernet-linux

Macro "KERNEL_VERSION" is not defined

Opened this issue · 2 comments

Hello,
I am trying to compile the gvNIC driver on a compute intance VM based on an CentOS 7 image.
I am getting compilation errors when trying to build the modules with the command :

make -C /lib/modules/`uname -r`/build M=$(pwd)/build modules modules_install

My kernel release is 3.10.0-1160.25.1.el7.x86_64

The error indicates that the KERNEL_VERSION macro is not defined.

/home/user/compute-virtual-ethernet-linux/build/gve_desc.h:12:27: warning: "KERNEL_VERSION" is not defined [-Wundef] #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0)
/home/user/compute-virtual-ethernet-linux/build/gve_desc.h:12:41: error: missing binary operator before token "(" #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0)

Thanks for for reporting this.

The definition should be:
#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))

We'll work on making driver compilation on CentOS7 work without manual intervention.

@jeroendeb thanks!
Defining the macro worked properly.