From 1453ccd5b85cc9cc823ddf7795a2362c10288256 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 8 Feb 2024 14:58:16 +0100 Subject: [PATCH] configure: add --with-modulesdir Add configurable path for directory with kernel modules. Following patch will use this directory to lookup: /lib/modules/`uname -r`/modules.builtin --- WHATS_NEW | 1 + configure | 24 ++++++++++++++++++++++++ configure.ac | 12 ++++++++++++ include/configure.h.in | 3 +++ 4 files changed, 40 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 6503e386e..485ef3923 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.03.24 - ================== + Add configure --with-modulesdir to select kernel modules directory. Support creation of thin-pool with VDO use for its data volume. Version 2.03.23 - 21st November 2023 diff --git a/configure b/configure index 0b8d28247..1d6b4132d 100755 --- a/configure +++ b/configure @@ -655,6 +655,7 @@ udev_prefix udevdir tmpfilesdir tmpdir +modulesdir missingkernel kernelvsn kerneldir @@ -1009,6 +1010,7 @@ with_udev_prefix with_udevdir with_systemdsystemunitdir with_tmpfilesdir +with_modulesdir with_dmeventd_pidfile with_dmeventd_path with_dmeventd_exit_on_path @@ -1820,6 +1822,8 @@ Optional Packages: --with-tmpfilesdir=DIR install configuration files for management of volatile files and directories in DIR [PREFIX/lib/tmpfiles.d] + --with-modulesdir=DIR Dir to look for file `uname -r`/modules.builtin + [/lib/modules] --with-dmeventd-pidfile=PATH dmeventd pidfile [PID_DIR/dmeventd.pid] --with-dmeventd-path=PATH @@ -15468,6 +15472,25 @@ else $as_nop tmpfilesdir='${prefix}/lib/tmpfiles.d' fi + +################################################################################ +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kernel modules directory" >&5 +printf %s "checking for kernel modules directory... " >&6; } + +# Check whether --with-modulesdir was given. +if test ${with_modulesdir+y} +then : + withval=$with_modulesdir; modulesdir=$withval +else $as_nop + modulesdir="/lib/modules" +fi + + +printf "%s\n" "#define MODULES_PATH \"$modulesdir\"" >>confdefs.h + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $modulesdir" >&5 +printf "%s\n" "$modulesdir" >&6; } + ################################################################################ if test "$READLINE" = "yes" then : @@ -16288,6 +16311,7 @@ AIO_LIBS=${AIO_LIBS:--laio} + ################################################################################ diff --git a/configure.ac b/configure.ac index 2e52498f9..4aea6f119 100644 --- a/configure.ac +++ b/configure.ac @@ -1615,6 +1615,17 @@ AC_ARG_WITH(tmpfilesdir, AS_HELP_STRING([--with-tmpfilesdir=DIR], [install configuration files for management of volatile files and directories in DIR [PREFIX/lib/tmpfiles.d]]), tmpfilesdir=$withval, tmpfilesdir='${prefix}/lib/tmpfiles.d') + +################################################################################ +dnl - Where to look for modules.builtin file for a kernel - most typically in /lib/modules/ +AC_MSG_CHECKING([for kernel modules directory]) +AC_ARG_WITH(modulesdir, + AS_HELP_STRING([--with-modulesdir=DIR], + [Dir to look for file `uname -r`/modules.builtin [/lib/modules]]), + [modulesdir=$withval], [modulesdir="/lib/modules"]) +AC_DEFINE_UNQUOTED(MODULES_PATH, ["$modulesdir"], [The path to kernel modules.]) +AC_MSG_RESULT([$modulesdir]) + ################################################################################ dnl -- Ensure additional headers required AS_IF([test "$READLINE" = "yes"], [ @@ -1946,6 +1957,7 @@ AC_SUBST(kerneldir) AC_SUBST(kernelvsn) AC_SUBST(libexecdir) AC_SUBST(missingkernel) +AC_SUBST(modulesdir) AC_SUBST(systemdsystemunitdir) AC_SUBST(systemdutildir) AC_SUBST(tmpdir) diff --git a/include/configure.h.in b/include/configure.h.in index b14474d14..60bb7b362 100644 --- a/include/configure.h.in +++ b/include/configure.h.in @@ -621,6 +621,9 @@ /* The path to 'modprobe', if available. */ #undef MODPROBE_CMD +/* The path to kernel modules. */ +#undef MODULES_PATH + /* Define to 1 to include code that uses dbus notification. */ #undef NOTIFYDBUS_SUPPORT -- 2.43.5