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 55962A0351; Thu, 3 Mar 2022 14:13:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5CE840687; Thu, 3 Mar 2022 14:13:23 +0100 (CET) Received: from relay.yourmailgateway.de (relay.yourmailgateway.de [194.59.204.23]) by mails.dpdk.org (Postfix) with ESMTP id D6F9340141 for ; Thu, 3 Mar 2022 14:13:22 +0100 (CET) Received: from relay02-mors.netcup.net (localhost [127.0.0.1]) by relay02-mors.netcup.net (Postfix) with ESMTPS id 4K8WdG48wrz3xlt; Thu, 3 Mar 2022 14:13:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fthiessen.de; s=key2; t=1646313202; bh=EKnhf6P5N63qcSVsc54pR7T1GFZ73B3nHsfng1hMesQ=; h=From:To:Cc:Subject:Date:From; b=NiBxSIolBs5/boqopKDxXAPjGQ6Re3axOe252mqIsN2nlMxckGY0dzJZ874j8knni cQtNNzKabOZwixwYNSadbSvYU42UImr6iWVQ7xqnCGz+i3WIYvBhypM7AsSnH/lSbc F6aZzzWaf8DDrKQmPuMG6Uoq7Zo0Xt7vVfWh6syuxacBR+oU9NICXwBqtqSnm7rlE2 +r4ihd9aYTyc1fYp1Xda6tIzskcONXXmRAS0a1YqpZvb8mVb0NB3CqZY3N0reAIrxP Z6Eapl8CD1wy3SLEF2Bu6o5M9fL4yv8T3Y/jGTyi7o0MyIH+WFP8hcQJxqajuKtnQB QifBQT40gdM8g== Received: from policy02-mors.netcup.net (unknown [46.38.225.53]) by relay02-mors.netcup.net (Postfix) with ESMTPS id 4K8WdG3nk1z7vMw; Thu, 3 Mar 2022 14:13:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at policy02-mors.netcup.net X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 required=6.31 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Received: from mx2ec0.netcup.net (unknown [10.243.12.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by policy02-mors.netcup.net (Postfix) with ESMTPS id 4K8WdF4dQHz8sgM; Thu, 3 Mar 2022 14:13:21 +0100 (CET) Received: from localhost.localdomain (ip5f5a9c28.dynamic.kabel-deutschland.de [95.90.156.40]) by mx2ec0.netcup.net (Postfix) with ESMTPSA id 2BF201A0039; Thu, 3 Mar 2022 14:13:21 +0100 (CET) Authentication-Results: mx2ec0; spf=pass (sender IP is 95.90.156.40) smtp.mailfrom=rpm@fthiessen.de smtp.helo=localhost.localdomain Received-SPF: pass (mx2ec0: connection is authenticated) From: Ferdinand Thiessen To: bruce.richardson@intel.com Cc: dev@dpdk.org, Ferdinand Thiessen Subject: [PATCH v2] build: try to get kernel version from kernel source Date: Thu, 3 Mar 2022 14:12:30 +0100 Message-Id: <20220303131230.31022-1-rpm@fthiessen.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-PPP-Message-ID: <164631320143.13978.2216282486916611644@mx2ec0.netcup.net> X-PPP-Vhost: familiethiessen.de X-NC-CID: BI+vOutTIf22S6AVo73TR+L9HtbChIsCSKNaBdCKM2qFMUckVtFZrWAwwAs= 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 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 --- kernel/linux/meson.build | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build index d8fb20c1c3..16a0948994 100644 --- a/kernel/linux/meson.build +++ b/kernel/linux/meson.build @@ -12,15 +12,21 @@ cross_args = [] if not meson.is_cross_build() # native build kernel_version = run_command('uname', '-r', check: true).stdout().strip() + 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