kni: use utsrelease to determine Ubuntu kernel version
authorSimon Kagstrom <simon.kagstrom@netinsight.net>
Thu, 20 Aug 2015 06:51:06 +0000 (08:51 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 19 Nov 2015 09:06:56 +0000 (10:06 +0100)
/proc/version_signature is the version for the host machine, but in
e.g., chroots, this does not necessarily match that DPDK is built
for. DPDK will then build for the wrong kernel version - that of the
server, and not that installed in the (build) chroot.

The patch uses utsrelease.h from the kernel sources instead and fakes
the upload version.

Tested on a server with Ubuntu 12.04, building in a chroot for Ubuntu
14.04.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Johan Faltstrom <johan.faltstrom@netinsight.net>
Acked-by: Helin Zhang <helin.zhang@intel.com>
lib/librte_eal/linuxapp/kni/Makefile

index fb673d9..ac99d3f 100644 (file)
@@ -44,10 +44,10 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e
 MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
 MODULE_CFLAGS += -Wall -Werror
 
-ifeq ($(shell test -f /proc/version_signature && lsb_release -si 2>/dev/null),Ubuntu)
+ifeq ($(shell lsb_release -si 2>/dev/null),Ubuntu)
 MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(shell lsb_release -sr | tr -d .)
-UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
-                        cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
+UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE $(RTE_KERNELDIR)/include/generated/utsrelease.h \
+        | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)
 MODULE_CFLAGS += -D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
 endif