From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luca Boccassi Subject: Re: [PATCH 03/17] igb_uio: add igb_uio kmod to meson build Date: Fri, 01 Sep 2017 14:32:52 +0100 Message-ID: <1504272772.31011.2.camel@gmail.com> References: <20170901100416.80264-1-bruce.richardson@intel.com> <20170901100416.80264-4-bruce.richardson@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable To: Bruce Richardson , dev@dpdk.org Return-path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id ED2687CB6 for ; Fri, 1 Sep 2017 15:32:56 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id e204so226722wma.2 for ; Fri, 01 Sep 2017 06:32:56 -0700 (PDT) In-Reply-To: <20170901100416.80264-4-bruce.richardson@intel.com> 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, 2017-09-01 at 11:04 +0100, Bruce Richardson wrote: > Support building igb_uio using meson and ninja. For this, we still > use the > kernel's kbuild system, by calling out to make, since it's safer and > easier > than trying to reproduce that in meson. A list of suitable file > dependencies is given so that we have a reasonable chance of a > rebuild when > necessary. >=20 > Signed-off-by: Bruce Richardson > --- > =C2=A0lib/librte_eal/linuxapp/igb_uio/Kbuild=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0|=C2=A0=C2=A01 + > =C2=A0lib/librte_eal/linuxapp/igb_uio/meson.build | 47 > +++++++++++++++++++++++++++++ > =C2=A0lib/librte_eal/linuxapp/meson.build=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0| 10 ++++++ > =C2=A0meson_options.txt=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A02 ++ > =C2=A04 files changed, 60 insertions(+) > =C2=A0create mode 100644 lib/librte_eal/linuxapp/igb_uio/Kbuild > =C2=A0create mode 100644 lib/librte_eal/linuxapp/igb_uio/meson.build >=20 > diff --git a/lib/librte_eal/linuxapp/igb_uio/Kbuild > b/lib/librte_eal/linuxapp/igb_uio/Kbuild > new file mode 100644 > index 000000000..98c98fe52 > --- /dev/null > +++ b/lib/librte_eal/linuxapp/igb_uio/Kbuild > @@ -0,0 +1 @@ > +obj-m :=3D igb_uio.o > diff --git a/lib/librte_eal/linuxapp/igb_uio/meson.build > b/lib/librte_eal/linuxapp/igb_uio/meson.build > new file mode 100644 > index 000000000..c046e1d66 > --- /dev/null > +++ b/lib/librte_eal/linuxapp/igb_uio/meson.build > @@ -0,0 +1,47 @@ > +#=C2=A0=C2=A0=C2=A0BSD LICENSE > +# > +#=C2=A0=C2=A0=C2=A0Copyright(c) 2017 Intel Corporation. All rights reser= ved. > +#=C2=A0=C2=A0=C2=A0All rights reserved. > +# > +#=C2=A0=C2=A0=C2=A0Redistribution and use in source and binary forms, wi= th or > without > +#=C2=A0=C2=A0=C2=A0modification, are permitted provided that the followi= ng > conditions > +#=C2=A0=C2=A0=C2=A0are met: > +# > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Redistributions of source code must ret= ain the above > copyright > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0notice, this list of conditio= ns and the following > disclaimer. > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Redistributions in binary form must rep= roduce the above > copyright > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0notice, this list of conditio= ns and the following disclaimer > in > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0the documentation and/or othe= r materials provided with the > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0distribution. > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Neither the name of Intel Corporation n= or the names of its > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0contributors may be used to e= ndorse or promote products > derived > +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0from this software without sp= ecific prior written > permission. > +# > +#=C2=A0=C2=A0=C2=A0THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AN= D > CONTRIBUTORS > +#=C2=A0=C2=A0=C2=A0"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUD= ING, BUT > NOT > +#=C2=A0=C2=A0=C2=A0LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY= AND > FITNESS FOR > +#=C2=A0=C2=A0=C2=A0A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHAL= L THE > COPYRIGHT > +#=C2=A0=C2=A0=C2=A0OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIR= ECT, > INCIDENTAL, > +#=C2=A0=C2=A0=C2=A0SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDI= NG, BUT NOT > +#=C2=A0=C2=A0=C2=A0LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVIC= ES; LOSS OF > USE, > +#=C2=A0=C2=A0=C2=A0DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER C= AUSED AND > ON ANY > +#=C2=A0=C2=A0=C2=A0THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIAB= ILITY, OR > TORT > +#=C2=A0=C2=A0=C2=A0(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WA= Y OUT OF > THE USE > +#=C2=A0=C2=A0=C2=A0OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY = OF SUCH > DAMAGE. > + > +mkfile =3D custom_target('igb_uio_makefile', > + output: 'Makefile', > + command: ['touch', '@OUTPUT@']) > + > +custom_target('igb_uio', > + input: ['igb_uio.c', 'Kbuild'], > + output: 'igb_uio.ko', > + command: ['make', '-C', kernel_dir, > + 'M=3D' + meson.current_build_dir(), > + 'src=3D' + meson.current_source_dir(), > + 'EXTRA_CFLAGS=3D-I' + meson.current_source_dir() + > + '/../../common/include', > + 'modules'], > + depends: mkfile, > + depend_files: [join_paths(kernel_dir, 'Kconfig')], Can this be made optional somehow? There's no build/Kconfig on Debian: $ ls /lib/modules/4.9.0-3-amd64/build arch=C2=A0=C2=A0include=C2=A0=C2=A0Makefile=C2=A0=C2=A0Module.symvers=C2=A0= =C2=A0scripts But the build works fine without that depend_files line. > + build_by_default: true) > diff --git a/lib/librte_eal/linuxapp/meson.build > b/lib/librte_eal/linuxapp/meson.build > index bc9f22175..2383bd368 100644 > --- a/lib/librte_eal/linuxapp/meson.build > +++ b/lib/librte_eal/linuxapp/meson.build > @@ -30,3 +30,13 @@ > =C2=A0#=C2=A0=C2=A0=C2=A0OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBI= LITY OF SUCH > DAMAGE. > =C2=A0 > =C2=A0subdir('eal') > + > +if get_option('enable_kmods') > + kernel_dir =3D get_option('kernel_dir') > + if kernel_dir =3D=3D '' > + kernel_version =3D run_command('uname', '- > r').stdout().strip() > + kernel_dir =3D '/lib/modules/' + kernel_version + > '/build' > + endif > + > + subdir('igb_uio') > +endif > diff --git a/meson_options.txt b/meson_options.txt > index c03b79fbd..9c45b8159 100644 > --- a/meson_options.txt > +++ b/meson_options.txt > @@ -4,3 +4,5 @@ option('max_numa_nodes', type: 'string', value: '4', > description: 'maximum numbe > =C2=A0option('use_hpet', type: 'boolean', value: false, description: 'use > HPET timer in EAL') > =C2=A0option('allow_invalid_socket_id', type: 'boolean', value: false, > =C2=A0 description: 'allow out-of-range NUMA socket id\'s for > platforms that don\'t report the value correctly') > +option('enable_kmods', type: 'boolean', value: true, description: > 'build kernel modules') > +option('kernel_dir', type: 'string', value: '', description: 'path > to the kernel for building kernel modules') --=20 Kind regards, Luca Boccassi