mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
autoconf: Pretend CONFIG_MODULES
is always on
- Unconditionally inject `CONFIG_MODULES` make variable and `#define CONFIG_MODULES` to Kbuild in `ZFS_LINUX_COMPILE` autoconf function to emulate loadable kernel modules support. This allows OpenZFS to perform Linux checks despite `CONFIG_MODULES=n` in the actual Linux config. - Add `ZFS_AC_KERNEL_CONFIG_MODULES` check which encompasses the logic from `ZFS_AC_KERNEL_TEST_MODULE` with additional diagnostic messages to the user - Removed `ZFS_AC_KERNEL_TEST_MODULE` as it merely duplicates every check in `ZFS_AC_KERNEL_CONFIG_DEFINED` - Moved `ZFS_AC_MODULE_SYMVERS` after `ZFS_AC_KERNEL_CONFIG_DEFINED` so the user has a chance to see the proper diagnostic from the steps before. A workaround for Linux's ``` commit 3e3005df73b535cb849cf4ec8075d6aa3c460f68 Author: Masahiro Yamada <masahiroy@kernel.org> Date: Wed Mar 31 22:38:03 2021 +0900 kbuild: unify modules(_install) for in-tree and external modules If you attempt to build or install modules ('make modules(_install)' with CONFIG_MODULES disabled, you will get a clear error message, but nothing for external module builds. Factor out the modules and modules_install rules into the common part, so you will get the same error message when you try to build external modules with CONFIG_MODULES=n. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> ``` Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #10832 Closes #13361
This commit is contained in:
parent
600a02b884
commit
a0dfd98a25
@ -19,6 +19,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
ZFS_AC_KERNEL_SRC_CONFIG_MODULES
|
||||||
ZFS_AC_KERNEL_SRC_CONFIG_BLOCK
|
ZFS_AC_KERNEL_SRC_CONFIG_BLOCK
|
||||||
ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC
|
ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC
|
||||||
ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS
|
ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS
|
||||||
@ -29,6 +30,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [
|
|||||||
ZFS_LINUX_TEST_COMPILE_ALL([config])
|
ZFS_LINUX_TEST_COMPILE_ALL([config])
|
||||||
AC_MSG_RESULT([done])
|
AC_MSG_RESULT([done])
|
||||||
|
|
||||||
|
ZFS_AC_KERNEL_CONFIG_MODULES
|
||||||
ZFS_AC_KERNEL_CONFIG_BLOCK
|
ZFS_AC_KERNEL_CONFIG_BLOCK
|
||||||
ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
|
ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
|
||||||
ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
|
ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
|
||||||
@ -99,6 +101,61 @@ AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # Check CONFIG_MODULES
|
||||||
|
dnl #
|
||||||
|
dnl # Verify the kernel has CONFIG_MODULES support enabled.
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_MODULES], [
|
||||||
|
ZFS_LINUX_TEST_SRC([config_modules], [
|
||||||
|
#if !defined(CONFIG_MODULES)
|
||||||
|
#error CONFIG_MODULES not defined
|
||||||
|
#endif
|
||||||
|
],[])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_MODULES], [
|
||||||
|
AC_MSG_CHECKING([whether CONFIG_MODULES is defined])
|
||||||
|
AS_IF([test "x$enable_linux_builtin" != xyes], [
|
||||||
|
ZFS_LINUX_TEST_RESULT([config_modules], [
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** This kernel does not include the required loadable module
|
||||||
|
*** support!
|
||||||
|
***
|
||||||
|
*** To build OpenZFS as a loadable Linux kernel module
|
||||||
|
*** enable loadable module support by setting
|
||||||
|
*** `CONFIG_MODULES=y` in the kernel configuration and run
|
||||||
|
*** `make modules_prepare` in the Linux source tree.
|
||||||
|
***
|
||||||
|
*** If you don't intend to enable loadable kernel module
|
||||||
|
*** support, please compile OpenZFS as a Linux kernel built-in.
|
||||||
|
***
|
||||||
|
*** Prepare the Linux source tree by running `make prepare`,
|
||||||
|
*** use the OpenZFS `--enable-linux-builtin` configure option,
|
||||||
|
*** copy the OpenZFS sources into the Linux source tree using
|
||||||
|
*** `./copy-builtin <linux source directory>`,
|
||||||
|
*** set `CONFIG_ZFS=y` in the kernel configuration and compile
|
||||||
|
*** kernel as usual.
|
||||||
|
])
|
||||||
|
])
|
||||||
|
], [
|
||||||
|
ZFS_LINUX_TRY_COMPILE([], [], [
|
||||||
|
AC_MSG_RESULT([not needed])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([error])
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** This kernel is unable to compile object files.
|
||||||
|
***
|
||||||
|
*** Please make sure you prepared the Linux source tree
|
||||||
|
*** by running `make prepare` there.
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Check CONFIG_TRIM_UNUSED_KSYMS
|
dnl # Check CONFIG_TRIM_UNUSED_KSYMS
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -8,8 +8,8 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
|||||||
ZFS_AC_QAT
|
ZFS_AC_QAT
|
||||||
|
|
||||||
dnl # Sanity checks for module building and CONFIG_* defines
|
dnl # Sanity checks for module building and CONFIG_* defines
|
||||||
ZFS_AC_KERNEL_TEST_MODULE
|
|
||||||
ZFS_AC_KERNEL_CONFIG_DEFINED
|
ZFS_AC_KERNEL_CONFIG_DEFINED
|
||||||
|
ZFS_AC_MODULE_SYMVERS
|
||||||
|
|
||||||
dnl # Sequential ZFS_LINUX_TRY_COMPILE tests
|
dnl # Sequential ZFS_LINUX_TRY_COMPILE tests
|
||||||
ZFS_AC_KERNEL_FPU_HEADER
|
ZFS_AC_KERNEL_FPU_HEADER
|
||||||
@ -445,8 +445,6 @@ AC_DEFUN([ZFS_AC_KERNEL], [
|
|||||||
AC_SUBST(LINUX)
|
AC_SUBST(LINUX)
|
||||||
AC_SUBST(LINUX_OBJ)
|
AC_SUBST(LINUX_OBJ)
|
||||||
AC_SUBST(LINUX_VERSION)
|
AC_SUBST(LINUX_VERSION)
|
||||||
|
|
||||||
ZFS_AC_MODULE_SYMVERS
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
@ -541,27 +539,6 @@ AC_DEFUN([ZFS_AC_QAT], [
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
|
||||||
dnl # Basic toolchain sanity check.
|
|
||||||
dnl #
|
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_TEST_MODULE], [
|
|
||||||
AC_MSG_CHECKING([whether modules can be built])
|
|
||||||
ZFS_LINUX_TRY_COMPILE([], [], [
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
if test "x$enable_linux_builtin" != xyes; then
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
*** Unable to build an empty module.
|
|
||||||
])
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
*** Unable to build an empty module.
|
|
||||||
*** Please run 'make scripts' inside the kernel source tree.])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # ZFS_LINUX_CONFTEST_H
|
dnl # ZFS_LINUX_CONFTEST_H
|
||||||
dnl #
|
dnl #
|
||||||
@ -664,8 +641,10 @@ AC_DEFUN([ZFS_LINUX_COMPILE], [
|
|||||||
build kernel modules with LLVM/CLANG toolchain])
|
build kernel modules with LLVM/CLANG toolchain])
|
||||||
AC_TRY_COMMAND([
|
AC_TRY_COMMAND([
|
||||||
KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6"
|
KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6"
|
||||||
make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC} ${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM} -C $LINUX_OBJ $ARCH_UM
|
make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC}
|
||||||
M=$PWD/$1 >$1/build.log 2>&1])
|
${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM}
|
||||||
|
CONFIG_MODULES=y CFLAGS_MODULE=-DCONFIG_MODULES
|
||||||
|
-C $LINUX_OBJ $ARCH_UM M=$PWD/$1 >$1/build.log 2>&1])
|
||||||
AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4])
|
AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user