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 6BB9CA0524; Fri, 5 Feb 2021 10:39:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F076940682; Fri, 5 Feb 2021 10:39:03 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id F41104067B for ; Fri, 5 Feb 2021 10:38:57 +0100 (CET) IronPort-SDR: ev5trfIjrEhq5yKdDqyMtmivbPsvWwrW8mWvL/358XqnZFFe1d7PlDQstqKxhwmYz9rNfmgNEY DBqErJUVpSow== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="200411467" X-IronPort-AV: E=Sophos;i="5.81,154,1610438400"; d="scan'208";a="200411467" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2021 01:38:46 -0800 IronPort-SDR: x8ArQ0MatE6B/C0G1EKnD6/ljc47wzL5wDc0jyCBCsgUvtg7b+BJomFLeSRFWzfi93hSwb0Pxz Z9l7KSWS4OPw== X-IronPort-AV: E=Sophos;i="5.81,154,1610438400"; d="scan'208";a="393781693" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.23.143]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 05 Feb 2021 01:38:44 -0800 Date: Fri, 5 Feb 2021 09:38:41 +0000 From: Bruce Richardson To: Juraj =?utf-8?Q?Linke=C5=A1?= Cc: "thomas@monjalon.net" , "Ruifeng.Wang@arm.com" , "Honnappa.Nagarahalli@arm.com" , "jerinjacobk@gmail.com" , "hemant.agrawal@nxp.com" , "ferruh.yigit@intel.com" , "aboyer@pensando.io" , "dev@dpdk.org" Message-ID: <20210205093841.GA1462@bricha3-MOBL.ger.corp.intel.com> References: <1611916159-32158-1-git-send-email-juraj.linkes@pantheon.tech> <1612432301-14961-1-git-send-email-juraj.linkes@pantheon.tech> <20210204173352.GE1712@bricha3-MOBL.ger.corp.intel.com> <0055021693274b0caf0b542bbefd0715@pantheon.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0055021693274b0caf0b542bbefd0715@pantheon.tech> Subject: Re: [dpdk-dev] [RFC PATCH v2] build: kni cross-compilation support 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 Sender: "dev" On Fri, Feb 05, 2021 at 09:26:05AM +0000, Juraj Linkeš wrote: > > > > -----Original Message----- > > From: Bruce Richardson > > Sent: Thursday, February 4, 2021 6:34 PM > > To: Juraj Linkeš > > Cc: thomas@monjalon.net; Ruifeng.Wang@arm.com; > > Honnappa.Nagarahalli@arm.com; jerinjacobk@gmail.com; > > hemant.agrawal@nxp.com; ferruh.yigit@intel.com; aboyer@pensando.io; > > dev@dpdk.org > > Subject: Re: [RFC PATCH v2] build: kni cross-compilation support > > > > On Thu, Feb 04, 2021 at 10:51:41AM +0100, Juraj Linkeš wrote: > > > The kni linux module is using a custom target for building, which > > > doesn't take into account any cross compilation arguments. The > > > arguments in question are ARCH, CROSS_COMPILE (for gcc, clang) and CC, > > > LD (for clang). Get those from the cross file and pass them to the > > > custom target. > > > > > > The user supplied path may not contain the 'build' directory, such as > > > when using cross-compiled headers, so only append that in the default > > > case (when no path is supplied in native builds) and use the > > > unmodified path from the user otherwise. Also modify the install path > > accordingly. > > > > > > Signed-off-by: Juraj Linkeš > > > > Some comments inline below. > > > > Thanks, these are very helpful. > > > > > > > +kernel_version = run_command('uname', '-r').stdout().strip() > > > > Rename to "host_kernel_version" and probably should be only queried in the > > native build case. > > > > In meson vernicular the host machine is where the binaries will be running, i.e. what we're building for, so this may be a bit confusing - we could name it build_machine_kernel_version. > In any case, I'll move to the the native build if branch. But then maybe we don't need to rename it? > Agreed. > > > +cross_args = [] > > > # if we are cross-compiling we need kernel_dir specified -if > > > get_option('kernel_dir') == '' and meson.is_cross_build() > > > - error('Need "kernel_dir" option for kmod compilation when cross- > > compiling') > > > +if meson.is_cross_build() > > > endif > > > > > > > The block for cross-compiling is fairly large and complex, so I'm wondering how > > we can simplify things a bit. If we had multiple kernel modules I'd suggest > > splitting thing up into a native and cross-build subdirectories to get the build > > info, but that seems like overkill here. > > This configuration would be the same for all kernel modules (right?), so I'm not sure how the number of kernel modules is relevant here. > If we split it, what would the dir structure look like? Something like this? > kernel/linux/ > ├── aarch64 > ├── native > ├── kni > ├── > Yep, that would be the structure - though perhaps with "cross" rather than "aarch64" being the alternative to "native". The reason I felt that the number of kmods was relevant is that it would be really weird to have 2 subdirectories for infrastructure for a single directory containing one module - a 200% percent overhead ratio. :-) Therefore, I thinking keeping it all in one file is best, but we'll see after the next revision how it looks. > > Instead I wonder if it would work better to > > handle all the native case initially in a hopefully simpler "if block" and then do > > subdir_done(), leaving everything else to be the cross-compilation recipe and > > saving at least one level of indentation. > > > > Wouldn't we need to duplicate the code that does make kernelversion and subdirs the actaul modules? > Definitely yes for the subdir call, but that is only one line now. The "make kernelversion" call - is that needed in the cross-compile case since one explicitly has to pass in the kernel directories? My original thinking was to use it to check for the sources more in the native case where we are picking up paths automatically. Again, it's only a line or two duplicated. Alternatively, that check could be moved to the "kni" directory meson.build file, which would make it common.