From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9505DA0350; Mon, 28 Feb 2022 19:11:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 251CB4068C; Mon, 28 Feb 2022 19:11:51 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 5207D40140 for ; Mon, 28 Feb 2022 19:11:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646071909; x=1677607909; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aojdEfWkdteZWQzm3Z4TUql7LDNNgmVXy2SsOej6zdo=; b=C1F+BKmlRJAeLAWtO/EiolFL/9TDp4p9KOhVbH0z9E3r7p1BH+LDjM0E rvAL/dIYHat0ZGohUtqbGZ4Z5kUljon5mbNygf/MAEyFFRaT3m4AeeXlX Px+FyS/sfxsM6FrU8G9YnXR0nv+r3ENRWjz6pOE3qG64B7JA9+dMs0hJT cIBz7U5PAoANC6ZwSkY2AxccAumh8BqQ/8J0lr3pD9rRW0GyvGD9J+qhK GMkkdaIQsoEj1PotbAQwkBLAbiQ8BrFFiuKS5X1/pa6GDtKb4iHgP1VVZ vhHWpq33AQUqMCoHW/0lKPuChrGqyK4p7uydzxQkuoJoYnNxBEum536i8 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10272"; a="250535073" X-IronPort-AV: E=Sophos;i="5.90,144,1643702400"; d="scan'208";a="250535073" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 10:11:45 -0800 X-IronPort-AV: E=Sophos;i="5.90,144,1643702400"; d="scan'208";a="534551137" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.27.47]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 28 Feb 2022 10:11:44 -0800 Date: Mon, 28 Feb 2022 18:11:41 +0000 From: Bruce Richardson To: Ferdinand Thiessen Cc: dev@dpdk.org Subject: Re: [PATCH] build: try to get kernel version from kernel source Message-ID: References: <20220226214045.19902-1-rpm@fthiessen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220226214045.19902-1-rpm@fthiessen.de> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Sat, Feb 26, 2022 at 10:40:45PM +0100, Ferdinand Thiessen wrote: > When building the kernel modules, try to get the kernel > version from the kernel sources first. This fixes the > kernel modules installation directory if the target kernel > version differs from the host kernel version, like for > CI build or when packaging for linux distributions. > > Signed-off-by: Ferdinand Thiessen > --- On initial review I don't see any problems with the overall approach taken by this patch, but I think others more familiar with kernel build paths could do with reviewing it too. One small comment inline below. /Bruce > kernel/linux/meson.build | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build > index d8fb20c1c3..78f28ffb0c 100644 > --- a/kernel/linux/meson.build > +++ b/kernel/linux/meson.build > @@ -10,17 +10,23 @@ install = not meson.is_cross_build() > cross_args = [] > > if not meson.is_cross_build() > - # native build > - kernel_version = run_command('uname', '-r', check: true).stdout().strip() > + # native target build > + kernel_version = run_command('uname', '-r').stdout().strip() These two lines can be dropped from the patch, I think. The comment change doesn't appear significant, and we definitely want to keep the "check: true" in the run_command call to avoid meson warnings. > + if kernel_source_dir != '' > + # Try kernel release from sources first > + r = run_command('make', '-s', '-C', kernel_source_dir, 'kernelrelease', check: false) > + if r.returncode() == 0 > + kernel_version = r.stdout().strip() > + endif > + else > + # use default path for native builds > + kernel_source_dir = '/lib/modules/' + kernel_version + '/source' > + endif > kernel_install_dir = '/lib/modules/' + kernel_version + '/extra/dpdk' > if kernel_build_dir == '' > # use default path for native builds > kernel_build_dir = '/lib/modules/' + kernel_version + '/build' > endif > - if kernel_source_dir == '' > - # use default path for native builds > - kernel_source_dir = '/lib/modules/' + kernel_version + '/source' > - endif > > # test running make in kernel directory, using "make kernelversion" > make_returncode = run_command('make', '-sC', kernel_build_dir, > -- > 2.35.1 >