From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com
 [209.85.212.176]) by dpdk.org (Postfix) with ESMTP id DE1F08E8A
 for <dev@dpdk.org>; Wed,  4 Nov 2015 11:36:53 +0100 (CET)
Received: by wicll6 with SMTP id ll6so86956715wic.0
 for <dev@dpdk.org>; Wed, 04 Nov 2015 02:36:53 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind_com.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:organization:user-agent
 :in-reply-to:references:mime-version:content-transfer-encoding
 :content-type; bh=+5hrDNbIQPotFzr6sA1uoGFhFfzHW2Snxkj8Q6+aQQ8=;
 b=sbH4aY7cAMoL34x5vKet4bnBwkPqltsyxwk0fsDBaXNU6cGu6jGs7a5OISdafzVAN0
 96ZI9rryxp1AVl1hnrj7EQeUcxWZxWGcWcWkNkJaDR4AlRzvO/G2EW2xYGtWCUbADLVz
 MO+TDIANPQa4jWzUWX7FjWh4E7QyJ4t1UZBbRY7j/93gIN2gc551jBHNtXScabFBVZRp
 p2O/C3ZsKTBuht7cz/Olz/QmjURZqtFuwyzyIN/C/mgBrDIC7wEBIi3RG/VrZTWuzkv6
 XCkmgUakwqg2bQGia43zwJrfFWlDBCdV1W+8wDh0AbhQAGBrpepSS37/tRQHVM/9gcb8
 klVA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:organization
 :user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:content-type;
 bh=+5hrDNbIQPotFzr6sA1uoGFhFfzHW2Snxkj8Q6+aQQ8=;
 b=lqsy8raqVISwBNTa4mgppN/4qOc8xqAAEZNxaZPeT7aP5UB2yJABxUMbgWbAWBCRsn
 XfllwHwhiZiQ/TE3MVtS07bhj3jnRwew49mNrbxsIONKMx4wCfSGFDE0gRuxLfLZtect
 6FFE/z8aBA30ClND00k0aICcQgPq4XC1MQpnv3VEutWNoAk9HxnouAxK5QFO7GjMD6yH
 1Hi0bWDpvIgqlLBWtu4zkc9vJdbUk+Q6dnxT4HZUe3pt1NLN/LdijljE7xsd0obbQ30C
 5RAeWYxReQuvUvdgnQpOq++OCmceIOpss7WQm9JZpqkjN+cB3OCr7UXeqDPPahpzSg2K
 FtIQ==
X-Gm-Message-State: ALoCoQkaEl6k/J5fDtzRrFnui9d9ts9iJxpAUEnmoP0o/yOIePW28d3DS7hB+HKIUkMoTDjEf7LI
X-Received: by 10.194.78.77 with SMTP id z13mr1011208wjw.145.1446633413787;
 Wed, 04 Nov 2015 02:36:53 -0800 (PST)
Received: from xps13.localnet (guy78-3-82-239-227-177.fbx.proxad.net.
 [82.239.227.177])
 by smtp.gmail.com with ESMTPSA id l1sm885310wjx.13.2015.11.04.02.36.52
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Wed, 04 Nov 2015 02:36:53 -0800 (PST)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Simon Kagstrom <simon.kagstrom@netinsight.net>
Date: Wed, 04 Nov 2015 11:35:41 +0100
Message-ID: <4456769.s2fEOyVAiF@xps13>
Organization: 6WIND
User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; )
In-Reply-To: <20150820085106.32188573@miho>
References: <20150820085106.32188573@miho>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] kni: Use utsrelease.h to determine Ubuntu
	kernel version
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Nov 2015 10:36:54 -0000

2015-08-20 08:51, Simon Kagstrom:
> /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.
[...]
> --- a/lib/librte_eal/linuxapp/kni/Makefile
> +++ b/lib/librte_eal/linuxapp/kni/Makefile
> @@ -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

Yes we must check RTE_KERNELDIR instead of the running kernel.
But it is still checking lsb_release for the running system.
It seems not consistent.