build: add meson.build for kni kernel module
Checks
Commit Message
A Kbuild is also included to allow users to use DKMS natively without
additional code.
Signed-off-by: Luca Boccassi <bluca@debian.org>
---
build-tested on debian sid am64
kernel/linux/kni/Kbuild | 8 ++++++
kernel/linux/kni/meson.build | 51 ++++++++++++++++++++++++++++++++++++
kernel/linux/meson.build | 2 +-
3 files changed, 60 insertions(+), 1 deletion(-)
create mode 100644 kernel/linux/kni/Kbuild
create mode 100644 kernel/linux/kni/meson.build
Comments
On Thu, Oct 11, 2018 at 08:46:29PM +0100, Luca Boccassi wrote:
> A Kbuild is also included to allow users to use DKMS natively without
> additional code.
>
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> build-tested on debian sid am64
>
> kernel/linux/kni/Kbuild | 8 ++++++
> kernel/linux/kni/meson.build | 51 ++++++++++++++++++++++++++++++++++++
> kernel/linux/meson.build | 2 +-
> 3 files changed, 60 insertions(+), 1 deletion(-)
> create mode 100644 kernel/linux/kni/Kbuild
> create mode 100644 kernel/linux/kni/meson.build
>
I get a couple of errors building this on Fedora 28. First problem is that
I get a compilation error for a missing rte_fifo.h. The fix for that error
is to ensure the current dir is on the include list:
' -I' + meson.build_root() +
+ ' -I' + meson.current_source_dir() +
' -I' + meson.current_source_dir() + '/ethtool/ixgbe' +
Then I hit a second error, where the compile fails because the output
directory for the ethdev files does not exist.
Fatal error: can't create /home/bruce/dpdk-clean/build-gcc-static/kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.o: No such file or directory
make[1]: *** [scripts/Makefile.build:318: /home/bruce/dpdk-clean/build-gcc-static/kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.o] Error 2
I haven't fixed this, but I think the easiest fix is probably to split the
file lists so that each file is listed in a meson.build in its own
subdirectory. Then using subdir to build up the file list rather than
having it all at one gom should cause meson to create the subdirectory
structure in the build directory.
There may be other, better solutions, though.
/Bruce
On Fri, 2018-10-12 at 15:09 +0100, Bruce Richardson wrote:
> On Thu, Oct 11, 2018 at 08:46:29PM +0100, Luca Boccassi wrote:
> > A Kbuild is also included to allow users to use DKMS natively
> > without
> > additional code.
> >
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > build-tested on debian sid am64
> >
> > kernel/linux/kni/Kbuild | 8 ++++++
> > kernel/linux/kni/meson.build | 51
> > ++++++++++++++++++++++++++++++++++++
> > kernel/linux/meson.build | 2 +-
> > 3 files changed, 60 insertions(+), 1 deletion(-)
> > create mode 100644 kernel/linux/kni/Kbuild
> > create mode 100644 kernel/linux/kni/meson.build
> >
>
> I get a couple of errors building this on Fedora 28. First problem is
> that
> I get a compilation error for a missing rte_fifo.h. The fix for that
> error
> is to ensure the current dir is on the include list:
>
> ' -I' + meson.build_root() +
> + ' -I' + meson.current_source_dir() +
> ' -I' + meson.current_source_dir() + '/ethtool/ixgbe'
> +
>
> Then I hit a second error, where the compile fails because the output
> directory for the ethdev files does not exist.
>
> Fatal error: can't create /home/bruce/dpdk-clean/build-gcc-
> static/kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.o: No such file
> or directory
> make[1]: *** [scripts/Makefile.build:318: /home/bruce/dpdk-
> clean/build-gcc-
> static/kernel/linux/kni/ethtool/ixgbe/ixgbe_ethtool.o] Error 2
>
> I haven't fixed this, but I think the easiest fix is probably to
> split the
> file lists so that each file is listed in a meson.build in its own
> subdirectory. Then using subdir to build up the file list rather than
> having it all at one gom should cause meson to create the
> subdirectory
> structure in the build directory.
> There may be other, better solutions, though.
>
> /Bruce
Hi,
Interesting, I guess it's down to differences between the kernel
makefiles in Debian and Fedora? Although the include one is strange.
I've sent a v2 with your suggestions, please give it a run when you've
got a sec.
new file mode 100644
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+
+ccflags-y := $(MODULE_CFLAGS)
+obj-m := rte_kni.o
+rte_kni-y := $(patsubst $(src)/%.c,%.o,$(wildcard $(src)/*.c)) \
+ $(patsubst $(src)/%.c,%.o,$(wildcard $(src)/ethtool/ixgbe/*.c)) \
+ $(patsubst $(src)/%.c,%.o,$(wildcard $(src)/ethtool/igb/*.c))
new file mode 100644
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
+
+kni_mkfile = custom_target('rte_kni_makefile',
+ output: 'Makefile',
+ command: ['touch', '@OUTPUT@'])
+
+kni_sources = [
+ 'kni_ethtool.c',
+ 'kni_misc.c',
+ 'kni_net.c',
+ 'ethtool/igb/e1000_82575.c',
+ 'ethtool/igb/e1000_api.c',
+ 'ethtool/igb/e1000_i210.c',
+ 'ethtool/igb/e1000_mac.c',
+ 'ethtool/igb/e1000_manage.c',
+ 'ethtool/igb/e1000_mbx.c',
+ 'ethtool/igb/e1000_nvm.c',
+ 'ethtool/igb/e1000_phy.c',
+ 'ethtool/igb/igb_ethtool.c',
+ 'ethtool/igb/igb_main.c',
+ 'ethtool/igb/igb_param.c',
+ 'ethtool/igb/igb_vmdq.c',
+ 'ethtool/ixgbe/ixgbe_82598.c',
+ 'ethtool/ixgbe/ixgbe_82599.c',
+ 'ethtool/ixgbe/ixgbe_api.c',
+ 'ethtool/ixgbe/ixgbe_common.c',
+ 'ethtool/ixgbe/ixgbe_ethtool.c',
+ 'ethtool/ixgbe/ixgbe_main.c',
+ 'ethtool/ixgbe/ixgbe_phy.c',
+ 'ethtool/ixgbe/ixgbe_x540.c',
+ 'ethtool/ixgbe/kcompat.c',
+ 'Kbuild']
+
+custom_target('rte_kni',
+ input: kni_sources,
+ output: 'rte_kni.ko',
+ command: ['make', '-C', kernel_dir,
+ 'M=' + meson.current_build_dir(),
+ 'src=' + meson.current_source_dir(),
+ 'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
+ ' -I' + meson.source_root() + '/lib/librte_eal/common/include' +
+ ' -I' + meson.source_root() + '/lib/librte_eal/linuxapp/eal/include' +
+ ' -I' + meson.build_root() +
+ ' -I' + meson.current_source_dir() + '/ethtool/ixgbe' +
+ ' -I' + meson.current_source_dir() + '/ethtool/igb',
+ 'modules'],
+ depends: kni_mkfile,
+ install: true,
+ install_dir: kernel_dir + '/../extra/dpdk',
+ build_by_default: get_option('enable_kmods'))
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation
-subdirs = ['igb_uio']
+subdirs = ['igb_uio', 'kni']
WARN_CROSS_COMPILE='Need "kernel_dir" option for kmod compilation when cross-compiling'
WARN_NO_HEADERS='Cannot compile kernel modules as requested - are kernel headers installed?'