Skip to contentSkip to conversation

kernel/linux: fix kernel dir for meson

PATCH Superseded Xiaolong Ye 4 participants 20 messages Dec 2, 2019 – Dec 9, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/linux: fix kernel dir for meson

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
---
 kernel/linux/igb_uio/meson.build | 2 +-
 kernel/linux/kni/meson.build     | 2 +-
 kernel/linux/meson.build         | 4 ++--
 meson_options.txt                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
kernel/linux/igb_uio/meson.build +1 -1
index fac404f07..e66218dae 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
 	input: ['igb_uio.c', 'Kbuild'],
 	output: 'igb_uio.ko',
-	command: ['make', '-C', kernel_dir + '/build',
+	command: ['make', '-C', kernel_dir,
 		'M=' + meson.current_build_dir(),
 		'src=' + meson.current_source_dir(),
 		'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
kernel/linux/kni/meson.build +1 -1
index 955eec949..9fce0c16e 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
 	input: kni_sources,
 	output: 'rte_kni.ko',
-	command: ['make', '-j4', '-C', kernel_dir + '/build',
+	command: ['make', '-j4', '-C', kernel_dir,
 		'M=' + meson.current_build_dir(),
 		'src=' + meson.current_source_dir(),
 		'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
kernel/linux/meson.build +2 -2
index 1796cc686..a37c95752 100644
@@ -13,11 +13,11 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
 	# use default path for native builds
 	kernel_version = run_command('uname', '-r').stdout().strip()
-	kernel_dir = '/lib/modules/' + kernel_version
+	kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
 		'kernelversion').returncode()
 if make_returncode != 0
 	warning('Cannot compile kernel modules as requested - are kernel headers installed?')
meson_options.txt +1 -1
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'sh
 option('include_subdir_arch', type: 'string', value: '',
 	description: 'subdirectory where to install arch-dependent headers')
 option('kernel_dir', type: 'string', value: '',
-	description: 'Path to the kernel for building kernel modules. Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+	description: 'Path to the kernel for building kernel modules. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
 option('lib_musdk_dir', type: 'string', value: '',
 	description: 'path to the MUSDK library installation directory')
 option('machine', type: 'string', value: 'native',
Signature · 1 line
2.17.1
#1 lore raw

Hi Xiaolong,

Nack from me. It's just an incorrect revert of my fix.
Kernel modules will be installed in wrong directory, just check install_dir parameter in kni/meson.build and igb_uio/meson.build.

Igor

Quoted 90 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
---
 kernel/linux/igb_uio/meson.build | 2 +-
 kernel/linux/kni/meson.build     | 2 +-
 kernel/linux/meson.build         | 4 ++--
 meson_options.txt                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
kernel/linux/igb_uio/meson.build +1 -1
index fac404f07..e66218dae 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
        input: ['igb_uio.c', 'Kbuild'],
        output: 'igb_uio.ko',
-       command: ['make', '-C', kernel_dir + '/build',
+       command: ['make', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
kernel/linux/kni/meson.build +1 -1
index 955eec949..9fce0c16e 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
        input: kni_sources,
        output: 'rte_kni.ko',
-       command: ['make', '-j4', '-C', kernel_dir + '/build',
+       command: ['make', '-j4', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'MODULE_CFLAGS=-include ' + meson.source_root() +

'/config/rte_config.h' +

kernel/linux/meson.build +2 -2
index 1796cc686..a37c95752 100644
@@ -13,11 +13,11 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
        # use default path for native builds
        kernel_version = run_command('uname', '-r').stdout().strip()
-       kernel_dir = '/lib/modules/' + kernel_version
+       kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
                'kernelversion').returncode()
 if make_returncode != 0
        warning('Cannot compile kernel modules as requested - are kernel

headers installed?')

meson_options.txt +0 -0
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices :

['shared', 'dlopen'], value: 'sh
option('include_subdir_arch', type: 'string', value: '',
description: 'subdirectory where to install arch-dependent
headers')
option('kernel_dir', type: 'string', value: '',
- description: 'Path to the kernel for building kernel modules.
Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+ description: 'Path to the kernel for building kernel modules.
Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
option('lib_musdk_dir', type: 'string', value: '',
description: 'path to the MUSDK library installation directory')
option('machine', type: 'string', value: 'native',
--
2.17.1

#2 lore raw

Hi, Igor

Thanks for the feedback.

Quoted 4 lines · Igor Ryzhov

Hi Xiaolong,

Nack from me. It's just an incorrect revert of my fix.
Kernel modules will be installed in wrong directory, just check install_dir

Is there any convention that we must install kernel modules to which directory? And what about for cross compilation case?

Current issue is that if I specify kernel_dir as one local linux src dir in meson_options.txt,
meson build would fail to compile kernel modules while setting RTE_KERNELDIR='/<xxx>/build_dir/target-x86_64_glibc/linux-x86_64/linux-4.19.81/' before make works fine. Is there any subtlety I have missed?

Thanks,
Xiaolong

Quoted 96 lines

parameter in kni/meson.build and igb_uio/meson.build.

Igor

Quoted 90 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
---
 kernel/linux/igb_uio/meson.build | 2 +-
 kernel/linux/kni/meson.build     | 2 +-
 kernel/linux/meson.build         | 4 ++--
 meson_options.txt                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
kernel/linux/igb_uio/meson.build +1 -1
index fac404f07..e66218dae 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
        input: ['igb_uio.c', 'Kbuild'],
        output: 'igb_uio.ko',
-       command: ['make', '-C', kernel_dir + '/build',
+       command: ['make', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
kernel/linux/kni/meson.build +1 -1
index 955eec949..9fce0c16e 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
        input: kni_sources,
        output: 'rte_kni.ko',
-       command: ['make', '-j4', '-C', kernel_dir + '/build',
+       command: ['make', '-j4', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'MODULE_CFLAGS=-include ' + meson.source_root() +

'/config/rte_config.h' +

kernel/linux/meson.build +2 -2
index 1796cc686..a37c95752 100644
@@ -13,11 +13,11 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
        # use default path for native builds
        kernel_version = run_command('uname', '-r').stdout().strip()
-       kernel_dir = '/lib/modules/' + kernel_version
+       kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
                'kernelversion').returncode()
 if make_returncode != 0
        warning('Cannot compile kernel modules as requested - are kernel

headers installed?')

meson_options.txt +0 -0
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices :

['shared', 'dlopen'], value: 'sh
option('include_subdir_arch', type: 'string', value: '',
description: 'subdirectory where to install arch-dependent
headers')
option('kernel_dir', type: 'string', value: '',
- description: 'Path to the kernel for building kernel modules.
Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+ description: 'Path to the kernel for building kernel modules.
Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
option('lib_musdk_dir', type: 'string', value: '',
description: 'path to the MUSDK library installation directory')
option('machine', type: 'string', value: 'native',
--
2.17.1

#3 lore raw

We should at least install it into /lib/modules/kernel-version. For convenience, dpdk modules are installed into /lib/modules/kernel-version/extra/dpdk.
In the cross-compilation case, you can use DEST_DIR to set some prefix.

I don't really see the issue here. The description clearly says that headers must be in $kernel_dir/build which is usually a symlink to /usr/src/linux-headers-kernel-version.
Just set kernel_dir correctly and there won't be compilation failure.

Igor

Quoted 121 lines · Ye Xiaolong

Hi, Igor

Thanks for the feedback.

Quoted 4 lines · Igor Ryzhov

Hi Xiaolong,

Nack from me. It's just an incorrect revert of my fix. Kernel modules will be installed in wrong directory, just check

install_dir

Is there any convention that we must install kernel modules to which directory?
And what about for cross compilation case?

Current issue is that if I specify kernel_dir as one local linux src dir in meson_options.txt,
meson build would fail to compile kernel modules while setting RTE_KERNELDIR='/<xxx>/build_dir/target-x86_64_glibc/linux-x86_64/linux-4.19.81/' before make works fine. Is there any subtlety I have missed?

Thanks,
Xiaolong

Quoted 96 lines

parameter in kni/meson.build and igb_uio/meson.build.

Igor

Quoted 90 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
---
 kernel/linux/igb_uio/meson.build | 2 +-
 kernel/linux/kni/meson.build     | 2 +-
 kernel/linux/meson.build         | 4 ++--
 meson_options.txt                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
kernel/linux/igb_uio/meson.build +1 -1
index fac404f07..e66218dae 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
        input: ['igb_uio.c', 'Kbuild'],
        output: 'igb_uio.ko',
-       command: ['make', '-C', kernel_dir + '/build',
+       command: ['make', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
kernel/linux/kni/meson.build +1 -1
index 955eec949..9fce0c16e 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
        input: kni_sources,
        output: 'rte_kni.ko',
-       command: ['make', '-j4', '-C', kernel_dir + '/build',
+       command: ['make', '-j4', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'MODULE_CFLAGS=-include ' + meson.source_root() +

'/config/rte_config.h' +

kernel/linux/meson.build +2 -2
index 1796cc686..a37c95752 100644
@@ -13,11 +13,11 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
        # use default path for native builds
        kernel_version = run_command('uname', '-r').stdout().strip()
-       kernel_dir = '/lib/modules/' + kernel_version
+       kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
                'kernelversion').returncode()
 if make_returncode != 0
        warning('Cannot compile kernel modules as requested - are kernel

headers installed?')

meson_options.txt +0 -0
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices :

['shared', 'dlopen'], value: 'sh
option('include_subdir_arch', type: 'string', value: '',
description: 'subdirectory where to install arch-dependent
headers')
option('kernel_dir', type: 'string', value: '',
- description: 'Path to the kernel for building kernel modules.
Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+ description: 'Path to the kernel for building kernel modules.
Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
option('lib_musdk_dir', type: 'string', value: '',
description: 'path to the MUSDK library installation directory')
option('machine', type: 'string', value: 'native',
--
2.17.1

#4 lore raw
Quoted 9 lines · Igor Ryzhov

We should at least install it into /lib/modules/kernel-version. For convenience, dpdk modules are installed into /lib/modules/kernel-version/extra/dpdk.
In the cross-compilation case, you can use DEST_DIR to set some prefix.

I don't really see the issue here. The description clearly says that headers must be in $kernel_dir/build which is usually a symlink to /usr/src/linux-headers-kernel-version.
Just set kernel_dir correctly and there won't be compilation failure.

I think for cross-compilation case, user should be allowed to specify any kernel src dir (it doesn't have to be /lib/modules/kernel-version) in his local system as kernel_dir that doesn't contain the build dir, in this case, current meson build will skip kernel module compilation.

Thanks,
Xiaolong

Quoted 126 lines

Igor

Quoted 121 lines · Ye Xiaolong

Hi, Igor

Thanks for the feedback.

Quoted 4 lines · Igor Ryzhov

Hi Xiaolong,

Nack from me. It's just an incorrect revert of my fix. Kernel modules will be installed in wrong directory, just check

install_dir

Is there any convention that we must install kernel modules to which directory?
And what about for cross compilation case?

Current issue is that if I specify kernel_dir as one local linux src dir in meson_options.txt,
meson build would fail to compile kernel modules while setting RTE_KERNELDIR='/<xxx>/build_dir/target-x86_64_glibc/linux-x86_64/linux-4.19.81/' before make works fine. Is there any subtlety I have missed?

Thanks,
Xiaolong

Quoted 96 lines

parameter in kni/meson.build and igb_uio/meson.build.

Igor

Quoted 90 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
---
 kernel/linux/igb_uio/meson.build | 2 +-
 kernel/linux/kni/meson.build     | 2 +-
 kernel/linux/meson.build         | 4 ++--
 meson_options.txt                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
kernel/linux/igb_uio/meson.build +1 -1
index fac404f07..e66218dae 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
        input: ['igb_uio.c', 'Kbuild'],
        output: 'igb_uio.ko',
-       command: ['make', '-C', kernel_dir + '/build',
+       command: ['make', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
kernel/linux/kni/meson.build +1 -1
index 955eec949..9fce0c16e 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
        input: kni_sources,
        output: 'rte_kni.ko',
-       command: ['make', '-j4', '-C', kernel_dir + '/build',
+       command: ['make', '-j4', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'MODULE_CFLAGS=-include ' + meson.source_root() +

'/config/rte_config.h' +

kernel/linux/meson.build +2 -2
index 1796cc686..a37c95752 100644
@@ -13,11 +13,11 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
        # use default path for native builds
        kernel_version = run_command('uname', '-r').stdout().strip()
-       kernel_dir = '/lib/modules/' + kernel_version
+       kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
                'kernelversion').returncode()
 if make_returncode != 0
        warning('Cannot compile kernel modules as requested - are kernel

headers installed?')

meson_options.txt +0 -0
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices :

['shared', 'dlopen'], value: 'sh
option('include_subdir_arch', type: 'string', value: '',
description: 'subdirectory where to install arch-dependent
headers')
option('kernel_dir', type: 'string', value: '',
- description: 'Path to the kernel for building kernel modules.
Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+ description: 'Path to the kernel for building kernel modules.
Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
option('lib_musdk_dir', type: 'string', value: '',
description: 'path to the MUSDK library installation directory')
option('machine', type: 'string', value: 'native',
--
2.17.1

#5 lore raw
Quoted 11 lines · Ye Xiaolong
Quoted 9 lines · Igor Ryzhov

We should at least install it into /lib/modules/kernel-version. For convenience, dpdk modules are installed into /lib/modules/kernel-version/extra/dpdk.
In the cross-compilation case, you can use DEST_DIR to set some prefix.

I don't really see the issue here. The description clearly says that headers must be in $kernel_dir/build which is usually a symlink to /usr/src/linux-headers-kernel-version.
Just set kernel_dir correctly and there won't be compilation failure.

Quoted 5 lines

I think for cross-compilation case, user should be allowed to specify any kernel src dir (it doesn't have to be /lib/modules/kernel-version) in his local system as kernel_dir that doesn't contain the build dir, in this case, current meson build will skip kernel module compilation.

I don't think we can take this change as the default, since the previous fix was put in for good reason.

However, perhaps we can attempt to support both, using the checks below for "make kernelversion" in kernel/linux/meson.build. We can attempt using the directory with /build (as now) and then if that fails attempt without it (or vice versa).

/Bruce

Quoted 127 lines
Quoted 127 lines

Igor

Quoted 121 lines · Ye Xiaolong

Hi, Igor

Thanks for the feedback.

Quoted 4 lines · Igor Ryzhov

Hi Xiaolong,

Nack from me. It's just an incorrect revert of my fix. Kernel modules will be installed in wrong directory, just check

install_dir

Is there any convention that we must install kernel modules to which directory?
And what about for cross compilation case?

Current issue is that if I specify kernel_dir as one local linux src dir in meson_options.txt,
meson build would fail to compile kernel modules while setting RTE_KERNELDIR='/<xxx>/build_dir/target-x86_64_glibc/linux-x86_64/linux-4.19.81/' before make works fine. Is there any subtlety I have missed?

Thanks,
Xiaolong

Quoted 96 lines

parameter in kni/meson.build and igb_uio/meson.build.

Igor

Quoted 90 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
---
 kernel/linux/igb_uio/meson.build | 2 +-
 kernel/linux/kni/meson.build     | 2 +-
 kernel/linux/meson.build         | 4 ++--
 meson_options.txt                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
kernel/linux/igb_uio/meson.build +1 -1
index fac404f07..e66218dae 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
        input: ['igb_uio.c', 'Kbuild'],
        output: 'igb_uio.ko',
-       command: ['make', '-C', kernel_dir + '/build',
+       command: ['make', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
kernel/linux/kni/meson.build +1 -1
index 955eec949..9fce0c16e 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
        input: kni_sources,
        output: 'rte_kni.ko',
-       command: ['make', '-j4', '-C', kernel_dir + '/build',
+       command: ['make', '-j4', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'MODULE_CFLAGS=-include ' + meson.source_root() +

'/config/rte_config.h' +

kernel/linux/meson.build +2 -2
index 1796cc686..a37c95752 100644
@@ -13,11 +13,11 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
        # use default path for native builds
        kernel_version = run_command('uname', '-r').stdout().strip()
-       kernel_dir = '/lib/modules/' + kernel_version
+       kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
                'kernelversion').returncode()
 if make_returncode != 0
        warning('Cannot compile kernel modules as requested - are kernel

headers installed?')

meson_options.txt +0 -0
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices :

['shared', 'dlopen'], value: 'sh
option('include_subdir_arch', type: 'string', value: '',
description: 'subdirectory where to install arch-dependent
headers')
option('kernel_dir', type: 'string', value: '',
- description: 'Path to the kernel for building kernel modules.
Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+ description: 'Path to the kernel for building kernel modules.
Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
option('lib_musdk_dir', type: 'string', value: '',
description: 'path to the MUSDK library installation directory')
option('machine', type: 'string', value: 'native',
--
2.17.1

#6 lore raw
Quoted 18 lines · Bruce Richardson
Quoted 11 lines · Ye Xiaolong
Quoted 9 lines · Igor Ryzhov

We should at least install it into /lib/modules/kernel-version. For convenience, dpdk modules are installed into /lib/modules/kernel-version/extra/dpdk.
In the cross-compilation case, you can use DEST_DIR to set some prefix.

I don't really see the issue here. The description clearly says that headers must be in $kernel_dir/build which is usually a symlink to /usr/src/linux-headers-kernel-version.
Just set kernel_dir correctly and there won't be compilation failure.

Quoted 5 lines

I think for cross-compilation case, user should be allowed to specify any kernel src dir (it doesn't have to be /lib/modules/kernel-version) in his local system as kernel_dir that doesn't contain the build dir, in this case, current meson build will skip kernel module compilation.

Quoted 7 lines

I don't think we can take this change as the default, since the previous fix was put in for good reason.

However, perhaps we can attempt to support both, using the checks below for "make kernelversion" in kernel/linux/meson.build. We can attempt using the directory with /build (as now) and then if that fails attempt without it (or vice versa).

Thanks for the suggestion, I think it works for checking phase, and we still some tricks for "make -C <kernel_dir>" to let it works for both cases, I'll try to figure out.

Thanks,
Xiaolong

Quoted 130 lines

/Bruce

Quoted 127 lines
Quoted 127 lines

Igor

Quoted 121 lines · Ye Xiaolong

Hi, Igor

Thanks for the feedback.

Quoted 4 lines · Igor Ryzhov

Hi Xiaolong,

Nack from me. It's just an incorrect revert of my fix. Kernel modules will be installed in wrong directory, just check

install_dir

Is there any convention that we must install kernel modules to which directory?
And what about for cross compilation case?

Current issue is that if I specify kernel_dir as one local linux src dir in meson_options.txt,
meson build would fail to compile kernel modules while setting RTE_KERNELDIR='/<xxx>/build_dir/target-x86_64_glibc/linux-x86_64/linux-4.19.81/' before make works fine. Is there any subtlety I have missed?

Thanks,
Xiaolong

Quoted 96 lines

parameter in kni/meson.build and igb_uio/meson.build.

Igor

Quoted 90 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
---
 kernel/linux/igb_uio/meson.build | 2 +-
 kernel/linux/kni/meson.build     | 2 +-
 kernel/linux/meson.build         | 4 ++--
 meson_options.txt                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
kernel/linux/igb_uio/meson.build +1 -1
index fac404f07..e66218dae 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
        input: ['igb_uio.c', 'Kbuild'],
        output: 'igb_uio.ko',
-       command: ['make', '-C', kernel_dir + '/build',
+       command: ['make', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
kernel/linux/kni/meson.build +1 -1
index 955eec949..9fce0c16e 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
        input: kni_sources,
        output: 'rte_kni.ko',
-       command: ['make', '-j4', '-C', kernel_dir + '/build',
+       command: ['make', '-j4', '-C', kernel_dir,
                'M=' + meson.current_build_dir(),
                'src=' + meson.current_source_dir(),
                'MODULE_CFLAGS=-include ' + meson.source_root() +

'/config/rte_config.h' +

kernel/linux/meson.build +2 -2
index 1796cc686..a37c95752 100644
@@ -13,11 +13,11 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
        # use default path for native builds
        kernel_version = run_command('uname', '-r').stdout().strip()
-       kernel_dir = '/lib/modules/' + kernel_version
+       kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
                'kernelversion').returncode()
 if make_returncode != 0
        warning('Cannot compile kernel modules as requested - are kernel

headers installed?')

meson_options.txt +0 -0
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices :

['shared', 'dlopen'], value: 'sh
option('include_subdir_arch', type: 'string', value: '',
description: 'subdirectory where to install arch-dependent
headers')
option('kernel_dir', type: 'string', value: '',
- description: 'Path to the kernel for building kernel modules.
Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+ description: 'Path to the kernel for building kernel modules.
Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
option('lib_musdk_dir', type: 'string', value: '',
description: 'path to the MUSDK library installation directory')
option('machine', type: 'string', value: 'native',
--
2.17.1

#7 lore raw
In reply to Bruce Richardson
Quoted 18 lines · Bruce Richardson
Quoted 11 lines · Ye Xiaolong
Quoted 9 lines · Igor Ryzhov

We should at least install it into /lib/modules/kernel-version. For convenience, dpdk modules are installed into /lib/modules/kernel-version/extra/dpdk.
In the cross-compilation case, you can use DEST_DIR to set some prefix.

I don't really see the issue here. The description clearly says that headers must be in $kernel_dir/build which is usually a symlink to /usr/src/linux-headers-kernel-version.
Just set kernel_dir correctly and there won't be compilation failure.

Quoted 5 lines

I think for cross-compilation case, user should be allowed to specify any kernel src dir (it doesn't have to be /lib/modules/kernel-version) in his local system as kernel_dir that doesn't contain the build dir, in this case, current meson build will skip kernel module compilation.

Quoted 7 lines

I don't think we can take this change as the default, since the previous fix was put in for good reason.

However, perhaps we can attempt to support both, using the checks below for "make kernelversion" in kernel/linux/meson.build. We can attempt using the directory with /build (as now) and then if that fails attempt without it (or vice versa).

After a second thought, I think it'd be better that we unify the meaning of kernel_dir for both cases, it should be aligned with make's RTE_KERNELDIR variable that specify the directory contains kernel src code (or header), then we don't need to distinguish these 2 cases in check (make kernelversion) phase, we just need to assign different install dirs,

For normal case:

kernel_dir=/lib/modules/<kernel_version>/build install_dir=/lib/modules/<kernel_version>/extra/dpdk

For cross compilation case:

kernel_dir=<Any kernel src dir specified by user> install_dir=<Any kernel src dir specified by user>/extra/dpdk

What do you think (I've sent v2 according to above description)?

Thanks,
Xiaolong

Quoted 2 lines

/Bruce

#8 lore raw
Quoted 38 lines · Ye Xiaolong
Quoted 18 lines · Bruce Richardson
Quoted 11 lines · Ye Xiaolong
Quoted 9 lines · Igor Ryzhov

We should at least install it into /lib/modules/kernel-version. For convenience, dpdk modules are installed into /lib/modules/kernel-version/extra/dpdk.
In the cross-compilation case, you can use DEST_DIR to set some prefix.

I don't really see the issue here. The description clearly says that headers must be in $kernel_dir/build which is usually a symlink to /usr/src/linux-headers-kernel-version.
Just set kernel_dir correctly and there won't be compilation failure.

Quoted 5 lines

I think for cross-compilation case, user should be allowed to specify any kernel src dir (it doesn't have to be /lib/modules/kernel-version) in his local system as kernel_dir that doesn't contain the build dir, in this case, current meson build will skip kernel module compilation.

Quoted 7 lines

I don't think we can take this change as the default, since the previous fix was put in for good reason.

However, perhaps we can attempt to support both, using the checks below for "make kernelversion" in kernel/linux/meson.build. We can attempt using the directory with /build (as now) and then if that fails attempt without it (or vice versa).

After a second thought, I think it'd be better that we unify the meaning of kernel_dir for both cases, it should be aligned with make's RTE_KERNELDIR variable that specify the directory contains kernel src code (or header), then we don't need to distinguish these 2 cases in check (make kernelversion) phase, we just need to assign different install dirs,

For normal case:

kernel_dir=/lib/modules/<kernel_version>/build install_dir=/lib/modules/<kernel_version>/extra/dpdk

Quoted 7 lines

For cross compilation case:

kernel_dir=<Any kernel src dir specified by user> install_dir=<Any kernel src dir specified by user>/extra/dpdk

What do you think (I've sent v2 according to above description)?

The downside of what you propose is that it will break any builds which are already working by passing in the base kerneldir folder as parameter. That case needs to be kept working, so you cannot force the user to pass in the path with /build on the end.

/Bruce

#9 lore raw

PATCH v2 1/1 kernel/linux: fix kernel dir for meson

In reply to Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

---

V2 changes:

1. handle both normal and cross-compilation cases

 kernel/linux/igb_uio/meson.build |  4 ++--
 kernel/linux/kni/meson.build     |  4 ++--
 kernel/linux/meson.build         | 11 +++++++++--
 meson_options.txt                |  2 +-
 4 files changed, 14 insertions(+), 7 deletions(-)
kernel/linux/igb_uio/meson.build +2 -2
index fac404f07..63990372e 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
 	input: ['igb_uio.c', 'Kbuild'],
 	output: 'igb_uio.ko',
-	command: ['make', '-C', kernel_dir + '/build',
+	command: ['make', '-C', kernel_dir,
 		'M=' + meson.current_build_dir(),
 		'src=' + meson.current_source_dir(),
 		'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
@@ -16,5 +16,5 @@ custom_target('igb_uio',
 		'modules'],
 	depends: mkfile,
 	install: true,
-	install_dir: kernel_dir + '/extra/dpdk',
+	install_dir: install_base + '/extra/dpdk',
 	build_by_default: get_option('enable_kmods'))
kernel/linux/kni/meson.build +2 -2
index 955eec949..04c817e8a 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
 	input: kni_sources,
 	output: 'rte_kni.ko',
-	command: ['make', '-j4', '-C', kernel_dir + '/build',
+	command: ['make', '-j4', '-C', kernel_dir,
 		'M=' + meson.current_build_dir(),
 		'src=' + meson.current_source_dir(),
 		'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
@@ -25,5 +25,5 @@ custom_target('rte_kni',
 	depends: kni_mkfile,
 	console: true,
 	install: true,
-	install_dir: kernel_dir + '/extra/dpdk',
+	install_dir: install_base + '/extra/dpdk',
 	build_by_default: get_option('enable_kmods'))
kernel/linux/meson.build +9 -2
index 1796cc686..db50f79fe 100644
@@ -13,17 +13,24 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
 	# use default path for native builds
 	kernel_version = run_command('uname', '-r').stdout().strip()
-	kernel_dir = '/lib/modules/' + kernel_version
+	kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
 		'kernelversion').returncode()
 if make_returncode != 0
 	warning('Cannot compile kernel modules as requested - are kernel headers installed?')
 	subdir_done()
 endif
 
+if kernel_dir.endswith('build')
+	install_base = kernel_dir.split('build')[0]
+else
+	install_base = kernel_dir
+endif
+
+
 # DO ACTUAL MODULE BUILDING
 foreach d:subdirs
 	subdir(d)
meson_options.txt +1 -1
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'sh
 option('include_subdir_arch', type: 'string', value: '',
 	description: 'subdirectory where to install arch-dependent headers')
 option('kernel_dir', type: 'string', value: '',
-	description: 'Path to the kernel for building kernel modules. Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+	description: 'Path to the kernel for building kernel modules. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
 option('lib_musdk_dir', type: 'string', value: '',
 	description: 'path to the MUSDK library installation directory')
 option('machine', type: 'string', value: 'native',
Signature · 1 line
2.17.1
#10 lore raw
Quoted 13 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
Quoted 7 lines

---

V2 changes:

1. handle both normal and cross-compilation cases

We need to handle both, but they need to be handled without breaking the currently working case where we pass in /lib/modules/$(uname -r)/ as the kerneldir path.

/Bruce

#11 lore raw
Quoted 17 lines · Bruce Richardson
Quoted 16 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

---

Quoted 7 lines
Quoted 4 lines

V2 changes:

1. handle both normal and cross-compilation cases

We need to handle both, but they need to be handled without breaking the currently working case where we pass in /lib/modules/$(uname -r)/ as the kerneldir path.

So you mean we should allow user to specify both /lib/modules/$(uname -r) and /lib/modules/$(uname -r)/build as kernel_dir for normal case?

Thanks,
Xiaolong

Quoted 2 lines

/Bruce

#12 lore raw
Quoted 20 lines · Ye Xiaolong
Quoted 19 lines · Bruce Richardson
Quoted 18 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

---

V2 changes:

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

1. handle both normal and cross-compilation cases

We need to handle both, but they need to be handled without breaking the currently working case where we pass in /lib/modules/$(uname -r)/ as the kerneldir path.

So you mean we should allow user to specify both /lib/modules/$(uname -r) and /lib/modules/$(uname -r)/build as kernel_dir for normal case?

That is up to you, but we need to still allow the former case so as to avoid breaking backward compatibility for existing build setups. Therefore I suggest supporting both is recommended.

/Bruce

#13 lore raw
Quoted 27 lines · Bruce Richardson
Quoted 26 lines · Ye Xiaolong
Quoted 24 lines · Bruce Richardson
Quoted 13 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")
Quoted 7 lines

---

V2 changes:

1. handle both normal and cross-compilation cases

We need to handle both, but they need to be handled without breaking the currently working case where we pass in /lib/modules/$(uname -r)/ as the kerneldir path.

Quoted 6 lines
Quoted 3 lines

So you mean we should allow user to specify both /lib/modules/$(uname -r) and /lib/modules/$(uname -r)/build as kernel_dir for normal case?

That is up to you, but we need to still allow the former case so as to avoid breaking backward compatibility for existing build setups. Therefore I suggest supporting both is recommended.

Make sense, I'll try a new version.

Thanks,
Xiaolong

Quoted 2 lines

/Bruce

#14 lore raw

PATCH v3 1/1 kernel/linux: fix kernel dir for meson

In reply to Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify kernel_dir as above, this patch fixes this issue.

After this change, for normal build case, user can specify /lib/modules/<kernel_version> or /lib/modules/<kernel_version>/build as kernel_dir. For cross compilation case, user can specify any directory that contains kernel source code as the kernel_dir.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

---

V3 changes:

1. support setting both /lib/modules/<kernel_version> and /lib/modules/<kernel_version>/build as kernel_dir to keep backward compatibility

V2 changes:

1. handle both normal and cross-compilation cases

 kernel/linux/igb_uio/meson.build |  4 ++--
 kernel/linux/kni/meson.build     |  4 ++--
 kernel/linux/meson.build         | 19 +++++++++++++++----
 meson_options.txt                |  2 +-
 4 files changed, 20 insertions(+), 9 deletions(-)
kernel/linux/igb_uio/meson.build +2 -2
index fac404f07..63990372e 100644
@@ -8,7 +8,7 @@ mkfile = custom_target('igb_uio_makefile',
 custom_target('igb_uio',
 	input: ['igb_uio.c', 'Kbuild'],
 	output: 'igb_uio.ko',
-	command: ['make', '-C', kernel_dir + '/build',
+	command: ['make', '-C', kernel_dir,
 		'M=' + meson.current_build_dir(),
 		'src=' + meson.current_source_dir(),
 		'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
@@ -16,5 +16,5 @@ custom_target('igb_uio',
 		'modules'],
 	depends: mkfile,
 	install: true,
-	install_dir: kernel_dir + '/extra/dpdk',
+	install_dir: install_base + '/extra/dpdk',
 	build_by_default: get_option('enable_kmods'))
kernel/linux/kni/meson.build +2 -2
index 955eec949..04c817e8a 100644
@@ -13,7 +13,7 @@ kni_sources = files(
 custom_target('rte_kni',
 	input: kni_sources,
 	output: 'rte_kni.ko',
-	command: ['make', '-j4', '-C', kernel_dir + '/build',
+	command: ['make', '-j4', '-C', kernel_dir,
 		'M=' + meson.current_build_dir(),
 		'src=' + meson.current_source_dir(),
 		'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
@@ -25,5 +25,5 @@ custom_target('rte_kni',
 	depends: kni_mkfile,
 	console: true,
 	install: true,
-	install_dir: kernel_dir + '/extra/dpdk',
+	install_dir: install_base + '/extra/dpdk',
 	build_by_default: get_option('enable_kmods'))
kernel/linux/meson.build +15 -4
index 1796cc686..0568ed7e1 100644
@@ -13,15 +13,26 @@ kernel_dir = get_option('kernel_dir')
 if kernel_dir == ''
 	# use default path for native builds
 	kernel_version = run_command('uname', '-r').stdout().strip()
-	kernel_dir = '/lib/modules/' + kernel_version
+	kernel_dir = '/lib/modules/' + kernel_version + '/build'
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
+make_returncode = run_command('make', '-sC', kernel_dir,
 		'kernelversion').returncode()
 if make_returncode != 0
-	warning('Cannot compile kernel modules as requested - are kernel headers installed?')
-	subdir_done()
+	kernel_dir = kernel_dir + '/build'
+	make_returncode = run_command('make', '-sC', kernel_dir,
+			'kernelversion').returncode()
+	if make_returncode != 0
+		warning('Cannot compile kernel modules as requested - are kernel headers installed?')
+		subdir_done()
+	endif
+endif
+
+if kernel_dir.endswith('build') or kernel_dir.endswith('build/')
+	install_base = kernel_dir.split('build')[0]
+else
+	install_base = kernel_dir
 endif
 
 # DO ACTUAL MODULE BUILDING
meson_options.txt +1 -1
index bc369d06c..7eba3b720 100644
@@ -17,7 +17,7 @@ option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'sh
 option('include_subdir_arch', type: 'string', value: '',
 	description: 'subdirectory where to install arch-dependent headers')
 option('kernel_dir', type: 'string', value: '',
-	description: 'Path to the kernel for building kernel modules. Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
+	description: 'Path to the kernel for building kernel modules. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')
 option('lib_musdk_dir', type: 'string', value: '',
 	description: 'path to the MUSDK library installation directory')
 option('machine', type: 'string', value: 'native',
Signature · 1 line
2.17.1
#15 lore raw
Quoted 22 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make
system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify
kernel_dir as above, this patch fixes this issue.

After this change, for normal build case, user can specify /lib/modules/<kernel_version> or /lib/modules/<kernel_version>/build as
kernel_dir. For cross compilation case, user can specify any directory
that contains kernel source code as the kernel_dir.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

Cc:
[email protected]

Quoted 6 lines

Cc:
[email protected]

Signed-off-by: Xiaolong Ye <
[email protected]

The convention used by upstream and all distros is that kernel headers are in <version>/build. Why can't the cross compilation case also follow this convention, rather than adding complications to the downstream build system?

Signature · 2 lines
Kind regards,
Luca Boccassi
#16 lore raw
Quoted 27 lines · Luca Boccassi
Quoted 26 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make
system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify
kernel_dir as above, this patch fixes this issue.

After this change, for normal build case, user can specify /lib/modules/<kernel_version> or /lib/modules/<kernel_version>/build as
kernel_dir. For cross compilation case, user can specify any directory
that contains kernel source code as the kernel_dir.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

Cc:
[email protected]

Cc:
[email protected]

Quoted 6 lines
Quoted 2 lines

Signed-off-by: Xiaolong Ye <
[email protected]

The convention used by upstream and all distros is that kernel headers are in <version>/build. Why can't the cross compilation case also follow this convention, rather than adding complications to the

Yes, cross-compilation can follow this convention, but one common case is that users download and put kernel src (the same kernel that's running in the target machine) to one arbitrary dir, he then use this dir as kernel_dir to build kernel modules, it's extra burden for users to create extra build dir to hold the kernel headers.

Thanks,
Xiaolong

Quoted 5 lines

downstream build system?

Signature · 2 lines
Kind regards,
Luca Boccassi
#17 lore raw
Quoted 31 lines · Ye Xiaolong
Quoted 30 lines · Luca Boccassi
Quoted 28 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make
system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify
kernel_dir as above, this patch fixes this issue.

After this change, for normal build case, user can specify /lib/modules/<kernel_version> or /lib/modules/<kernel_version>/build as
kernel_dir. For cross compilation case, user can specify any directory
that contains kernel source code as the kernel_dir.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

Cc:
[email protected]

Cc:
[email protected]

Signed-off-by: Xiaolong Ye <
[email protected]

Quoted 9 lines
Quoted 3 lines

The convention used by upstream and all distros is that kernel headers are in <version>/build. Why can't the cross compilation case also follow this convention, rather than adding complications to the

Yes, cross-compilation can follow this convention, but one common case is that users download and put kernel src (the same kernel that's running in the target machine) to one arbitrary dir, he then use this dir as kernel_dir to build kernel modules, it's extra burden for users to create extra build dir to hold the kernel headers.

As part of the build of the kernel, do you not do a "modules_install" step, which should set up things correctly for later builds?

/Bruce

#18 lore raw
Quoted 36 lines · Bruce Richardson
Quoted 35 lines · Ye Xiaolong
Quoted 33 lines · Luca Boccassi
Quoted 22 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make
system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify
kernel_dir as above, this patch fixes this issue.

After this change, for normal build case, user can specify /lib/modules/<kernel_version> or /lib/modules/<kernel_version>/build as
kernel_dir. For cross compilation case, user can specify any directory
that contains kernel source code as the kernel_dir.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

Cc:
[email protected]

Quoted 6 lines

Cc:
[email protected]

Signed-off-by: Xiaolong Ye <
[email protected]

The convention used by upstream and all distros is that kernel headers are in <version>/build. Why can't the cross compilation case also follow this convention, rather than adding complications to the

Quoted 8 lines
Quoted 5 lines

Yes, cross-compilation can follow this convention, but one common case is that users download and put kernel src (the same kernel that's running in the target machine) to one arbitrary dir, he then use this dir as kernel_dir to build kernel modules, it's extra burden for users to create extra build dir to hold the kernel headers.

As part of the build of the kernel, do you not do a "modules_install" step, which should set up things correctly for later builds?

Yes, this cmd helps. But for make build, user could specify both /lib/modules/<kernelversion>/build and any kernel src dir as RTE_KERNELDIR, I think this patch can help give user consistent experience when they migrate from make to meson build.

Thanks,
Xiaolong

Quoted 2 lines

/Bruce

#19 lore raw
Quoted 43 lines · Ye Xiaolong
Quoted 42 lines · Bruce Richardson
Quoted 40 lines · Ye Xiaolong
Quoted 27 lines · Luca Boccassi
Quoted 26 lines · Xiaolong Ye

kernel_dir option in meson build is equivalent to RTE_KERNELDIR in make
system, for cross-compilation case, users would specify it as local kernel src dir like

/<user local dir>/target-arm_glibc/linux-arm/linux-4.19.81/

Current meson build would fail to compile kernel module if user specify
kernel_dir as above, this patch fixes this issue.

After this change, for normal build case, user can specify /lib/modules/<kernel_version> or /lib/modules/<kernel_version>/build as
kernel_dir. For cross compilation case, user can specify any directory
that contains kernel source code as the kernel_dir.

Fixes 317832f97c16 ("kernel/linux: fix modules install path")

Cc:
[email protected]

Cc:
[email protected]

Quoted 6 lines
Quoted 2 lines

Signed-off-by: Xiaolong Ye <
[email protected]

The convention used by upstream and all distros is that kernel headers are in <version>/build. Why can't the cross compilation case also follow this convention, rather than adding complications to the

Yes, cross-compilation can follow this convention, but one common case is that users download and put kernel src (the same kernel that's running in the target machine) to one arbitrary dir, he then use this dir as kernel_dir to build kernel modules, it's extra burden for users to create extra build dir to hold the kernel headers.

Quoted 8 lines
Quoted 2 lines

As part of the build of the kernel, do you not do a "modules_install" step, which should set up things correctly for later builds?

Yes, this cmd helps. But for make build, user could specify both /lib/modules/<kernelversion>/build and any kernel src dir as RTE_KERNELDIR, I think this patch can help give user consistent experience when they migrate from make to meson build.

Issues like specifying the wrong directory when switching over are
a) short term, once off issue in the conversion from make to meson and
b) fixed by just looking at the documentation for the build option.

On the other hand, maintaining code supporting both options is complexity that, if added to meson builds, needs to be maintained going forward. While we can expect users to have to make changes when switching build system, we should not require them later to make changes based on us arbitrarily changing the allowed values of options.

Therefore, unless your build system absolutely cannot be set up to support the existing build configuration, I would rather we not accept changes here, and we try and keep the code simpler.

Regards,
/Bruce