SHA256
1
0
forked from pool/kmod

Accepting request 1100406 from Base:System

Update our patchstack with the latest upstream submission attempts

OBS-URL: https://build.opensuse.org/request/show/1100406
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kmod?expand=0&rev=77
This commit is contained in:
Ana Guerrero 2023-07-25 09:22:53 +00:00 committed by Git OBS Bridge
commit 691a71099c
12 changed files with 592 additions and 369 deletions

View File

@ -0,0 +1,33 @@
From e15c268ba92d53dbb97fa0211696226656780713 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 16 Jul 2023 15:55:38 +0000
Subject: [PATCH 6/7] Provide fallback for successfully running `make
modules_install` in pristine tarballs.
---
tools/depmod.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/depmod.c b/tools/depmod.c
index 5ef490473186..70cfefb81005 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -3030,6 +3030,15 @@ static int do_depmod(int argc, char *argv[])
cfg.outdirnamelen = snprintf(cfg.outdirname, PATH_MAX,
"%s" MODULE_DIRECTORY "/%s",
out_root ?: (root ?: ""), cfg.kversion);
+ struct stat sb;
+ if (stat(cfg.dirname, &sb) != 0) {
+ cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
+ "%s/lib/modules/%s",
+ root ?: "", cfg.kversion);
+ cfg.outdirnamelen = snprintf(cfg.outdirname, PATH_MAX,
+ "%s/lib/modules/%s",
+ out_root ?: (root ?: ""), cfg.kversion);
+ }
if (optind == argc)
all = 1;
--
2.41.0

View File

@ -0,0 +1,91 @@
From 004a365112b56402cca5d0097fccb74d38490aeb Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 17 Jul 2023 12:56:45 +0200
Subject: [PATCH 7/7] compat: module_directory -> module_prefix
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
Makefile.am | 1 +
configure.ac | 10 ++++++++++
tools/kmod.c | 15 +++++++++++++++
3 files changed, 26 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index 1d51a43d68ba..e0df13c589bc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DDISTCONFDIR=\""$(distconfdir)"\" \
+ -DMODULE_PREFIX=\""$(module_prefix)"\" \
-DMODULE_DIRECTORY=\""$(module_directory)"\" \
${zlib_CFLAGS}
diff --git a/configure.ac b/configure.ac
index 602d3d3dbdf1..a1e64e190d2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,15 @@ AC_ARG_WITH([module_directory],
[], [with_module_directory=/lib/modules])
AC_SUBST([module_directory], [$with_module_directory])
+case $module_directory in
+ /lib/modules)
+ with_module_prefix=""
+ AC_SUBST([module_prefix], [$with_module_prefix]);;
+ */lib/modules) with_module_prefix=$(dirname $with_module_directory)
+ with_module_prefix=$(dirname $with_module_prefix)
+ AC_SUBST([module_prefix], [$with_module_prefix]);;
+esac
+
AC_ARG_WITH([zstd],
AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
[], [with_zstd=no])
@@ -324,6 +333,7 @@ AC_MSG_RESULT([
module_directory: ${module_directory}
prefix: ${prefix}
+ module_prefix: ${module_prefix}
sysconfdir: ${sysconfdir}
distconfdir: ${distconfdir}
libdir: ${libdir}
diff --git a/tools/kmod.c b/tools/kmod.c
index 55689c075ab1..1ab62e86116e 100644
--- a/tools/kmod.c
+++ b/tools/kmod.c
@@ -37,9 +37,11 @@ static const struct option options[] = {
};
static const struct kmod_cmd kmod_cmd_help;
+static const struct kmod_cmd kmod_cmd_config;
static const struct kmod_cmd *kmod_cmds[] = {
&kmod_cmd_help,
+ &kmod_cmd_config,
&kmod_cmd_list,
&kmod_cmd_static_nodes,
@@ -95,6 +97,19 @@ static const struct kmod_cmd kmod_cmd_help = {
.help = "Show help message",
};
+static int kmod_config(int argc, char *argv[])
+{
+ printf("{\"module_prefix\":\"" MODULE_PREFIX "\"}\n");
+
+ return EXIT_SUCCESS;
+}
+
+static const struct kmod_cmd kmod_cmd_config = {
+ .name = "config",
+ .cmd = kmod_config,
+ .help = "Show compile time options in JSON",
+};
+
static int handle_kmod_commands(int argc, char *argv[])
{
const char *cmd;
--
2.41.0

View File

@ -0,0 +1,35 @@
From 90446ff0273775ee20762bb892fd3e901c8eb8ac Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 17 Jul 2023 21:23:51 +0200
Subject: [PATCH] configure: Detect openssl sm3 support
Older openssl versions do not support sm3. The code has an option to
disable the sm3 hash but the lack of openssl support is not detected
automatically.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
configure.ac | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/configure.ac b/configure.ac
index a1e64e190d2f..5a582cb5a2af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,6 +148,13 @@ AS_IF([test "x$with_openssl" != "xno"], [
PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0])
AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.])
module_signatures="PKCS7 $module_signatures"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <openssl/ssl.h>
+ int nid = NID_sm3;]])], [
+ AC_MSG_NOTICE([openssl supports sm3])
+ ], [
+ AC_MSG_NOTICE([openssl sm3 support not detected])
+ CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3"
+ ])
], [
AC_MSG_NOTICE([openssl support not requested])
])
--
2.41.0

View File

@ -1,90 +0,0 @@
From be701954b3e730944f949c1c3fc7dc5144e37de0 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 30 Jun 2023 16:16:24 +0200
Subject: [PATCH 3/9] kmod: Add config command to show compile time
configuration as JSON
Show prefix (where configuration files are searched/to be installed)
and module compressions supported.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
man/kmod.xml | 6 ++++++
tools/kmod.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/man/kmod.xml b/man/kmod.xml
index 0706ad58c2cc..f992a500f836 100644
--- a/man/kmod.xml
+++ b/man/kmod.xml
@@ -71,6 +71,12 @@
<para>Show the help message.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><command>config</command></term>
+ <listitem>
+ <para>Show compile time options in JSON.</para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><command>list</command></term>
<listitem>
diff --git a/tools/kmod.c b/tools/kmod.c
index 55689c075ab1..28aefb463492 100644
--- a/tools/kmod.c
+++ b/tools/kmod.c
@@ -37,9 +37,11 @@ static const struct option options[] = {
};
static const struct kmod_cmd kmod_cmd_help;
+static const struct kmod_cmd kmod_cmd_config;
static const struct kmod_cmd *kmod_cmds[] = {
&kmod_cmd_help,
+ &kmod_cmd_config,
&kmod_cmd_list,
&kmod_cmd_static_nodes,
@@ -95,6 +97,38 @@ static const struct kmod_cmd kmod_cmd_help = {
.help = "Show help message",
};
+static const char *compressions[] = {
+#ifdef ENABLE_ZSTD
+ "zstd",
+#endif
+#ifdef ENABLE_XZ
+ "xz",
+#endif
+#ifdef ENABLE_ZLIB
+ "gz",
+#endif
+ NULL
+};
+
+static int kmod_config(int argc, char *argv[])
+{
+ unsigned i;
+ printf("{\"prefix\":\"" PREFIX "\""
+ ",\"module_compression\":[");
+ for(i = 0; compressions[i]; i++) {
+ printf("%s\"%s\"", i ? "," : "", compressions[i]);
+ }
+ printf("]}\n");
+
+ return EXIT_SUCCESS;
+}
+
+static const struct kmod_cmd kmod_cmd_config = {
+ .name = "config",
+ .cmd = kmod_config,
+ .help = "Show compile time options in JSON",
+};
+
static int handle_kmod_commands(int argc, char *argv[])
{
const char *cmd;
--
2.41.0

View File

@ -0,0 +1,119 @@
From 2e4eff4f252fe2a4c5bdb81e3ca2639b9b5f04c6 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 30 Jun 2023 16:16:24 +0200
Subject: [PATCH 3/7] kmod: Add pkgconfig file with kmod compile time
configuration
Show distconfdir (where system configuration files are searched/to be
installed), sysconfdir (where user configuration files are searched),
module compressions, and module signatures supported.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v2: mention module signature in commit message
v3: add sysconfdir
v5: add distconfdir, switch to pkgconfig
---
Makefile.am | 6 +++---
configure.ac | 11 +++++++++++
tools/kmod.pc.in | 9 +++++++++
3 files changed, 23 insertions(+), 3 deletions(-)
create mode 100644 tools/kmod.pc.in
diff --git a/Makefile.am b/Makefile.am
index a03846d02b9c..18818c811634 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -118,9 +118,9 @@ libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
libkmod_libkmod_internal_la_LIBADD = $(libkmod_libkmod_la_LIBADD)
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libkmod/libkmod.pc
-EXTRA_DIST += libkmod/libkmod.pc.in
-CLEANFILES += libkmod/libkmod.pc
+pkgconfig_DATA = libkmod/libkmod.pc tools/kmod.pc
+EXTRA_DIST += libkmod/libkmod.pc.in tools/kmod.pc.in
+CLEANFILES += libkmod/libkmod.pc tools/kmod.pc
bashcompletiondir=@bashcompletiondir@
dist_bashcompletion_DATA = \
diff --git a/configure.ac b/configure.ac
index 18206ccdb607..a6ed8a36ca70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,6 +21,9 @@ LT_INIT([disable-static pic-only])
AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])])
AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by kmod])])
+module_compressions=""
+module_signatures="legacy"
+
#####################################################################
# Program checks and configurations
#####################################################################
@@ -93,6 +96,7 @@ AC_ARG_WITH([zstd],
AS_IF([test "x$with_zstd" != "xno"], [
PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.4])
AC_DEFINE([ENABLE_ZSTD], [1], [Enable Zstandard for modules.])
+ module_compressions="zstd $module_compressions"
], [
AC_MSG_NOTICE([Zstandard support not requested])
])
@@ -104,6 +108,7 @@ AC_ARG_WITH([xz],
AS_IF([test "x$with_xz" != "xno"], [
PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99])
AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.])
+ module_compressions="xz $module_compressions"
], [
AC_MSG_NOTICE([Xz support not requested])
])
@@ -115,6 +120,7 @@ AC_ARG_WITH([zlib],
AS_IF([test "x$with_zlib" != "xno"], [
PKG_CHECK_MODULES([zlib], [zlib])
AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
+ module_compressions="gzip $module_compressions"
], [
AC_MSG_NOTICE([zlib support not requested])
])
@@ -126,6 +132,7 @@ AC_ARG_WITH([openssl],
AS_IF([test "x$with_openssl" != "xno"], [
PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0])
AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.])
+ module_signatures="PKCS7 $module_signatures"
], [
AC_MSG_NOTICE([openssl support not requested])
])
@@ -290,11 +297,15 @@ AC_DEFINE_UNQUOTED(KMOD_FEATURES, ["$with_features"], [Features in this build])
# Generate files from *.in
#####################################################################
+AC_SUBST([module_compressions], $module_compressions)
+AC_SUBST([module_signatures], $module_signatures)
+
AC_CONFIG_FILES([
Makefile
man/Makefile
libkmod/docs/Makefile
libkmod/docs/version.xml
+ tools/kmod.pc
])
diff --git a/tools/kmod.pc.in b/tools/kmod.pc.in
new file mode 100644
index 000000000000..2595980a6b35
--- /dev/null
+++ b/tools/kmod.pc.in
@@ -0,0 +1,9 @@
+prefix=@prefix@
+sysconfdir=@sysconfdir@
+distconfdir=@distconfdir@
+module_compressions=@module_compressions@
+module_signatures=@module_signatures@
+
+Name: kmod
+Description: Tools to deal with kernel modules
+Version: @VERSION@
--
2.41.0

View File

@ -47,9 +47,12 @@ Patch10: testsuite-Move-setup-rootfs-logic-from-Makefile-to-s.patch
Patch11: depmod-Introduce-outdir-option.patch
Patch12: testsuite-Handle-different-sysconfdir.patch
Patch13: testsuite-depmod-use-defines-for-the-rootfs-lib_modu.patch
Patch14: kmod-Add-config-command-to-show-compile-time-configu.patch
Patch14: kmod-Add-pkgconfig-file-with-kmod-compile-time-confi.patch
Patch15: usr-lib-modules.patch
Patch16: no-stylesheet-download.patch
Patch17: Provide-fallback-for-successfully-running-make-modules_install.patch
Patch18: compat-module_directory-module_prefix.patch
Patch19: configure-Detect-openssl-sm3-support.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: docbook-xsl-stylesheets
@ -95,7 +98,7 @@ export LDFLAGS="-Wl,-z,relro,-z,now"
--includedir="%_includedir/kmod" \
--with-rootlibdir="%_libdir" \
%if 0%{?suse_version} > 1500
--with-module-prefix="%_prefix" \
--with-module-directory="%_prefix/lib/modules" \
%endif
--bindir="%_bindir"
%make_build KDIR="%kdir"

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Jul 17 17:54:54 UTC 2023 - Michal Suchanek <msuchanek@suse.de>
- Use pkgconfig for kmod configuration.
* Delete kmod-Add-config-command-to-show-compile-time-configu.patch
* Add kmod-Add-pkgconfig-file-with-kmod-compile-time-confi.patch,
Provide-fallback-for-successfully-running-make-modules_install.patch
compat-module_directory-module_prefix.patch.
- Refresh usr-lib-modprobe.patch, usr-lib-modules.patch.
- Add configure-Detect-openssl-sm3-support.patch to
fix build with older openssl without SM3 support.
-------------------------------------------------------------------
Sun Jul 16 15:55:38 UTC 2023 - Jan Engelhardt <jengelh@inai.de>

View File

@ -47,9 +47,12 @@ Patch10: testsuite-Move-setup-rootfs-logic-from-Makefile-to-s.patch
Patch11: depmod-Introduce-outdir-option.patch
Patch12: testsuite-Handle-different-sysconfdir.patch
Patch13: testsuite-depmod-use-defines-for-the-rootfs-lib_modu.patch
Patch14: kmod-Add-config-command-to-show-compile-time-configu.patch
Patch14: kmod-Add-pkgconfig-file-with-kmod-compile-time-confi.patch
Patch15: usr-lib-modules.patch
Patch16: no-stylesheet-download.patch
Patch17: Provide-fallback-for-successfully-running-make-modules_install.patch
Patch18: compat-module_directory-module_prefix.patch
Patch19: configure-Detect-openssl-sm3-support.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: docbook-xsl-stylesheets
@ -137,7 +140,7 @@ export LDFLAGS="-Wl,-z,relro,-z,now"
--includedir="%_includedir/kmod" \
--with-rootlibdir="%_libdir" \
%if 0%{?suse_version} > 1500
--with-module-prefix="%_prefix" \
--with-module-directory="%_prefix/lib/modules" \
%endif
--bindir="%_bindir"
%make_build
@ -181,6 +184,7 @@ done
%_sbindir/modprobe
%_sbindir/rmmod
%_mandir/man[58]/*.[58]*
%_libdir/pkgconfig/kmod.pc
%if 0%{?suse_version} < 1550
/bin/lsmod
/sbin/depmod

View File

@ -1,12 +1,14 @@
From a792ef9a42b9bd8cc76260b4aa61a681f6998364 Mon Sep 17 00:00:00 2001
From 7bf3543e3cc24dfc9ffca93d0469a5e0e60f8f29 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 30 Jun 2023 10:56:31 +0200
Subject: [PATCH 1/9] man/depmod.d: Fix incorrect /usr/lib search path
Subject: [PATCH 1/7] man/depmod.d: Fix incorrect /usr/lib search path
depmod searches /lib/depmod.d but the man page says /usr/lib/depmod.d is
reached. Aling the documentation with the code.
searched. Align the documentation with the code.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v2: Fix commit message typo
---
man/depmod.d.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -1,7 +1,7 @@
From cd775d005f7d36395ef554d128c849fac5430f37 Mon Sep 17 00:00:00 2001
From b46c23e46ad9b19d74362eb3528404293bb03d12 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 6 Sep 2021 14:52:35 +0200
Subject: [PATCH 9/9] Do not download the docbook stylesheet during build, use
Subject: [PATCH 5/7] Do not download the docbook stylesheet during build, use
local copy instead.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
@ -10,7 +10,7 @@ Signed-off-by: Michal Suchanek <msuchanek@suse.de>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/Makefile.am b/man/Makefile.am
index 1a9a92f9c224..6b89400e9d39 100644
index f550091a216a..a8ddb8bfd0ed 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -28,4 +28,4 @@ CLEANFILES = $(dist_man_MANS)

View File

@ -1,71 +1,97 @@
From 9d4c3adcd051408a9a4489984be73f9c06b938ab Mon Sep 17 00:00:00 2001
From 88f6d08df8082f4dbe2407bef59de85290360e88 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Tue, 12 Jan 2021 16:54:46 +0100
Subject: [PATCH 2/9] libkmod, depmod: Load modprobe.d, depmod.d from
$prefix/lib.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH 2/7] libkmod, depmod: Load modprobe.d, depmod.d from
${prefix}/lib.
There is an ongoing effort to limit use of files outside of /usr (or
$prefix on general). Currently all modprobe.d paths are hardcoded to
outside of $prefix. Teach kmod to load modprobe.d from $prefix/lib.
${prefix} on general). Currently all modprobe.d paths are hardcoded to
outside of $prefix. Teach kmod to load modprobe.d from ${prefix}/lib.
On some distributions /usr/lib and /lib are the same directory because
of a compatibility symlink, and it is possible to craft configuration
files with sideeffects that would behave differently when loaded twice.
However, the override semantic ensures that one 'overrides' the other,
and only one configuration file of the same name is loaded from any of
the seach directories.
the search directories.
Cc: Marcus Rückert <mrueckert@suse.com>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Dominique Leuenberger <dimstar@opensuse.org>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v2: Fix commit message typo
v3: Fix modprobe.d path list in code comment
v5: Add distconfdir
---
Makefile.am | 1 +
libkmod/libkmod.c | 3 ++-
configure.ac | 5 +++++
libkmod/libkmod.c | 7 ++++---
man/Makefile.am | 9 +++++++--
man/depmod.d.xml | 1 +
man/modprobe.d.xml | 1 +
tools/depmod.c | 1 +
6 files changed, 13 insertions(+), 3 deletions(-)
7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 0e4877074f40..e7313fa8a33e 100644
index ac47ea625e71..a03846d02b9c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,6 +19,7 @@ AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-I$(top_srcdir) \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DPREFIX=\""$(prefix)"\" \
+ -DDISTCONFDIR=\""$(distconfdir)"\" \
${zlib_CFLAGS}
AM_CFLAGS = $(OUR_CFLAGS)
diff --git a/configure.ac b/configure.ac
index a74d3baf0a42..18206ccdb607 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,10 @@ AC_COMPILE_IFELSE(
# --with-
#####################################################################
+AC_ARG_WITH([distconfdir], AS_HELP_STRING([--with-distconfdir=DIR], [directory to search for distribution configuration files]),
+ [], [with_distconfdir='${prefix}/lib'])
+AC_SUBST([distconfdir], [$with_distconfdir])
+
AC_ARG_WITH([rootlibdir],
AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
[], [with_rootlibdir=$libdir])
@@ -303,6 +307,7 @@ AC_MSG_RESULT([
prefix: ${prefix}
sysconfdir: ${sysconfdir}
+ distconfdir: ${distconfdir}
libdir: ${libdir}
rootlibdir: ${rootlibdir}
includedir: ${includedir}
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 7c2b889d713e..75fc8be3fadc 100644
index 7c2b889d713e..bc05a1873edf 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -65,6 +65,7 @@ static const char *default_config_paths[] = {
SYSCONFDIR "/modprobe.d",
"/run/modprobe.d",
"/usr/local/lib/modprobe.d",
+ PREFIX "/lib/modprobe.d",
+ DISTCONFDIR "/modprobe.d",
"/lib/modprobe.d",
NULL
};
@@ -237,7 +238,7 @@ static char *get_kernel_release(const char *dirname)
@@ -237,9 +238,9 @@ static char *get_kernel_release(const char *dirname)
* to load from user-defined configuration parameters such as
* alias, blacklists, commands (install, remove). If NULL
* defaults to /etc/modprobe.d, /run/modprobe.d,
- * /usr/local/lib/modprobe.d and /lib/modprobe.d. Give an empty
+ * /usr/local/lib/modprobe.d and PREFIX/lib/modprobe.d. Give an empty
* vector if configuration should not be read. This array must
* be null terminated.
- * vector if configuration should not be read. This array must
- * be null terminated.
+ * /usr/local/lib/modprobe.d, DISTCONFDIR/modprobe.d, and
+ * /lib/modprobe.d. Give an empty vector if configuration should
+ * not be read. This array must be null terminated.
*
* Create kmod library context. This reads the kmod configuration
* and fills in the default values.
diff --git a/man/Makefile.am b/man/Makefile.am
index 11514d52a190..ad07c30bbd24 100644
index 11514d52a190..2fea8e46bf2f 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -17,9 +17,14 @@ EXTRA_DIST = $(MAN5:%.5=%.xml) $(MAN8:%.8=%.xml)
@ -73,10 +99,10 @@ index 11514d52a190..ad07c30bbd24 100644
%.5 %.8: %.xml
- $(AM_V_XSLT)$(XSLT) \
+ $(AM_V_XSLT)if [ -n '$(prefix)' ] ; then \
+ sed -e 's|@PREFIX@|$(prefix)|g' $< ; \
+ $(AM_V_XSLT)if [ '$(distconfdir)' != '/lib' ] ; then \
+ sed -e 's|@DISTCONFDIR@|$(distconfdir)|g' $< ; \
+ else \
+ sed -e '/@PREFIX@/d' $< ; \
+ sed -e '/@DISTCONFDIR@/d' $< ; \
+ fi | \
+ $(XSLT) \
-o $@ \
@ -86,38 +112,38 @@ index 11514d52a190..ad07c30bbd24 100644
- http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl -
diff --git a/man/depmod.d.xml b/man/depmod.d.xml
index 8d3d821cddc8..431ebca6654b 100644
index 8d3d821cddc8..f282a39cc840 100644
--- a/man/depmod.d.xml
+++ b/man/depmod.d.xml
@@ -40,6 +40,7 @@
<refsynopsisdiv>
<para><filename>/lib/depmod.d/*.conf</filename></para>
+ <para><filename>@PREFIX@/lib/depmod.d/*.conf</filename></para>
+ <para><filename>@DISTCONFDIR@/depmod.d/*.conf</filename></para>
<para><filename>/usr/local/lib/depmod.d/*.conf</filename></para>
<para><filename>/run/depmod.d/*.conf</filename></para>
<para><filename>/etc/depmod.d/*.conf</filename></para>
diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
index 0ab3e9110a7e..e8a91d7668af 100644
index 0ab3e9110a7e..2bf6537f07e6 100644
--- a/man/modprobe.d.xml
+++ b/man/modprobe.d.xml
@@ -41,6 +41,7 @@
<refsynopsisdiv>
<para><filename>/lib/modprobe.d/*.conf</filename></para>
+ <para><filename>@PREFIX@/lib/modprobe.d/*.conf</filename></para>
+ <para><filename>@DISTCONFDIR@/modprobe.d/*.conf</filename></para>
<para><filename>/usr/local/lib/modprobe.d/*.conf</filename></para>
<para><filename>/run/modprobe.d/*.conf</filename></para>
<para><filename>/etc/modprobe.d/*.conf</filename></para>
diff --git a/tools/depmod.c b/tools/depmod.c
index 364b7d4faa9e..a9349b20ee9c 100644
index 553659755194..aada5ac57902 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -54,6 +54,7 @@ static const char *default_cfg_paths[] = {
SYSCONFDIR "/depmod.d",
"/run/depmod.d",
"/usr/local/lib/depmod.d",
+ PREFIX "/lib/depmod.d",
+ DISTCONFDIR "/depmod.d",
"/lib/depmod.d",
NULL
};

View File

@ -1,10 +1,10 @@
From cb784d4f70cd49565a934bfae87373fe495adec8 Mon Sep 17 00:00:00 2001
From d6ca73ea19ef26506686e7cc85044c40f3fb917c Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 26 May 2023 10:38:05 +0200
Subject: [PATCH 8/9] libkmod, depmod, modprobe: Search for kernel modules
under ${module_prefix}
Subject: [PATCH 4/7] libkmod, depmod, modprobe: Make directory for kernel
modules configurable
modprobe.d is now searched under ${prefix}/lib, add ${module_prefix} to
modprobe.d is now searched under ${prefix}/lib, add ${module_directory} to
specify the directory where to search for kernel modules.
With this distributions that do not want to ship files in /lib can also
@ -12,35 +12,37 @@ move kernel modules to /usr while others can keep them in /lib.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
Makefile.am | 3
configure.ac | 7 ++
libkmod/libkmod.c | 6 -
man/Makefile.am | 1
man/depmod.d.xml | 6 -
man/depmod.xml | 4 -
man/modinfo.xml | 2
man/modprobe.xml | 2
man/modules.dep.xml | 6 -
testsuite/module-playground/Makefile | 2
testsuite/setup-rootfs.sh | 109 +++++++++++++++++++----------------
testsuite/test-depmod.c | 16 ++---
testsuite/test-testsuite.c | 8 +-
tools/depmod.c | 13 +++-
tools/kmod.c | 1
tools/modinfo.c | 4 -
tools/modprobe.c | 4 -
tools/static-nodes.c | 6 -
18 files changed, 116 insertions(+), 84 deletions(-)
v4: Make the whole path configurable
---
Makefile.am | 3 +-
configure.ac | 7 ++
libkmod/libkmod.c | 4 +-
man/Makefile.am | 1 +
man/depmod.d.xml | 6 +-
man/depmod.xml | 4 +-
man/modinfo.xml | 2 +-
man/modprobe.xml | 2 +-
man/modules.dep.xml | 6 +-
testsuite/module-playground/Makefile | 2 +-
testsuite/setup-rootfs.sh | 109 +++++++++++++++------------
testsuite/test-depmod.c | 16 ++--
testsuite/test-testsuite.c | 8 +-
tools/depmod.c | 6 +-
tools/kmod.pc.in | 1 +
tools/modinfo.c | 4 +-
tools/modprobe.c | 4 +-
tools/static-nodes.c | 6 +-
18 files changed, 107 insertions(+), 84 deletions(-)
Index: kmod-30/Makefile.am
===================================================================
--- kmod-30.orig/Makefile.am
+++ kmod-30/Makefile.am
diff --git a/Makefile.am b/Makefile.am
index fd4c7a04ec51..1d51a43d68ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPREFIX=\""$(prefix)"\" \
+ -DMODULE_PREFIX=\""$(module_prefix)"\" \
-DDISTCONFDIR=\""$(distconfdir)"\" \
+ -DMODULE_DIRECTORY=\""$(module_directory)"\" \
${zlib_CFLAGS}
AM_CFLAGS = $(OUR_CFLAGS)
@ -49,49 +51,49 @@ Index: kmod-30/Makefile.am
ROOTFS = testsuite/rootfs
ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
-CREATE_ROOTFS = $(AM_V_GEN) $(top_srcdir)/testsuite/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h $(sysconfdir)
+CREATE_ROOTFS = $(AM_V_GEN) MODULE_PREFIX=$(module_prefix) $(top_srcdir)/testsuite/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h $(sysconfdir)
+CREATE_ROOTFS = $(AM_V_GEN) MODULE_DIRECTORY=$(module_directory) $(top_srcdir)/testsuite/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h $(sysconfdir)
build-module-playground:
$(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
Index: kmod-30/configure.ac
===================================================================
--- kmod-30.orig/configure.ac
+++ kmod-30/configure.ac
@@ -83,6 +83,12 @@ AC_ARG_WITH([rootlibdir],
diff --git a/configure.ac b/configure.ac
index a6ed8a36ca70..602d3d3dbdf1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,12 @@ AC_ARG_WITH([rootlibdir],
[], [with_rootlibdir=$libdir])
AC_SUBST([rootlibdir], [$with_rootlibdir])
+# Ideally this would be $prefix but default to empty for compatibility with earlier versions
+AC_ARG_WITH([module_prefix],
+ AS_HELP_STRING([--with-module-prefix=DIR], [directory in which to look for /lib/modules directory with kernel modules - typically '' or ${prefix}]),
+ [], [with_module_prefix=])
+AC_SUBST([module_prefix], [$with_module_prefix])
+# Ideally this would be $prefix/lib/modules but default to /lib/modules for compatibility with earlier versions
+AC_ARG_WITH([module_directory],
+ AS_HELP_STRING([--with-module-directory=DIR], [directory in which to look for kernel modules - typically '/lib/modules' or '${prefix}/lib/modules']),
+ [], [with_module_directory=/lib/modules])
+AC_SUBST([module_directory], [$with_module_directory])
+
AC_ARG_WITH([zstd],
AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
[], [with_zstd=no])
@@ -302,6 +308,7 @@ AC_MSG_RESULT([
@@ -316,6 +322,7 @@ AC_MSG_RESULT([
$PACKAGE $VERSION
=======
+ module_directory: ${module_directory}
prefix: ${prefix}
+ module_prefix: ${module_prefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
rootlibdir: ${rootlibdir}
Index: kmod-30/libkmod/libkmod.c
===================================================================
--- kmod-30.orig/libkmod/libkmod.c
+++ kmod-30/libkmod/libkmod.c
@@ -209,7 +209,7 @@ static int log_priority(const char *prio
distconfdir: ${distconfdir}
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index bc05a1873edf..876458f7449a 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -209,7 +209,7 @@ static int log_priority(const char *priority)
return 0;
}
-static const char *dirname_default_prefix = "/lib/modules";
+static const char *dirname_default_prefix = MODULE_PREFIX "/lib/modules";
+static const char *dirname_default_prefix = MODULE_DIRECTORY;
static char *get_kernel_release(const char *dirname)
{
@@ -231,14 +231,14 @@ static char *get_kernel_release(const ch
@@ -231,7 +231,7 @@ static char *get_kernel_release(const char *dirname)
/**
* kmod_new:
* @dirname: what to consider as linux module's directory, if NULL
@ -100,36 +102,28 @@ Index: kmod-30/libkmod/libkmod.c
* it's treated as relative to the current working directory.
* Otherwise, give an absolute dirname.
* @config_paths: ordered array of paths (directories or files) where
* to load from user-defined configuration parameters such as
* alias, blacklists, commands (install, remove). If NULL
* defaults to /etc/modprobe.d, /run/modprobe.d,
- * /usr/local/lib/modprobe.d and PREFIX/lib/modprobe.d. Give an empty
+ * /usr/local/lib/modprobe.d and ${module_prefix}/lib/modprobe.d. Give an empty
* vector if configuration should not be read. This array must
* be null terminated.
*
Index: kmod-30/man/Makefile.am
===================================================================
--- kmod-30.orig/man/Makefile.am
+++ kmod-30/man/Makefile.am
diff --git a/man/Makefile.am b/man/Makefile.am
index 2fea8e46bf2f..f550091a216a 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -22,6 +22,7 @@ CLEANFILES = $(dist_man_MANS)
else \
sed -e '/@PREFIX@/d' $< ; \
sed -e '/@DISTCONFDIR@/d' $< ; \
fi | \
+ sed -e 's|@MODULE_PREFIX@|$(module_prefix)|g' | \
+ sed -e 's|@MODULE_DIRECTORY@|$(module_directory)|g' | \
$(XSLT) \
-o $@ \
--nonet \
Index: kmod-30/man/depmod.d.xml
===================================================================
--- kmod-30.orig/man/depmod.d.xml
+++ kmod-30/man/depmod.d.xml
diff --git a/man/depmod.d.xml b/man/depmod.d.xml
index f282a39cc840..b07e6a2bd4fe 100644
--- a/man/depmod.d.xml
+++ b/man/depmod.d.xml
@@ -70,7 +70,7 @@
</term>
<listitem>
<para>
- This allows you to specify the order in which /lib/modules
+ This allows you to specify the order in which @MODULE_PREFIX@/lib/modules
+ This allows you to specify the order in which @MODULE_DIRECTORY@
(or other configured module location) subdirectories will
be processed by <command>depmod</command>. Directories are
listed in order, with the highest priority given to the
@ -138,7 +132,7 @@ Index: kmod-30/man/depmod.d.xml
specify one kernel or all kernels using the * wildcard.
<replaceable>modulesubdirectory</replaceable> is the
- name of the subdirectory under /lib/modules (or other
+ name of the subdirectory under @MODULE_PREFIX@/lib/modules (or other
+ name of the subdirectory under @MODULE_DIRECTORY@ (or other
module location) where the target module is installed.
</para>
<para>
@ -147,20 +141,20 @@ Index: kmod-30/man/depmod.d.xml
This will ensure that any matching module name installed
under the <command>extra</command> subdirectory within
- /lib/modules (or other module location) will take priority
+ @MODULE_PREFIX@/lib/modules (or other module location) will take priority
+ @MODULE_DIRECTORY@ (or other module location) will take priority
over any likenamed module already provided by the kernel.
</para>
</listitem>
Index: kmod-30/man/depmod.xml
===================================================================
--- kmod-30.orig/man/depmod.xml
+++ kmod-30/man/depmod.xml
diff --git a/man/depmod.xml b/man/depmod.xml
index 3b0097184fd7..fce2a4a67a89 100644
--- a/man/depmod.xml
+++ b/man/depmod.xml
@@ -80,7 +80,7 @@
</para>
<para> <command>depmod</command> creates a list of module dependencies by
reading each module under
- <filename>/lib/modules/</filename><replaceable>version</replaceable> and
+ <filename>@MODULE_PREFIX@/lib/modules/</filename><replaceable>version</replaceable> and
+ <filename>@MODULE_DIRECTORY@/</filename><replaceable>version</replaceable> and
determining what symbols it exports and what symbols it needs. By
default, this list is written to <filename>modules.dep</filename>, and a
binary hashed version named <filename>modules.dep.bin</filename>, in the
@ -169,48 +163,48 @@ Index: kmod-30/man/depmod.xml
<para>
If your modules are not currently in the (normal) directory
- <filename>/lib/modules/</filename><replaceable>version</replaceable>,
+ <filename>@MODULE_PREFIX@/lib/modules/</filename><replaceable>version</replaceable>,
+ <filename>@MODULE_DIRECTORY@/</filename><replaceable>version</replaceable>,
but in a staging area, you can specify a
<replaceable>basedir</replaceable> which is prepended to the
directory name. This <replaceable>basedir</replaceable> is
Index: kmod-30/man/modinfo.xml
===================================================================
--- kmod-30.orig/man/modinfo.xml
+++ kmod-30/man/modinfo.xml
diff --git a/man/modinfo.xml b/man/modinfo.xml
index 9fe0324a2527..b6c4d6045829 100644
--- a/man/modinfo.xml
+++ b/man/modinfo.xml
@@ -54,7 +54,7 @@
<command>modinfo</command> extracts information from the Linux Kernel
modules given on the command line. If the module name is not a filename,
then the
- <filename>/lib/modules/</filename><replaceable>version</replaceable>
+ <filename>@MODULE_PREFIX@/lib/modules/</filename><replaceable>version</replaceable>
+ <filename>@MODULE_DIRECTORY@/</filename><replaceable>version</replaceable>
directory is searched, as is also done by
<citerefentry><refentrytitle>modprobe</refentrytitle><manvolnum>8</manvolnum></citerefentry>
when loading kernel modules.
Index: kmod-30/man/modprobe.xml
===================================================================
--- kmod-30.orig/man/modprobe.xml
+++ kmod-30/man/modprobe.xml
diff --git a/man/modprobe.xml b/man/modprobe.xml
index db39c7a18bb7..7374f37a0f7b 100644
--- a/man/modprobe.xml
+++ b/man/modprobe.xml
@@ -78,7 +78,7 @@
is no difference between _ and - in module names (automatic
underscore conversion is performed).
<command>modprobe</command> looks in the module directory
- <filename>/lib/modules/`uname -r`</filename> for all
+ <filename>@MODULE_PREFIX@/lib/modules/`uname -r`</filename> for all
+ <filename>@MODULE_DIRECTORY@/`uname -r`</filename> for all
the modules and other files, except for the optional
configuration files in the
<filename>/etc/modprobe.d</filename> directory
Index: kmod-30/man/modules.dep.xml
===================================================================
--- kmod-30.orig/man/modules.dep.xml
+++ kmod-30/man/modules.dep.xml
diff --git a/man/modules.dep.xml b/man/modules.dep.xml
index ed633694ec9e..8ef6d8b3536e 100644
--- a/man/modules.dep.xml
+++ b/man/modules.dep.xml
@@ -34,8 +34,8 @@
</refnamediv>
<refsynopsisdiv>
- <para><filename>/lib/modules/modules.dep</filename></para>
- <para><filename>/lib/modules/modules.dep.bin</filename></para>
+ <para><filename>@MODULE_PREFIX@/lib/modules/modules.dep</filename></para>
+ <para><filename>@MODULE_PREFIX@/lib/modules/modules.dep.bin</filename></para>
+ <para><filename>@MODULE_DIRECTORY@/modules.dep</filename></para>
+ <para><filename>@MODULE_DIRECTORY@/modules.dep.bin</filename></para>
</refsynopsisdiv>
<refsect1><title>DESCRIPTION</title>
@ -219,14 +213,14 @@ Index: kmod-30/man/modules.dep.xml
<command>depmod</command> listing the dependencies for
every module in the directories under
- <filename>/lib/modules/</filename><replaceable>version</replaceable>.
+ <filename>@MODULE_PREFIX@/lib/modules/</filename><replaceable>version</replaceable>.
+ <filename>@MODULE_DIRECTORY@/</filename><replaceable>version</replaceable>.
It is used by kmod tools such as <command>modprobe</command> and
libkmod.
</para>
Index: kmod-30/testsuite/module-playground/Makefile
===================================================================
--- kmod-30.orig/testsuite/module-playground/Makefile
+++ kmod-30/testsuite/module-playground/Makefile
diff --git a/testsuite/module-playground/Makefile b/testsuite/module-playground/Makefile
index e6045b0dd932..a7ab09bea2bf 100644
--- a/testsuite/module-playground/Makefile
+++ b/testsuite/module-playground/Makefile
@@ -47,7 +47,7 @@ endif
else
@ -236,25 +230,25 @@ Index: kmod-30/testsuite/module-playground/Makefile
KVER ?= `uname -r`
ifeq ($(FAKE_BUILD),)
FAKE_BUILD=0
Index: kmod-30/testsuite/setup-rootfs.sh
===================================================================
--- kmod-30.orig/testsuite/setup-rootfs.sh
+++ kmod-30/testsuite/setup-rootfs.sh
diff --git a/testsuite/setup-rootfs.sh b/testsuite/setup-rootfs.sh
index 8b13a40f2cae..2fc7e592d1b5 100755
--- a/testsuite/setup-rootfs.sh
+++ b/testsuite/setup-rootfs.sh
@@ -16,6 +16,19 @@ create_rootfs() {
cp -r "$ROOTFS_PRISTINE" "$ROOTFS"
find "$ROOTFS" -type d -exec chmod +w {} \;
find "$ROOTFS" -type f -name .gitignore -exec rm -f {} \;
+ if [ -n "$MODULE_PREFIX" ] ; then
+ sed -i -e "s|/lib/modules|$MODULE_PREFIX/lib/modules|g" $(find "$ROOTFS" -name \*.txt -o -name \*.conf -o -name \*.dep)
+ sed -i -e "s|$MODULE_PREFIX/lib/modules/external|/lib/modules/external|g" $(find "$ROOTFS" -name \*.txt -o -name \*.conf -o -name \*.dep)
+ if [ "$MODULE_DIRECTORY" != "/lib/modules" ] ; then
+ sed -i -e "s|/lib/modules|$MODULE_DIRECTORY|g" $(find "$ROOTFS" -name \*.txt -o -name \*.conf -o -name \*.dep)
+ sed -i -e "s|$MODULE_DIRECTORY/external|/lib/modules/external|g" $(find "$ROOTFS" -name \*.txt -o -name \*.conf -o -name \*.dep)
+ for i in "$ROOTFS"/*/lib/modules/* "$ROOTFS"/*/*/lib/modules/* ; do
+ version=$(basename $i)
+ version="$(basename $i)"
+ [ $version != 'external' ] || continue
+ i=$(dirname $i)
+ lib="$(dirname $i)"
+ up="$(dirname $lib)$MODULE_PREFIX"
+ mod="$(dirname $i)"
+ lib="$(dirname $mod)"
+ up="$(dirname $lib)$MODULE_DIRECTORY"
+ mkdir -p "$up"
+ mv "$lib" "$up"
+ mv "$i" "$up"
+ done
+ fi
@ -281,28 +275,28 @@ Index: kmod-30/testsuite/setup-rootfs.sh
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-k.ko"]="mod-loop-k.ko"
- ["test-depmod/search-order-external-first/lib/modules/4.4.4/foo/"]="mod-simple.ko"
- ["test-depmod/search-order-external-first/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/search-order-simple$MODULE_PREFIX/lib/modules/4.4.4/kernel/crypto/"]="mod-simple.ko"
+ ["test-depmod/search-order-simple$MODULE_PREFIX/lib/modules/4.4.4/updates/"]="mod-simple.ko"
+ ["test-depmod/search-order-same-prefix$MODULE_PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-same-prefix$MODULE_PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-c.ko"]="mod-loop-c.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-d.ko"]="mod-loop-d.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-e.ko"]="mod-loop-e.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-f.ko"]="mod-loop-f.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-g.ko"]="mod-loop-g.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-h.ko"]="mod-loop-h.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-i.ko"]="mod-loop-i.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-j.ko"]="mod-loop-j.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-k.ko"]="mod-loop-k.ko"
+ ["test-depmod/search-order-external-first$MODULE_PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-first$MODULE_PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/search-order-simple$MODULE_DIRECTORY/4.4.4/kernel/crypto/"]="mod-simple.ko"
+ ["test-depmod/search-order-simple$MODULE_DIRECTORY/4.4.4/updates/"]="mod-simple.ko"
+ ["test-depmod/search-order-same-prefix$MODULE_DIRECTORY/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-same-prefix$MODULE_DIRECTORY/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-c.ko"]="mod-loop-c.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-d.ko"]="mod-loop-d.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-e.ko"]="mod-loop-e.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-f.ko"]="mod-loop-f.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-g.ko"]="mod-loop-g.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-h.ko"]="mod-loop-h.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-i.ko"]="mod-loop-i.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-j.ko"]="mod-loop-j.ko"
+ ["test-depmod/detect-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-k.ko"]="mod-loop-k.ko"
+ ["test-depmod/search-order-external-first$MODULE_DIRECTORY/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-first$MODULE_DIRECTORY/4.4.4/foobar/"]="mod-simple.ko"
["test-depmod/search-order-external-first/lib/modules/external/"]="mod-simple.ko"
- ["test-depmod/search-order-external-last/lib/modules/4.4.4/foo/"]="mod-simple.ko"
- ["test-depmod/search-order-external-last/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-last$MODULE_PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-last$MODULE_PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-last$MODULE_DIRECTORY/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-last$MODULE_DIRECTORY/4.4.4/foobar/"]="mod-simple.ko"
["test-depmod/search-order-external-last/lib/modules/external/"]="mod-simple.ko"
- ["test-depmod/search-order-override/lib/modules/4.4.4/foo/"]="mod-simple.ko"
- ["test-depmod/search-order-override/lib/modules/4.4.4/override/"]="mod-simple.ko"
@ -310,20 +304,20 @@ Index: kmod-30/testsuite/setup-rootfs.sh
- ["test-dependencies/lib/modules/4.0.20-kmod/kernel/"]="mod-foo-c.ko"
- ["test-dependencies/lib/modules/4.0.20-kmod/kernel/lib/"]="mod-foo-a.ko"
- ["test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/"]="mod-foo.ko"
+ ["test-depmod/search-order-override$MODULE_PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-override$MODULE_PREFIX/lib/modules/4.4.4/override/"]="mod-simple.ko"
+ ["test-dependencies$MODULE_PREFIX/lib/modules/4.0.20-kmod/kernel/fs/foo/"]="mod-foo-b.ko"
+ ["test-dependencies$MODULE_PREFIX/lib/modules/4.0.20-kmod/kernel/"]="mod-foo-c.ko"
+ ["test-dependencies$MODULE_PREFIX/lib/modules/4.0.20-kmod/kernel/lib/"]="mod-foo-a.ko"
+ ["test-dependencies$MODULE_PREFIX/lib/modules/4.0.20-kmod/kernel/fs/"]="mod-foo.ko"
+ ["test-depmod/search-order-override$MODULE_DIRECTORY/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-override$MODULE_DIRECTORY/4.4.4/override/"]="mod-simple.ko"
+ ["test-dependencies$MODULE_DIRECTORY/4.0.20-kmod/kernel/fs/foo/"]="mod-foo-b.ko"
+ ["test-dependencies$MODULE_DIRECTORY/4.0.20-kmod/kernel/"]="mod-foo-c.ko"
+ ["test-dependencies$MODULE_DIRECTORY/4.0.20-kmod/kernel/lib/"]="mod-foo-a.ko"
+ ["test-dependencies$MODULE_DIRECTORY/4.0.20-kmod/kernel/fs/"]="mod-foo.ko"
["test-init/"]="mod-simple.ko"
["test-remove/"]="mod-simple.ko"
- ["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
- ["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
- ["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
+ ["test-modprobe/show-depends$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/show-depends$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/show-depends$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
+ ["test-modprobe/show-depends$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/show-depends$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/show-depends$MODULE_DIRECTORY/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
["test-modprobe/show-exports/mod-loop-a.ko"]="mod-loop-a.ko"
- ["test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
- ["test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
@ -334,15 +328,15 @@ Index: kmod-30/testsuite/setup-rootfs.sh
- ["test-modprobe/oldkernel-force/lib/modules/3.3.3/kernel/"]="mod-simple.ko"
- ["test-modprobe/alias-to-none/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
- ["test-modprobe/module-param-kcmdline/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/softdep-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/softdep-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/install-cmd-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/install-cmd-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/force$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/oldkernel$MODULE_PREFIX/lib/modules/3.3.3/kernel/"]="mod-simple.ko"
+ ["test-modprobe/oldkernel-force$MODULE_PREFIX/lib/modules/3.3.3/kernel/"]="mod-simple.ko"
+ ["test-modprobe/alias-to-none$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/module-param-kcmdline$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/softdep-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/softdep-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/install-cmd-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/install-cmd-loop$MODULE_DIRECTORY/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/force$MODULE_DIRECTORY/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/oldkernel$MODULE_DIRECTORY/3.3.3/kernel/"]="mod-simple.ko"
+ ["test-modprobe/oldkernel-force$MODULE_DIRECTORY/3.3.3/kernel/"]="mod-simple.ko"
+ ["test-modprobe/alias-to-none$MODULE_DIRECTORY/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/module-param-kcmdline$MODULE_DIRECTORY/4.4.4/kernel/"]="mod-simple.ko"
["test-modprobe/external/lib/modules/external/"]="mod-simple.ko"
- ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
- ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
@ -350,12 +344,12 @@ Index: kmod-30/testsuite/setup-rootfs.sh
- ["test-depmod/modules-outdir/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
- ["test-depmod/modules-outdir/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
- ["test-depmod/modules-outdir/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
+ ["test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
+ ["test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
+ ["test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
+ ["test-depmod/modules-outdir$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
+ ["test-depmod/modules-outdir$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
+ ["test-depmod/modules-outdir$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
+ ["test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
+ ["test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
+ ["test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
+ ["test-depmod/modules-outdir$MODULE_DIRECTORY/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
+ ["test-depmod/modules-outdir$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
+ ["test-depmod/modules-outdir$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
["test-modinfo/mod-simple-i386.ko"]="mod-simple-i386.ko"
["test-modinfo/mod-simple-x86_64.ko"]="mod-simple-x86_64.ko"
["test-modinfo/mod-simple-sparc64.ko"]="mod-simple-sparc64.ko"
@ -365,47 +359,47 @@ Index: kmod-30/testsuite/setup-rootfs.sh
["test-modinfo/external/lib/modules/external/mod-simple.ko"]="mod-simple.ko"
- ["test-tools/insert/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
- ["test-tools/remove/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-tools/insert$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-tools/remove$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-tools/insert$MODULE_DIRECTORY/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-tools/remove$MODULE_DIRECTORY/4.4.4/kernel/"]="mod-simple.ko"
)
gzip_array=(
- "test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"
+ "test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"
+ "test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/block/cciss.ko"
)
xz_array=(
- "test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"
+ "test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"
+ "test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/scsi_mod.ko"
)
zstd_array=(
- "test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"
+ "test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"
+ "test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/hpsa.ko"
)
attach_sha256_array=(
Index: kmod-30/testsuite/test-depmod.c
===================================================================
--- kmod-30.orig/testsuite/test-depmod.c
+++ kmod-30/testsuite/test-depmod.c
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index 93606947f18a..c96dbf0a62be 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -27,7 +27,7 @@
#define MODULES_UNAME "4.4.4"
#define MODULES_ORDER_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-order-compressed"
-#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_UNAME
+#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_modules_order_for_compressed(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -55,8 +55,8 @@ DEFINE_TEST(depmod_modules_order_for_com
@@ -55,8 +55,8 @@ DEFINE_TEST(depmod_modules_order_for_compressed,
});
#define MODULES_OUTDIR_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-outdir"
-#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir/lib/modules/" MODULES_UNAME
-#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS "/lib/modules/" MODULES_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir" MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir" MODULE_DIRECTORY "/" MODULES_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_modules_outdir(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@ -414,7 +408,7 @@ Index: kmod-30/testsuite/test-depmod.c
#define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
-#define SEARCH_ORDER_SIMPLE_LIB_MODULES SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_SIMPLE_LIB_MODULES SEARCH_ORDER_SIMPLE_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_SIMPLE_LIB_MODULES SEARCH_ORDER_SIMPLE_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_search_order_simple(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@ -423,7 +417,7 @@ Index: kmod-30/testsuite/test-depmod.c
#define SEARCH_ORDER_SAME_PREFIX_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix"
-#define SEARCH_ORDER_SAME_PREFIX_LIB_MODULES SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_SAME_PREFIX_LIB_MODULES SEARCH_ORDER_SAME_PREFIX_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_SAME_PREFIX_LIB_MODULES SEARCH_ORDER_SAME_PREFIX_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_search_order_same_prefix(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@ -432,177 +426,171 @@ Index: kmod-30/testsuite/test-depmod.c
#define SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-first"
-#define SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_search_order_external_first(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -191,7 +191,7 @@ DEFINE_TEST(depmod_search_order_external
@@ -191,7 +191,7 @@ DEFINE_TEST(depmod_search_order_external_first,
});
#define SEARCH_ORDER_EXTERNAL_LAST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-last"
-#define SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES SEARCH_ORDER_EXTERNAL_LAST_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES SEARCH_ORDER_EXTERNAL_LAST_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_search_order_external_last(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -218,7 +218,7 @@ DEFINE_TEST(depmod_search_order_external
@@ -218,7 +218,7 @@ DEFINE_TEST(depmod_search_order_external_last,
});
#define SEARCH_ORDER_OVERRIDE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-override"
-#define SEARCH_ORDER_OVERRIDE_LIB_MODULES SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_OVERRIDE_LIB_MODULES SEARCH_ORDER_OVERRIDE_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_OVERRIDE_LIB_MODULES SEARCH_ORDER_OVERRIDE_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_search_order_override(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
Index: kmod-30/testsuite/test-testsuite.c
===================================================================
--- kmod-30.orig/testsuite/test-testsuite.c
+++ kmod-30/testsuite/test-testsuite.c
@@ -64,7 +64,7 @@ static int testsuite_rootfs_fopen(const
diff --git a/testsuite/test-testsuite.c b/testsuite/test-testsuite.c
index 56e73609f204..c77c4bbc04eb 100644
--- a/testsuite/test-testsuite.c
+++ b/testsuite/test-testsuite.c
@@ -64,7 +64,7 @@ static int testsuite_rootfs_fopen(const struct test *t)
char s[100];
int n;
- fp = fopen("/lib/modules/a", "r");
+ fp = fopen(MODULE_PREFIX "/lib/modules/a", "r");
+ fp = fopen(MODULE_DIRECTORY "/a", "r");
if (fp == NULL)
return EXIT_FAILURE;;
@@ -89,7 +89,7 @@ static int testsuite_rootfs_open(const s
@@ -89,7 +89,7 @@ static int testsuite_rootfs_open(const struct test *t)
char buf[100];
int fd, done;
- fd = open("/lib/modules/a", O_RDONLY);
+ fd = open(MODULE_PREFIX "/lib/modules/a", O_RDONLY);
+ fd = open(MODULE_DIRECTORY "/a", O_RDONLY);
if (fd < 0)
return EXIT_FAILURE;
@@ -121,12 +121,12 @@ static int testsuite_rootfs_stat_access(
@@ -121,12 +121,12 @@ static int testsuite_rootfs_stat_access(const struct test *t)
{
struct stat st;
- if (access("/lib/modules/a", F_OK) < 0) {
+ if (access(MODULE_PREFIX "/lib/modules/a", F_OK) < 0) {
+ if (access(MODULE_DIRECTORY "/a", F_OK) < 0) {
ERR("access failed: %m\n");
return EXIT_FAILURE;
}
- if (stat("/lib/modules/a", &st) < 0) {
+ if (stat(MODULE_PREFIX "/lib/modules/a", &st) < 0) {
+ if (stat(MODULE_DIRECTORY "/a", &st) < 0) {
ERR("stat failed: %m\n");
return EXIT_FAILURE;
}
Index: kmod-30/tools/depmod.c
===================================================================
--- kmod-30.orig/tools/depmod.c
+++ kmod-30/tools/depmod.c
diff --git a/tools/depmod.c b/tools/depmod.c
index aada5ac57902..5ef490473186 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -911,7 +911,7 @@ struct vertex;
struct mod {
struct kmod_module *kmod;
char *path;
- const char *relpath; /* path relative to '$ROOT/lib/modules/$VER/' */
+ const char *relpath; /* path relative to '$ROOT$MODULE_PREFIX/lib/modules/$VER/' */
+ const char *relpath; /* path relative to '$ROOT$MODULE_DIRECTORY/$VER/' */
char *uncrelpath; /* same as relpath but ending in .ko */
struct kmod_list *info_list;
struct kmod_list *dep_sym_list;
@@ -3024,12 +3024,21 @@ static int do_depmod(int argc, char *arg
@@ -3024,11 +3024,11 @@ static int do_depmod(int argc, char *argv[])
}
cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
- "%s/lib/modules/%s",
+ "%s" MODULE_PREFIX "/lib/modules/%s",
+ "%s" MODULE_DIRECTORY "/%s",
root ?: "", cfg.kversion);
cfg.outdirnamelen = snprintf(cfg.outdirname, PATH_MAX,
+ "%s" MODULE_PREFIX "/lib/modules/%s",
+ out_root ?: (root ?: ""), cfg.kversion);
+ struct stat sb;
+ if (stat(cfg.dirname, &sb) != 0) {
+ cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
+ "%s/lib/modules/%s",
+ root ?: "", cfg.kversion);
+ cfg.outdirnamelen = snprintf(cfg.outdirname, PATH_MAX,
"%s/lib/modules/%s",
- "%s/lib/modules/%s",
+ "%s" MODULE_DIRECTORY "/%s",
out_root ?: (root ?: ""), cfg.kversion);
+ }
if (optind == argc)
all = 1;
Index: kmod-30/tools/kmod.c
===================================================================
--- kmod-30.orig/tools/kmod.c
+++ kmod-30/tools/kmod.c
@@ -114,6 +114,7 @@ static int kmod_config(int argc, char *a
{
unsigned i;
printf("{\"prefix\":\"" PREFIX "\""
+ ",\"module_prefix\":\"" MODULE_PREFIX "\""
",\"module_compression\":[");
for(i = 0; compressions[i]; i++) {
printf("%s\"%s\"", i ? "," : "", compressions[i]);
Index: kmod-30/tools/modinfo.c
===================================================================
--- kmod-30.orig/tools/modinfo.c
+++ kmod-30/tools/modinfo.c
diff --git a/tools/kmod.pc.in b/tools/kmod.pc.in
index 2595980a6b35..97215c8ed48f 100644
--- a/tools/kmod.pc.in
+++ b/tools/kmod.pc.in
@@ -1,6 +1,7 @@
prefix=@prefix@
sysconfdir=@sysconfdir@
distconfdir=@distconfdir@
+module_directory=@module_directory@
module_compressions=@module_compressions@
module_signatures=@module_signatures@
diff --git a/tools/modinfo.c b/tools/modinfo.c
index d0aab200af4e..cacc32dc4c40 100644
--- a/tools/modinfo.c
+++ b/tools/modinfo.c
@@ -367,7 +367,7 @@ static void help(void)
"\t-m, --modname Handle argument as module name instead of alias or filename\n"
"\t-F, --field=FIELD Print only provided FIELD\n"
"\t-k, --set-version=VERSION Use VERSION instead of `uname -r`\n"
- "\t-b, --basedir=DIR Use DIR as filesystem root for /lib/modules\n"
+ "\t-b, --basedir=DIR Use DIR as filesystem root for " MODULE_PREFIX "/lib/modules\n"
+ "\t-b, --basedir=DIR Use DIR as filesystem root for " MODULE_DIRECTORY "\n"
"\t-V, --version Show version\n"
"\t-h, --help Show this help\n",
program_invocation_short_name);
@@ -462,7 +462,7 @@ static int do_modinfo(int argc, char *ar
@@ -462,7 +462,7 @@ static int do_modinfo(int argc, char *argv[])
}
kversion = u.release;
}
- snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s" MODULE_PREFIX "/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s" MODULE_DIRECTORY "/%s",
root, kversion);
dirname = dirname_buf;
}
Index: kmod-30/tools/modprobe.c
===================================================================
--- kmod-30.orig/tools/modprobe.c
+++ kmod-30/tools/modprobe.c
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 322d5d199372..c7016a58e43f 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -146,7 +146,7 @@ static void help(void)
"\t-n, --show Same as --dry-run\n"
"\t-C, --config=FILE Use FILE instead of default search paths\n"
- "\t-d, --dirname=DIR Use DIR as filesystem root for /lib/modules\n"
+ "\t-d, --dirname=DIR Use DIR as filesystem root for " MODULE_PREFIX "/lib/modules\n"
+ "\t-d, --dirname=DIR Use DIR as filesystem root for " MODULE_DIRECTORY "\n"
"\t-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
"\t-s, --syslog print to syslog, not stderr\n"
@@ -983,7 +983,7 @@ static int do_modprobe(int argc, char **
@@ -983,7 +983,7 @@ static int do_modprobe(int argc, char **orig_argv)
kversion = u.release;
}
snprintf(dirname_buf, sizeof(dirname_buf),
- "%s/lib/modules/%s", root,
+ "%s" MODULE_PREFIX "/lib/modules/%s", root,
+ "%s" MODULE_DIRECTORY "/%s", root,
kversion);
dirname = dirname_buf;
}
Index: kmod-30/tools/static-nodes.c
===================================================================
--- kmod-30.orig/tools/static-nodes.c
+++ kmod-30/tools/static-nodes.c
@@ -212,15 +212,15 @@ static int do_static_nodes(int argc, cha
diff --git a/tools/static-nodes.c b/tools/static-nodes.c
index 8d2356da73f3..5ef3743e967b 100644
--- a/tools/static-nodes.c
+++ b/tools/static-nodes.c
@@ -212,15 +212,15 @@ static int do_static_nodes(int argc, char *argv[])
goto finish;
}
- snprintf(modules, sizeof(modules), "/lib/modules/%s/modules.devname", kernel.release);
+ snprintf(modules, sizeof(modules), MODULE_PREFIX "/lib/modules/%s/modules.devname", kernel.release);
+ snprintf(modules, sizeof(modules), MODULE_DIRECTORY "/%s/modules.devname", kernel.release);
in = fopen(modules, "re");
if (in == NULL) {
if (errno == ENOENT) {
- fprintf(stderr, "Warning: /lib/modules/%s/modules.devname not found - ignoring\n",
+ fprintf(stderr, "Warning: " MODULE_PREFIX "/lib/modules/%s/modules.devname not found - ignoring\n",
+ fprintf(stderr, "Warning: " MODULE_DIRECTORY "/%s/modules.devname not found - ignoring\n",
kernel.release);
ret = EXIT_SUCCESS;
} else {
- fprintf(stderr, "Error: could not open /lib/modules/%s/modules.devname - %m\n",
+ fprintf(stderr, "Error: could not open " MODULE_PREFIX "/lib/modules/%s/modules.devname - %m\n",
+ fprintf(stderr, "Error: could not open " MODULE_DIRECTORY "/%s/modules.devname - %m\n",
kernel.release);
ret = EXIT_FAILURE;
}
--
2.41.0