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 35034A0351; Thu, 3 Mar 2022 14:15:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EC8C4276B; Thu, 3 Mar 2022 14:15:53 +0100 (CET) Received: from relay.yourmailgateway.de (relay.yourmailgateway.de [194.59.204.23]) by mails.dpdk.org (Postfix) with ESMTP id 7D9AF40141 for ; Thu, 3 Mar 2022 14:15:51 +0100 (CET) Received: from relay02-mors.netcup.net (localhost [127.0.0.1]) by relay02-mors.netcup.net (Postfix) with ESMTPS id 4K8Wh71jnBz3xkg; Thu, 3 Mar 2022 14:15:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fthiessen.de; s=key2; t=1646313351; bh=EKnhf6P5N63qcSVsc54pR7T1GFZ73B3nHsfng1hMesQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRoxW5MH47vPh0TGxJtSDLYRiX6zOQoDW2dFQaluu4I41rRMEK9hwj0863YS01K+Q OdZVqiWldoPsnD4NV7KPtc2QW6W1VrXoI4oY7DtmZPKd1dfEh0WpkrJ7gj2cUCMC43 bWrajku+5YPEKaT3cz53zeEoA49dtnS2JZkcXdpZineZB+fEt0DjfeSLBerZiMAz+H 9a1uO1r3/YrVFY5FkvSKhgJVrf3mDLeHLnvHEeH737QEL9cFKerXLxOhHyWFfsgHor rsdAhaR1rpA+SnUkEs7cC7Xar8C6eiTN8o6sTKIJmUHhdkway0WW4wO16FKp6p/sK6 pC33axp0mAPnw== Received: from policy02-mors.netcup.net (unknown [46.38.225.53]) by relay02-mors.netcup.net (Postfix) with ESMTPS id 4K8Wh71Lmfz7vMw; Thu, 3 Mar 2022 14:15:51 +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 4K8Wh62F3nz8sh4; Thu, 3 Mar 2022 14:15:50 +0100 (CET) Received: from localhost.localdomain (ip5f5a9c28.dynamic.kabel-deutschland.de [95.90.156.40]) by mx2ec0.netcup.net (Postfix) with ESMTPSA id C91331A0039; Thu, 3 Mar 2022 14:15:49 +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:15:43 +0100 Message-Id: <20220303131543.31246-1-rpm@fthiessen.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220226214045.19902-1-rpm@fthiessen.de> References: <20220226214045.19902-1-rpm@fthiessen.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-PPP-Message-ID: <164631335007.14623.11493204965396508017@mx2ec0.netcup.net> X-PPP-Vhost: familiethiessen.de X-NC-CID: Q1xic0z/jAe8VJhSYUjlM3lyKJNxYOMdBaZ5iwFj/iKb9MFr0HM/UWHlrHc= 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