Sync from SUSE:ALP:Source:Standard:1.0 kmod revision fa91191a830deddcaf33da84069edd01

This commit is contained in:
Adrian Schröter 2023-08-21 13:53:35 +02:00
commit f7c4ee80a3
26 changed files with 3252 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,33 @@
From 16c086f48c2270ad6412ad7226df53079f825270 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Thu, 30 Jun 2022 18:47:25 +0200
Subject: [PATCH] testsuite: repair read of uninitialized memory
References: https://github.com/kmod-project/kmod/pull/15
References: https://github.com/kmod-project/kmod/issues/14
Function ``test_backoff_time`` does not initialize ``delta``, and
``get_backoff_delta_msec`` then performs a read from uninitialized
memory with the ``!*delta`` expression.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
---
testsuite/test-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuite/test-util.c b/testsuite/test-util.c
index fb8c9ef..5766584 100644
--- a/testsuite/test-util.c
+++ b/testsuite/test-util.c
@@ -231,7 +231,7 @@ DEFINE_TEST(test_addu64_overflow,
static int test_backoff_time(const struct test *t)
{
- unsigned long long delta;
+ unsigned long long delta = 0;
/* Check exponential increments */
get_backoff_delta_msec(now_msec(), now_msec() + 10, &delta);
--
2.36.1

View File

@ -0,0 +1,41 @@
From bbeef7f559bd9c6b1aad11bcd65e56428f290bd8 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Wed, 26 Feb 2014 13:48:55 +0100
Subject: [PATCH 1/6] modprobe: Recognize --allow-unsupported-modules on
commandline
The option does not do anything yet, but it does not return error
either.
References: fate#316971
Patch-mainline: never
---
tools/modprobe.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/modprobe.c b/tools/modprobe.c
index a9e2331..3be2989 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -85,6 +85,8 @@ static const struct option cmdopts[] = {
{"dirname", required_argument, 0, 'd'},
{"set-version", required_argument, 0, 'S'},
+ {"allow-unsupported-modules", no_argument, 0, 128},
+
{"syslog", no_argument, 0, 's'},
{"quiet", no_argument, 0, 'q'},
{"verbose", no_argument, 0, 'v'},
@@ -843,6 +845,9 @@ static int do_modprobe(int argc, char **orig_argv)
case 'S':
kversion = optarg;
break;
+ case 128:
+ /* --allow-unsupported-modules does nothing for now */
+ break;
case 's':
env_modprobe_options_append("-s");
use_syslog = 1;
--
2.20.1

View File

@ -0,0 +1,29 @@
From ede3e6010e5a132286c3a1ee815ec88bdef847b8 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Wed, 26 Feb 2014 13:53:38 +0100
Subject: [PATCH 2/6] libkmod-config: Recognize allow_unsupported_modules in
the configuration
References: fate#316971
Patch-mainline: never
---
libkmod/libkmod-config.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index aaac0a1..1b24536 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -650,6 +650,9 @@ static int kmod_config_parse(struct kmod_config *config, int fd,
|| streq(cmd, "config")) {
ERR(ctx, "%s: command %s is deprecated and not parsed anymore\n",
filename, cmd);
+ } else if (streq(cmd, "allow_unsupported_modules")) {
+ /* dummy option for now */
+ ;
} else {
syntax_error:
ERR(ctx, "%s line %u: ignoring bad line starting with '%s'\n",
--
2.20.1

View File

@ -0,0 +1,108 @@
From 4a36f4a8b16c7fd345f6aec973d926d4e429328a Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Wed, 5 Mar 2014 14:40:14 +0100
Subject: [PATCH 3/6] libkmod: Implement filtering of unsupported modules (off
by default)
References: fate#316971
Patch-mainline: never
---
libkmod/libkmod-config.c | 12 ++++++++++--
libkmod/libkmod-internal.h | 1 +
libkmod/libkmod-module.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 1b24536..07d6a9e 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -651,8 +651,16 @@ static int kmod_config_parse(struct kmod_config *config, int fd,
ERR(ctx, "%s: command %s is deprecated and not parsed anymore\n",
filename, cmd);
} else if (streq(cmd, "allow_unsupported_modules")) {
- /* dummy option for now */
- ;
+ char *param = strtok_r(NULL, "\t ", &saveptr);
+
+ if (param == NULL)
+ goto syntax_error;
+ if (streq(param, "yes") || streq(param, "1"))
+ config->block_unsupported = 0;
+ else if (streq(param, "no") || streq(param, "0"))
+ config->block_unsupported = 1;
+ else
+ goto syntax_error;
} else {
syntax_error:
ERR(ctx, "%s line %u: ignoring bad line starting with '%s'\n",
diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h
index a65ddd1..2ad74c7 100644
--- a/libkmod/libkmod-internal.h
+++ b/libkmod/libkmod-internal.h
@@ -119,6 +119,7 @@ struct kmod_config {
struct kmod_list *softdeps;
struct kmod_list *paths;
+ int block_unsupported;
};
int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **config, const char * const *config_paths) __attribute__((nonnull(1, 2,3)));
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index bffe715..9a3a35a 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -798,6 +798,24 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod,
extern long init_module(const void *mem, unsigned long len, const char *args);
+static int check_module_supported(struct kmod_module *mod)
+{
+ char **strings;
+ int i, count;
+ struct kmod_elf *elf;
+
+ elf = kmod_file_get_elf(mod->file);
+ count = kmod_elf_get_strings(elf, ".modinfo", &strings);
+ if (count < 0)
+ return count;
+ for (i = 0; i < count; i++)
+ if (streq(strings[i], "supported=yes") ||
+ streq(strings[i], "supported=external")) {
+ return 1;
+ }
+ return 0;
+}
+
/**
* kmod_module_insert_module:
* @mod: kmod module
@@ -823,6 +841,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
struct kmod_elf *elf;
const char *path;
const char *args = options ? options : "";
+ const struct kmod_config *config = kmod_get_config(mod->ctx);
if (mod == NULL)
return -ENOENT;
@@ -841,6 +860,18 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
}
}
+ if (config->block_unsupported) {
+ err = check_module_supported(mod);
+ if (err < 0)
+ return err;
+ else if (err == 0) {
+ ERR(mod->ctx, "module '%s' is unsupported\n", mod->name);
+ ERR(mod->ctx, "Use --allow-unsupported or set allow_unsupported_modules 1 in\n");
+ ERR(mod->ctx, "/etc/modprobe.d/10-unsupported-modules.conf\n");
+ return -EPERM;
+ }
+ }
+
if (kmod_file_get_direct(mod->file)) {
unsigned int kernel_flags = 0;
--
2.20.1

View File

@ -0,0 +1,97 @@
From 6cf25e17064cb213ef8c3a9c84ab787dd2852f2a Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Wed, 5 Mar 2014 15:02:44 +0100
Subject: [PATCH 4/6] modprobe: Implement --allow-unsupported-modules
References: fate#316971
Patch-mainline: never
---
Makefile.am | 4 +++-
libkmod/libkmod-unsupported.c | 9 +++++++++
libkmod/libkmod-unsupported.h | 8 ++++++++
tools/modprobe.c | 8 +++++++-
4 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 libkmod/libkmod-unsupported.c
create mode 100644 libkmod/libkmod-unsupported.h
diff -u kmod-28.orig/Makefile.am kmod-28/Makefile.am
--- kmod-28.orig/Makefile.am 2021-01-07 19:29:12.972438665 +0100
+++ kmod-28/Makefile.am 2021-01-28 12:59:16.613421834 +0100
@@ -108,7 +108,9 @@
${libzstd_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
noinst_LTLIBRARIES += libkmod/libkmod-internal.la
-libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
+libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES) \
+ libkmod/libkmod-unsupported.c \
+ libkmod/libkmod-unsupported.h
libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
-Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
Index: kmod-27/libkmod/libkmod-unsupported.c
===================================================================
--- /dev/null
+++ kmod-27/libkmod/libkmod-unsupported.c
@@ -0,0 +1,9 @@
+#include "libkmod-internal.h"
+#include "libkmod-unsupported.h"
+
+void kmod_internal_allow_unsupported(struct kmod_ctx *ctx)
+{
+ struct kmod_config *config = (struct kmod_config *)kmod_get_config(ctx);
+
+ config->block_unsupported = 0;
+}
Index: kmod-27/libkmod/libkmod-unsupported.h
===================================================================
--- /dev/null
+++ kmod-27/libkmod/libkmod-unsupported.h
@@ -0,0 +1,8 @@
+#pragma once
+
+/*
+ * This function implements the --allow-unsupported-modules modprobe
+ * option. It is not part of the kmod API and not exported by the shared
+ * library
+ */
+void kmod_internal_allow_unsupported(struct kmod_ctx *ctx);
Index: kmod-27/tools/modprobe.c
===================================================================
--- kmod-27.orig/tools/modprobe.c
+++ kmod-27/tools/modprobe.c
@@ -38,6 +38,8 @@
#include "kmod.h"
+#include "libkmod/libkmod-unsupported.h"
+
static int log_priority = LOG_CRIT;
static int use_syslog = 0;
#define LOG(...) log_printf(log_priority, __VA_ARGS__)
@@ -761,6 +763,7 @@ static int do_modprobe(int argc, char **
const char *dirname = NULL;
const char *root = NULL;
const char *kversion = NULL;
+ int allow_unsupported = 0;
int use_all = 0;
int do_remove = 0;
int do_show_config = 0;
@@ -852,7 +855,7 @@ static int do_modprobe(int argc, char **
kversion = optarg;
break;
case 128:
- /* --allow-unsupported-modules does nothing for now */
+ allow_unsupported = 1;
break;
case 's':
env_modprobe_options_append("-s");
@@ -925,6 +928,9 @@ static int do_modprobe(int argc, char **
log_setup_kmod_log(ctx, verbose);
+ if (allow_unsupported)
+ kmod_internal_allow_unsupported(ctx);
+
kmod_load_resources(ctx);
if (do_show_config)

View File

@ -0,0 +1,52 @@
From 9d2f7d1e372d79dfe732992effb33daf4ee56235 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Fri, 4 Apr 2014 10:08:01 +0200
Subject: [PATCH 5/6] Do not filter unsupported modules when running a vanilla
kernel
References: bnc#871066
Patch-mainline: never
---
libkmod/libkmod-config.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 07d6a9e..550a612 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -566,6 +566,18 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
return 0;
}
+/*
+ * Check if kernel is built with the SUSE "suppported-flag" patch
+ */
+static int is_suse_kernel(void)
+{
+ if (access("/proc/sys/kernel/", F_OK) == 0 &&
+ access("/proc/sys/kernel/unsupported", F_OK) == -1 &&
+ errno == ENOENT)
+ return 0;
+ return 1;
+}
+
/*
* Take an fd and own it. It will be closed on return. filename is used only
* for debug messages
@@ -657,9 +669,10 @@ static int kmod_config_parse(struct kmod_config *config, int fd,
goto syntax_error;
if (streq(param, "yes") || streq(param, "1"))
config->block_unsupported = 0;
- else if (streq(param, "no") || streq(param, "0"))
- config->block_unsupported = 1;
- else
+ else if (streq(param, "no") || streq(param, "0")) {
+ if (is_suse_kernel())
+ config->block_unsupported = 1;
+ } else
goto syntax_error;
} else {
syntax_error:
--
2.20.1

View File

@ -0,0 +1,75 @@
From e48d1ee5980643f56165a9ee1687ff64f864aeb6 Mon Sep 17 00:00:00 2001
From: Vlad Bespalov <vlad.bespalov@jetstreamsoft.com>
Date: Fri, 8 Jun 2018 21:13:00 +0000
Subject: [PATCH 6/6] modprobe: print status of "allow_unsupported_modules"
variable
In SLES11 modprobe printed everything referenced in /etc/modprobe.d
in SLES12 config parsing changed to explicitly find and print
specific groups of modprobe options, which did not print
the status of "allow_unsupported_modules" option when running
modprobe -c
The proposed patch fixes this deficiency
Patch-mainline: never
---
libkmod/libkmod-config.c | 13 +++++++++++++
libkmod/libkmod.h | 1 +
tools/modprobe.c | 5 +++++
3 files changed, 19 insertions(+)
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 550a612..0fc2250 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -1008,6 +1008,19 @@ static struct kmod_config_iter *kmod_config_iter_new(const struct kmod_ctx* ctx,
* @short_description: retrieve current libkmod configuration
*/
+/*
+ * kmod_config_unsupported_allowed:
+ * @ctx: kmod library context
+ *
+ * Retrieve status of unsupported modules
+ */
+KMOD_EXPORT bool kmod_config_unsupported_allowed(const struct kmod_ctx *ctx)
+{
+ struct kmod_config *config = (struct kmod_config *)kmod_get_config(ctx);
+
+ return !config->block_unsupported;
+}
+
/**
* kmod_config_get_blacklists:
* @ctx: kmod library context
diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h
index 352627e..c2b9657 100644
--- a/libkmod/libkmod.h
+++ b/libkmod/libkmod.h
@@ -115,6 +115,7 @@ const char *kmod_config_iter_get_key(const struct kmod_config_iter *iter);
const char *kmod_config_iter_get_value(const struct kmod_config_iter *iter);
bool kmod_config_iter_next(struct kmod_config_iter *iter);
void kmod_config_iter_free_iter(struct kmod_config_iter *iter);
+bool kmod_config_unsupported_allowed(const struct kmod_ctx *ctx);
/*
* kmod_module
diff --git a/tools/modprobe.c b/tools/modprobe.c
index aa4033d..4f1c54a 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -201,6 +201,11 @@ static int show_config(struct kmod_ctx *ctx)
kmod_config_iter_free_iter(iter);
}
+ // SUSE specific option:
+ if (!kmod_config_unsupported_allowed(ctx)) {
+ puts("allow_unsupported_modules 0\n");
+ }
+
puts("\n# End of configuration files. Dumping indexes now:\n");
fflush(stdout);
--
2.20.1

9
README.usrmerge Normal file
View File

@ -0,0 +1,9 @@
The Tumbleweed kmod and kernel are patched to install modules into
/usr/lib/modules (the --with-module-directory configure argument.)
This is not compatible with upstream kernel, and upstream rejected patch to
make the kernel build system detect this. Suggested solution is to use
make MODLIB='$(INSTALL_MOD_PATH)/usr/lib/modules/$(KERNELRELEASE)'
when building the upstream kernel.

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>kmod-testsuite</package>
</multibuild>

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

@ -0,0 +1,288 @@
From 7e145ef8bd7a45fef6ee4cf56d7fab9f21d23e72 Mon Sep 17 00:00:00 2001
From: Emil Velikov <emil.velikov@collabora.com>
Date: Mon, 6 Feb 2023 13:18:34 +0000
Subject: [PATCH 5/9] depmod: Introduce outdir option
This option is equivalent to basedir, with the small difference being
that's where the meta-data files are generated. In other words, this
allows us to have read-only input modules and modules.dep, while still
being able to generate the meta-data files.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
[ Move files to a different dir so input files (produced by kernel build
system is separate from the files generated by depmod (output) ]
Signed-off-by: Lucas De Marchi <lucas.demarchi@gmail.com>
---
man/depmod.xml | 20 ++++++++++
.../modules-outdir/correct-modules.alias | 37 +++++++++++++++++++
.../modules-outdir/correct-modules.dep | 3 ++
.../lib/modules/4.4.4/modules.builtin | 0
.../lib/modules/4.4.4/modules.order | 7 ++++
testsuite/setup-rootfs.sh | 3 ++
testsuite/test-depmod.c | 36 ++++++++++++++++++
tools/depmod.c | 25 +++++++++++--
8 files changed, 128 insertions(+), 3 deletions(-)
create mode 100644 testsuite/rootfs-pristine/test-depmod/modules-outdir/correct-modules.alias
create mode 100644 testsuite/rootfs-pristine/test-depmod/modules-outdir/correct-modules.dep
create mode 100644 testsuite/rootfs-pristine/test-depmod/modules-outdir/lib/modules/4.4.4/modules.builtin
create mode 100644 testsuite/rootfs-pristine/test-depmod/modules-outdir/lib/modules/4.4.4/modules.order
diff --git a/man/depmod.xml b/man/depmod.xml
index ea0be27280b2..3b0097184fd7 100644
--- a/man/depmod.xml
+++ b/man/depmod.xml
@@ -45,6 +45,7 @@
<cmdsynopsis>
<command>depmod</command>
<arg><option>-b <replaceable>basedir</replaceable></option></arg>
+ <arg><option>-o <replaceable>outdir</replaceable></option></arg>
<arg><option>-e</option></arg>
<arg><option>-E <replaceable>Module.symvers</replaceable></option></arg>
<arg><option>-F <replaceable>System.map</replaceable></option></arg>
@@ -151,6 +152,25 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>-o <replaceable>outdir</replaceable></option>
+ </term>
+ <term>
+ <option>--outdir <replaceable>outdir</replaceable></option>
+ </term>
+ <listitem>
+ <para>
+ Set the output directory where depmod will store any generated file.
+ <replaceable>outdir</replaceable> serves as a root to that location,
+ similar to how <replaceable>basedir</replaceable> is used. Also this
+ setting takes precedence and if used together with
+ <replaceable>basedir</replaceable> it will result in the input being
+ that directory, but the output being the one set by
+ <replaceable>outdir</replaceable>.
+ </para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term>
<option>-C</option>
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-outdir/correct-modules.alias b/testsuite/rootfs-pristine/test-depmod/modules-outdir/correct-modules.alias
new file mode 100644
index 000000000000..56753291c47e
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/modules-outdir/correct-modules.alias
@@ -0,0 +1,37 @@
+# Aliases extracted from modules themselves.
+alias pci:v0000103Cd00003230sv0000103Csd0000323Dbc*sc*i* cciss
+alias pci:v0000103Cd00003230sv0000103Csd00003237bc*sc*i* cciss
+alias pci:v0000103Cd00003238sv0000103Csd00003215bc*sc*i* cciss
+alias pci:v0000103Cd00003238sv0000103Csd00003214bc*sc*i* cciss
+alias pci:v0000103Cd00003238sv0000103Csd00003213bc*sc*i* cciss
+alias pci:v0000103Cd00003238sv0000103Csd00003212bc*sc*i* cciss
+alias pci:v0000103Cd00003238sv0000103Csd00003211bc*sc*i* cciss
+alias pci:v0000103Cd00003230sv0000103Csd00003235bc*sc*i* cciss
+alias pci:v0000103Cd00003230sv0000103Csd00003234bc*sc*i* cciss
+alias pci:v0000103Cd00003230sv0000103Csd00003223bc*sc*i* cciss
+alias pci:v0000103Cd00003220sv0000103Csd00003225bc*sc*i* cciss
+alias pci:v00000E11d00000046sv00000E11sd0000409Dbc*sc*i* cciss
+alias pci:v00000E11d00000046sv00000E11sd0000409Cbc*sc*i* cciss
+alias pci:v00000E11d00000046sv00000E11sd0000409Bbc*sc*i* cciss
+alias pci:v00000E11d00000046sv00000E11sd0000409Abc*sc*i* cciss
+alias pci:v00000E11d00000046sv00000E11sd00004091bc*sc*i* cciss
+alias pci:v00000E11d0000B178sv00000E11sd00004083bc*sc*i* cciss
+alias pci:v00000E11d0000B178sv00000E11sd00004082bc*sc*i* cciss
+alias pci:v00000E11d0000B178sv00000E11sd00004080bc*sc*i* cciss
+alias pci:v00000E11d0000B060sv00000E11sd00004070bc*sc*i* cciss
+alias pci:v0000103Cd*sv*sd*bc01sc04i* hpsa
+alias pci:v0000103Cd0000323Bsv0000103Csd00003356bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Bsv0000103Csd00003355bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Bsv0000103Csd00003354bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Bsv0000103Csd00003353bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Bsv0000103Csd00003352bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Bsv0000103Csd00003351bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Bsv0000103Csd00003350bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Asv0000103Csd00003233bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Asv0000103Csd0000324Bbc*sc*i* hpsa
+alias pci:v0000103Cd0000323Asv0000103Csd0000324Abc*sc*i* hpsa
+alias pci:v0000103Cd0000323Asv0000103Csd00003249bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Asv0000103Csd00003247bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Asv0000103Csd00003245bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Asv0000103Csd00003243bc*sc*i* hpsa
+alias pci:v0000103Cd0000323Asv0000103Csd00003241bc*sc*i* hpsa
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-outdir/correct-modules.dep b/testsuite/rootfs-pristine/test-depmod/modules-outdir/correct-modules.dep
new file mode 100644
index 000000000000..ec50ac32426a
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/modules-outdir/correct-modules.dep
@@ -0,0 +1,3 @@
+kernel/drivers/block/cciss.ko:
+kernel/drivers/scsi/scsi_mod.ko:
+kernel/drivers/scsi/hpsa.ko: kernel/drivers/scsi/scsi_mod.ko
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-outdir/lib/modules/4.4.4/modules.builtin b/testsuite/rootfs-pristine/test-depmod/modules-outdir/lib/modules/4.4.4/modules.builtin
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/testsuite/rootfs-pristine/test-depmod/modules-outdir/lib/modules/4.4.4/modules.order b/testsuite/rootfs-pristine/test-depmod/modules-outdir/lib/modules/4.4.4/modules.order
new file mode 100644
index 000000000000..4b643099f661
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/modules-outdir/lib/modules/4.4.4/modules.order
@@ -0,0 +1,7 @@
+#336
+kernel/drivers/block/cciss.ko
+#2094
+kernel/drivers/scsi/scsi_mod.ko
+#2137
+kernel/drivers/scsi/hpsa.ko
+
diff --git a/testsuite/setup-rootfs.sh b/testsuite/setup-rootfs.sh
index d9cc627f7224..3e814d22d813 100755
--- a/testsuite/setup-rootfs.sh
+++ b/testsuite/setup-rootfs.sh
@@ -70,6 +70,9 @@ map=(
["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"
["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
+ ["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-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"
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index d7802d7b2e0b..6e3ae562d766 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -57,6 +57,42 @@ DEFINE_TEST(depmod_modules_order_for_compressed,
},
});
+#define MODULES_OUTDIR_UNAME "4.4.4"
+#define MODULES_OUTDIR_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-outdir"
+#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir/lib/modules/" MODULES_OUTDIR_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS "/lib/modules/" MODULES_OUTDIR_UNAME
+static noreturn int depmod_modules_outdir(const struct test *t)
+{
+ const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
+ const char *const args[] = {
+ progname,
+ "--outdir", MODULES_OUTDIR_ROOTFS "/outdir/",
+ NULL,
+ };
+
+ test_spawn_prog(progname, args);
+ exit(EXIT_FAILURE);
+}
+
+DEFINE_TEST(depmod_modules_outdir,
+#if defined(KMOD_SYSCONFDIR_NOT_ETC)
+ .skip = true,
+#endif
+ .description = "check if depmod honours the outdir option",
+ .config = {
+ [TC_UNAME_R] = MODULES_OUTDIR_UNAME,
+ [TC_ROOTFS] = MODULES_OUTDIR_ROOTFS,
+ },
+ .output = {
+ .files = (const struct keyval[]) {
+ { MODULES_OUTDIR_LIB_MODULES_OUTPUT "/modules.dep",
+ MODULES_OUTDIR_ROOTFS "/correct-modules.dep" },
+ { MODULES_OUTDIR_LIB_MODULES_OUTPUT "/modules.alias",
+ MODULES_OUTDIR_ROOTFS "/correct-modules.alias" },
+ { }
+ },
+ });
+
#define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
static noreturn int depmod_search_order_simple(const struct test *t)
{
diff --git a/tools/depmod.c b/tools/depmod.c
index a9349b20ee9c..2d4cf75fdfee 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -59,11 +59,12 @@ static const char *default_cfg_paths[] = {
NULL
};
-static const char cmdopts_s[] = "aAb:C:E:F:euqrvnP:wmVh";
+static const char cmdopts_s[] = "aAb:o:C:E:F:euqrvnP:wmVh";
static const struct option cmdopts[] = {
{ "all", no_argument, 0, 'a' },
{ "quick", no_argument, 0, 'A' },
{ "basedir", required_argument, 0, 'b' },
+ { "outdir", required_argument, 0, 'o' },
{ "config", required_argument, 0, 'C' },
{ "symvers", required_argument, 0, 'E' },
{ "filesyms", required_argument, 0, 'F' },
@@ -105,6 +106,7 @@ static void help(void)
"\n"
"The following options are useful for people managing distributions:\n"
"\t-b, --basedir=DIR Use an image of a module tree.\n"
+ "\t-o, --outdir=DIR Output directory for generated files.\n"
"\t-F, --filesyms=FILE Use the file instead of the\n"
"\t current kernel symbols.\n"
"\t-E, --symvers=FILE Use Module.symvers file to check\n"
@@ -468,6 +470,8 @@ struct cfg {
const char *kversion;
char dirname[PATH_MAX];
size_t dirnamelen;
+ char outdirname[PATH_MAX];
+ size_t outdirnamelen;
char sym_prefix;
uint8_t check_symvers;
uint8_t print_unknown;
@@ -2577,7 +2581,7 @@ static int depmod_output(struct depmod *depmod, FILE *out)
{ "modules.devname", output_devname },
{ }
};
- const char *dname = depmod->cfg->dirname;
+ const char *dname = depmod->cfg->outdirname;
int dfd, err = 0;
struct timeval tv;
@@ -2586,6 +2590,11 @@ static int depmod_output(struct depmod *depmod, FILE *out)
if (out != NULL)
dfd = -1;
else {
+ err = mkdir_p(dname, strlen(dname), 0755);
+ if (err < 0) {
+ CRIT("could not create directory %s: %m\n", dname);
+ return err;
+ }
dfd = open(dname, O_RDONLY);
if (dfd < 0) {
err = -errno;
@@ -2899,6 +2908,7 @@ static int do_depmod(int argc, char *argv[])
FILE *out = NULL;
int err = 0, all = 0, maybe_all = 0, n_config_paths = 0;
_cleanup_free_ char *root = NULL;
+ _cleanup_free_ char *out_root = NULL;
_cleanup_free_ const char **config_paths = NULL;
const char *system_map = NULL;
const char *module_symvers = NULL;
@@ -2928,6 +2938,11 @@ static int do_depmod(int argc, char *argv[])
free(root);
root = path_make_absolute_cwd(optarg);
break;
+ case 'o':
+ if (out_root)
+ free(out_root);
+ out_root = path_make_absolute_cwd(optarg);
+ break;
case 'C': {
size_t bytes = sizeof(char *) * (n_config_paths + 2);
void *tmp = realloc(config_paths, bytes);
@@ -3010,7 +3025,11 @@ static int do_depmod(int argc, char *argv[])
cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
"%s/lib/modules/%s",
- root == NULL ? "" : root, cfg.kversion);
+ 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

16
kmod-30.tar.sign Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE6rM8lpABPHM5FqyDm6KlpjDL6lMFAmK9v0IACgkQm6KlpjDL
6lNxuRAAhPg6EYA3Y+fYefTDN7sEc4LA64Y8uu7GIHqZzTwislxN+15pU5gSUjDF
igk84+lYEnmgO5uMVdQrilelxzhq4lhxxjwTjSK/nFUzZoCAQDGirWk34FnMcXCi
mHtbqtFy9ZZdZ+ktisI1uGKYkTNIhhQp6iuLdgYugSVgEjXTKIhjZsRu96OzY82a
1qh7i4CZNCqaS2qPjs8FukBwvgG1xEp3mlnZMkjA9j28WJVsJ9dxxkdXB03wfnvf
E1lFX4HDqwLH//vXQvDo4nD6JhXNGn7bSCKWb88doW6KkMCBhPVKql/lo2It2+sj
VbmzCrtn8GR42FmVhJZKMPMLxYsUgRVn08W2y6ThZOBWtK5tFCOHHHhGjh3D16WI
9jVmmvmn9bNNNhrJJncRWUfmYlf4v9CX8yBfzq5a4z7XYloo/XR77WDuB+G0o4jN
vukauZhsVg8LxPIv+q6xfE0WRzOqAjl2qQRdewYJJBDXLFTa8/9QlYy/LMEPZ6u9
hMnrUNHjUQBVojKLxHlArjZXflSp5DY46+IyhRrFWnPd1wArTvF0IStJn2rm2UuO
F0MfRXwMJwqll7TR9lai+X+7deh+F9YY5XyhXKXTseJYnaO28rzVMk+tBHmZFm5l
1R9gq+TsJZBVLKeb/QpeCdfdkoyDAmnd0PB8aA6IHdwzgx9nBB0=
=SXtI
-----END PGP SIGNATURE-----

BIN
kmod-30.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

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

114
kmod-testsuite.spec Normal file
View File

@ -0,0 +1,114 @@
#
# spec file for package kmod-testsuite
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150200
%define use_zstd 1
%endif
Name: kmod-testsuite
%define lname libkmod2
Version: 30
Release: 0
Summary: Testsuite of the kmod package
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Kernel
URL: https://www.kernel.org/pub/linux/utils/kernel/kmod/
#Git-Web: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary
#Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod
Source: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.xz
Source2: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.sign
Source3: kmod.keyring
Patch1: 0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch
Patch2: 0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch
Patch3: 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
Patch4: 0010-modprobe-Implement-allow-unsupported-modules.patch
Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch
Patch6: 0012-modprobe-print-unsupported-status.patch
Patch7: 0001-testsuite-repair-read-of-uninitialized-memory.patch
Patch8: man-depmod.d-Fix-incorrect-usr-lib-search-path.patch
Patch9: usr-lib-modprobe.patch
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-pkgconfig-file-with-kmod-compile-time-confi.patch
Patch15: usr-lib-modules.patch
Patch16: no-stylesheet-download.patch
Patch17: configure-Detect-openssl-sm3-support.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: docbook-xsl-stylesheets
BuildRequires: kernel-default-devel
BuildRequires: libopenssl-devel >= 1.1.0
BuildRequires: libtool
BuildRequires: libxslt-tools
BuildRequires: pkgconfig >= 0.21
BuildRequires: xz
BuildRequires: pkgconfig(liblzma) >= 4.99
%if 0%{?use_zstd}
BuildRequires: zstd
BuildRequires: pkgconfig(libzstd)
%endif
BuildRequires: pkgconfig(zlib)
Requires: suse-module-tools
%if !0%{?is_opensuse}
ExcludeArch: %ix86 s390
%endif
%define kdir /usr/src/linux-obj/%_target_cpu/default
%description
This spec file does not produce any binary RPMs. It just builds kmod and
runs its testsuite. It has been split off the kmod package to avoid a
buildloop with the kernel.
%prep
%setup -q -n kmod-%version
%autopatch -p1
%build
GTKDOCIZE=/bin/true autoreconf -fi
export LDFLAGS="-Wl,-z,relro,-z,now"
# The extra --includedir gives us the possibility to detect dependent
# packages which fail to properly use pkgconfig.
%configure \
--with-xz \
--with-zlib \
--with-openssl \
%if 0%{?use_zstd}
--with-zstd \
%endif
--includedir="%_includedir/kmod" \
--with-rootlibdir="%_libdir" \
%if 0%{?suse_version} > 1500
--with-module-directory="%_prefix/lib/modules" \
%endif
--bindir="%_bindir"
%make_build KDIR="%kdir"
%install
# empty
%check
%ifarch ppc64
make check V=1 KDIR="%kdir" || echo "Warning: bypass boo#897845"
%else
make check V=1 KDIR="%kdir"
%endif
%changelog

729
kmod.changes Normal file
View File

@ -0,0 +1,729 @@
-------------------------------------------------------------------
Mon Jul 24 12:50:23 UTC 2023 - Michal Suchanek <msuchanek@suse.de>
- Remove compatibility patches, add README.usrmerge (boo#1212835).
* Delete Provide-fallback-for-successfully-running-make-modules_install.patch
* Delete compat-module_directory-module_prefix.patch
-------------------------------------------------------------------
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>
- Edit usr-lib-modules.patch to /lib/modules provide fallback
behavior for successfully running `make modules_install` in
pristine tarballs.
-------------------------------------------------------------------
Fri Jun 30 16:39:17 UTC 2023 - Michal Suchanek <msuchanek@suse.de>
- Fix up usrmerge patches to make the feature configurable (boo#1212835)
* testsuite-Handle-different-sysconfdir.patch
* testsuite-depmod-use-defines-for-the-rootfs-lib_modu.patch
* depmod-Introduce-outdir-option.patch
* man-depmod.d-Fix-incorrect-usr-lib-search-path.patch
* kmod-Add-config-command-to-show-compile-time-configu.patch
- Refresh usr-lib-modprobe.patch
- Refresh usr-lib-modules.patch
- Refresh no-stylesheet-download.patch
-------------------------------------------------------------------
Fri May 26 10:22:03 UTC 2023 - Michal Suchanek <msuchanek@suse.de>
- On usrmerged system move kernel modules into /usr as well (boo#1211796)
* usr-lib-modules.patch
* testsuite-Move-setup-rootfs-logic-from-Makefile-to-s.patch
- Refresh usr-lib-modprobe.patch
- Refresh no-stylesheet-download.patch
-------------------------------------------------------------------
Thu May 4 11:17:59 UTC 2023 - Dominique Leuenberger <dimstar@opensuse.org>
- Add _multibuild to define 2nd spec file as additional flavor.
Eliminates the need for source package links in OBS.
-------------------------------------------------------------------
Tue Dec 27 12:38:29 UTC 2022 - Ludwig Nussel <lnussel@suse.com>
- Replace transitional %usrmerged macro with regular version check (boo#1206798)
-------------------------------------------------------------------
Thu Jun 30 16:15:35 UTC 2022 - Jan Engelhardt <jengelh@inai.de>
- Update to release 30
* libkmod: support for the SM3 hash algorithm
* modprobe: added the --wait option
- Drop libkmod-Provide-info-even-for-modules-built-into-the.patch
(merged)
- Add 0001-testsuite-repair-read-of-uninitialized-memory.patch
-------------------------------------------------------------------
Mon Mar 28 15:01:46 UTC 2022 - Dirk Müller <dmueller@suse.com>
- add keyring so that gpg validation actually does something
-------------------------------------------------------------------
Mon Dec 6 11:00:57 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- Ensure that kmod and packages linking to libkmod provide same features
(bsc#1193430).
-------------------------------------------------------------------
Thu Oct 28 07:38:29 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- Enable ZSTD on 15.3 as well (boo#1192104).
- Only test ZSTD in testsuite on releases where it is available.
-------------------------------------------------------------------
Fri Sep 24 10:40:22 UTC 2021 - Michal Suchanek <msuchanek@suse.de>
- Enable ZSTD on 15.4 (jsc#SLE-21256).
-------------------------------------------------------------------
Mon Sep 6 12:29:23 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- Use docbook 4 rather than docbook 5 for building man pages (bsc#1190190).
* Refres no-stylesheet-download.patch
-------------------------------------------------------------------
Fri Aug 27 07:56:40 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- Add ZSTD support on Tumbleweed only. Add a way to detect ZSTD.
-------------------------------------------------------------------
Wed Aug 18 10:55:57 UTC 2021 - Michal Suchanek <msuchanek@suse.de>
- Display module information even for modules built into the running kernel
(bsc#1189537).
+ libkmod-Provide-info-even-for-modules-built-into-the.patch
-------------------------------------------------------------------
Mon Jun 7 06:29:19 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Enable support for ZSTD compressed modules
-------------------------------------------------------------------
Sat May 29 09:58:09 UTC 2021 - Michal Suchanek <msuchanek@suse.de>
- /usr/lib should override /lib where both are available. Support /usr/lib for
depmod.d as well.
* Refresh usr-lib-modprobe.patch
- Remove test patches included in release 29
- kmod-populate-modules-Use-more-bash-more-quotes.patch
- kmod-testsuite-compress-modules-if-feature-is-enabled.patch
- kmod-also-test-xz-compression.patch
-------------------------------------------------------------------
Thu May 27 22:20:42 UTC 2021 - Jan Engelhardt <jengelh@inai.de>
- Update to release 29
* Fix `modinfo -F` not working for built-in modules and
certain fields.
* Fix a memory leak, overflow and double free on error path.
- Drop 0001-Fix-modinfo-F-always-shows-name-for-built-ins.patch,
0001-libkmod-config-revamp-kcmdline-parsing-into-a-state-.patch,
0002-libkmod-config-re-quote-option-from-kernel-cmdline.patch
(all merged)
-------------------------------------------------------------------
Thu Feb 18 08:19:01 UTC 2021 - Jiri Slaby <jslaby@suse.cz>
- Fix grub's requoted kernel parameters (bsc#1181111)
* 0001-libkmod-config-revamp-kcmdline-parsing-into-a-state-.patch
* 0002-libkmod-config-re-quote-option-from-kernel-cmdline.patch
-------------------------------------------------------------------
Thu Feb 4 08:55:08 UTC 2021 - Michal Suchanek <msuchanek@suse.de>
- Fix tests to not test disabled features. Disable zstd again.
* kmod-populate-modules-Use-more-bash-more-quotes.patch
* kmod-testsuite-compress-modules-if-feature-is-enabled.patch
* kmod-also-test-xz-compression.patch
-------------------------------------------------------------------
Fri Jan 29 11:54:30 UTC 2021 - Dominique Leuenberger <dimstar@opensuse.org>
- Supplement bash-completion subpackage against the main package
and bash-completion.
- Also require the main package plus bash-completion: the
completion package is useless without either of the two.
-------------------------------------------------------------------
Thu Jan 28 12:05:17 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- Update to v28
* Add Zstandard to the supported compression formats using libzstd
(tests only - cannot be disabled in tests)
* Ignore ill-formed kernel command line, e.g. with "ivrs_acpihid[00:14.5]=AMD0020:0"
option in it
* Fix some memory leaks
* Fix 0-length builtin.alias.bin: it needs at least the index header
-------------------------------------------------------------------
Thu Jan 28 11:03:09 UTC 2021 - Petr Vorel <pvorel@suse.cz>
- Backport upstream fix 0001-Fix-modinfo-F-always-shows-name-for-built-ins.patch
-------------------------------------------------------------------
Tue Jan 12 16:04:41 UTC 2021 - Michal Suchanek <msuchanek@suse.de>
- Update usr-lib-modprobe.patch to upstream submission (boo#1180821).
- Require libxslt-tools for xsltproc and use local stylesheet.
* no-stylesheet-download.patch
-------------------------------------------------------------------
Fri Nov 6 11:41:50 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
- Add usr-lib-modprobe.patch [boo#1092648]
-------------------------------------------------------------------
Fri Oct 16 10:00:21 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
- prepare usrmerge (boo#1029961)
-------------------------------------------------------------------
Tue Jul 7 13:05:53 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
- Drop old RPM constructs from the build recipe.
-------------------------------------------------------------------
Fri Jul 3 11:36:22 UTC 2020 - Michal Suchanek <msuchanek@suse.com>
- Drop kmod-compat (boo#1173353):
The symlinks in kmod-compat are not obsolete. They are
desirable for kernel module autoload. The "kernel.modprobe"
sysctl references /sbin/modprobe, and changing it to
"/usr/bin/kmod load" is not possible, because this sysctl
specifies a single executable, not a command (so spaces will be
treated as part of the filename).
-------------------------------------------------------------------
Wed May 27 23:31:52 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
- Update to release 27
* Link to libcrypto rather than requiring openssl.
* Use PKCS#7 instead of CMS for parsing module signature to be
compatible with LibreSSL and OpenSSL < 1.1.0.
* Teach modinfo to parse modules.builtin.modinfo. When using
Linux kernel >= v5.2~rc1, it is possible to get module
information from this new file.
-------------------------------------------------------------------
Tue Feb 12 19:41:20 UTC 2019 - Michal Suchanek <msuchanek@suse.com>
- Enable PKCS#7 signature parsing again - requires openssl
- Fix testsuite build - requires kernel-default-devel
-------------------------------------------------------------------
Fri Feb 8 00:31:29 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Update to new upstream release 26
* depmod now handles parallel invocations better by protecting
the temporary files being used.
* modprobe has a new --show-exports option. Under the hood,
this reads the .symtab and .strtab sections rather than
__versions so it shows useful data even if kernel is
configured without modversions (CONFIG_MODVERSIONS).
* modinfo supports PKCS#7 parsing by using openssl.
- Replaced the asn1c-based parser by an openssl-based PKCS
parser.
- Remove libkmod-signature-Fix-crash-when-module-signature-is.patch,
libkmod-signature-pkcs-7-fix-crash-when-signer-info-.patch,
libkmod-signature-implement-pkcs7-parsing-with-asn1c.patch
(not accepted upstream)
- Remove enum.patch,
depmod-Prevent-module-dependency-files-corruption-du.patch,
depmod-Prevent-module-dependency-files-missing-durin.patch,
depmod-shut-up-gcc-insufficinet-buffer-warning.patch
(accepted upstream)
-------------------------------------------------------------------
Fri Dec 7 14:55:21 UTC 2018 - Michal Suchanek <msuchanek@suse.de>
- Fix module dependency file corruption on parallel invocation (bsc#1118629).
- Add depmod-Prevent-module-dependency-files-corruption-du.patch
- Add depmod-Prevent-module-dependency-files-missing-durin.patch
- Add depmod-shut-up-gcc-insufficinet-buffer-warning.patch
-------------------------------------------------------------------
Wed Jul 18 08:51:06 UTC 2018 - jengelh@inai.de
- Remove enum padding constants, add enum.patch (boo#1097869).
-------------------------------------------------------------------
Fri Jun 8 21:37:14 UTC 2018 - vlad.botanic@gmail.com
- allow 'modprobe -c' print the status of "allow_unsupported_modules" option.
Add 0012-modprobe-print-unsupported-status.patch
-------------------------------------------------------------------
Fri Apr 6 10:43:42 UTC 2018 - msuchanek@suse.com
- Fix crash when PKCS#7 signer name is not present in signature (bsc#1088244)
Add libkmod-signature-pkcs-7-fix-crash-when-signer-info-.patch
-------------------------------------------------------------------
Fri Mar 16 13:08:14 CET 2018 - ro@suse.de
- for sle, buildexclude the 32bit platforms in kmod-testsuite,
they have no kernel binaries anyway (bnc#1085640)
-------------------------------------------------------------------
Thu Mar 8 16:34:16 UTC 2018 - msuchanek@suse.com
- Fix PKCS#7 signature display in modinfo (bsc#1077693).
* Add libkmod-signature-implement-pkcs7-parsing-with-asn1c.patch
* Add libkmod-signature-Fix-crash-when-module-signature-is.patch
* Refresh 0010-modprobe-Implement-allow-unsupported-modules.patch
-------------------------------------------------------------------
Thu Feb 1 13:49:25 UTC 2018 - msuchanek@suse.com
- Update to kmod v25
* Fix resolving symbols with MODULE_REL_CRCS (bsc#1077867)
- Drop depmod-Don-t-add-.TOC.-when-it-s-in-the-kernel.patch
-------------------------------------------------------------------
Thu Dec 7 12:56:32 UTC 2017 - msuchanek@suse.com
- Fix resolving .TOC. in modules on 4.4 and older kernel (bsc#1070209)
depmod-Don-t-add-.TOC.-when-it-s-in-the-kernel.patch
-------------------------------------------------------------------
Mon Nov 20 14:34:59 UTC 2017 - msuchanek@suse.com
- Move dependency on suse-module-tools to kmod-compat (bsc#1047911).
-------------------------------------------------------------------
Mon Aug 28 13:42:33 UTC 2017 - mmarek@suse.com
- Add missing coreutils dependency for initrd macros (bsc#1055492).
-------------------------------------------------------------------
Wed Jul 26 13:27:59 UTC 2017 - jengelh@inai.de
- Add versioned requires between kmod-compat -> kmod
-------------------------------------------------------------------
Thu Jul 6 08:07:50 UTC 2017 - jengelh@inai.de
- Update to new upstream release 24
* libkmod: fix use of strcpy
* depmod: fix string overflow
* depmod: ignore related modules in depmod_report_cycles
* libkmod: Fix handling of quotes in kernel command line
* libkmod-config: replace 0/1 with bool
* depmod: handle nested loops
- Drop 0001-use-correct-sort-method-in-test-array.patch,
0002-depmod-ignore-related-modules-in-depmod_report_cycle.patch,
0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
(applied upstream)
- Remove support for openSUSE < 13.2 (non-dracut mkinitrd)
- Separate bash completion functions into extra package
- Move some of the symlinks from kmod-compat to kmod,
as kmod still does not have native support for all functions.
-------------------------------------------------------------------
Tue Nov 22 09:10:54 UTC 2016 - yousaf.kaukab@suse.com
- 0002-depmod-ignore-related-modules-in-depmod_report_cycle.patch:
Fix buffer overflow when printing modules in cyclic dependency
chain (boo#1008186)
-------------------------------------------------------------------
Thu Jul 21 09:56:02 UTC 2016 - jengelh@inai.de
- Update to new upstream release 23
* Don't add comment to modules.devname if it would otherwise be
empty.
* Ignore .TOC. symbols in depmod parsing.
* Fix crash on modinfo while checking for available signature of
unknown type.
* Teach modinfo about PKCS#7 module signatures.
- Drop depmod-Ignore_PowerPC64_ABIv2_.TOC.symbol.patch (merged),
0001-libkmod-Handle-long-lines-in-proc-modules.patch (merged)
-------------------------------------------------------------------
Thu Jul 21 09:37:54 UTC 2016 - mmarek@suse.com
- Regenerate initrd on kmod update (bsc#989788)
- Sync specfile with openSUSE:Factory
-------------------------------------------------------------------
Fri Jun 17 15:18:29 UTC 2016 - mmarek@suse.cz
- libkmod: Handle long lines in /proc/modules (bsc#983754)
0001-libkmod-Handle-long-lines-in-proc-modules.patch
-------------------------------------------------------------------
Tue Feb 9 15:15:56 UTC 2016 - dvaleev@suse.com
- Fix kernel master build for ppc64le (bsc#1070209)
depmod-Ignore_PowerPC64_ABIv2_.TOC.symbol.patch
-------------------------------------------------------------------
Mon Dec 7 14:27:13 UTC 2015 - jengelh@inai.de
- Update to new upstream release 22
* support `insmod -f`
* depmod: do not fall back to uname on bad version
-------------------------------------------------------------------
Sat Nov 7 10:29:54 UTC 2015 - jengelh@inai.de
- Update to new upstream release 21
* The kmod tool now prints the relevant configuration options it was built
with when the "--version" argument is passed.
-------------------------------------------------------------------
Tue Apr 21 14:38:55 UTC 2015 - mmarek@suse.cz
- Update to kmod 20
* More robust ELF parsing
* To fix a race, modprobe only looks at modules.builtin to
determine a builtin module, so e.g. 'modprobe vt' will no longer
work.
* Other fixes
* Testsuite moved to a separate package, since it is now building
the test modules from sources, which requires the kernel package.
* dropped kmod-blacklist-fixtest.patch (merged upstream)
* includes 0001-Fix-race-while-loading-modules.patch (bsc#998906)
-------------------------------------------------------------------
Thu Apr 2 18:24:23 UTC 2015 - crrodriguez@opensuse.org
- If kmod packge changes, regenerate the initrd.
-------------------------------------------------------------------
Fri Mar 6 07:58:19 UTC 2015 - meissner@suse.com
- 0001-use-correct-sort-method-in-test-array.patch: use correct test
bsc#920930
-------------------------------------------------------------------
Sun Feb 22 10:41:40 UTC 2015 - meissner@suse.com
- kmod-blacklist-fixtest.patch: tag the test in test-blacklist correctly
-------------------------------------------------------------------
Sun Nov 16 20:54:36 UTC 2014 - jengelh@inai.de
- Move include files out of pkg/ into a normal subdir of includedir.
-------------------------------------------------------------------
Sun Nov 16 18:22:37 UTC 2014 - crrodriguez@opensuse.org
- Update to kmod 19
* Fix missing CLOEXEC in library
* Fix error message while opening kmod's index
* static-nodes: when writing in tmpfiles format, indicate that
creation of static nodes should only happen at boot. This is used
and required by systemd-217+.
-------------------------------------------------------------------
Sat Nov 8 00:16:55 UTC 2014 - crrodriguez@opensuse.org
- Build with full RELRO.
- Enable verbose build (build checks depend on that)
-------------------------------------------------------------------
Thu Sep 4 09:16:19 UTC 2014 - mmarek@suse.cz
- Do not filter unsupported modules when running a vanilla kernel
(bnc#871066). New patch:
0011-Do-not-filter-unsupported-modules-when-running-a-van.patch
-------------------------------------------------------------------
Tue Jun 24 13:15:37 UTC 2014 - jengelh@inai.de
- Update to new upstream release 18
* Calling depmod with modules creating a dependency loop will now
make depmod return an error and not update the indexes. This is
to protect the current index not being overridden by another
index that may cause a boot failure, depending on the buggy module.
- Remove last vestiges of gpg-offline
- Remove 0001-depmod-Make-dependency-loops-be-fatal.patch
(applied upstream)
-------------------------------------------------------------------
Fri May 16 11:00:43 UTC 2014 - matwey.kornilov@gmail.com
- Remove 0001-Fix-recursion-loop-in-mod_count_all_dependencies-whe.patch
- Add 0001-depmod-Make-dependency-loops-be-fatal.patch (upstream fix for bnc#872715)
-------------------------------------------------------------------
Sat Apr 12 12:33:16 UTC 2014 - matwey.kornilov@gmail.com
- Add 0001-Fix-recursion-loop-in-mod_count_all_dependencies-whe.patch
* Fix segfault at cycled deps (bnc#872715)
-------------------------------------------------------------------
Fri Apr 11 07:27:16 UTC 2014 - mmarek@suse.cz
- testsutie: Uncompress most modules (updated test-files.tar.xz)
- testsuite: Do not run tests with *.ko.gz if zlib is not enabled
- Disable compression support, as other tools do not support it
(e.g. module signing)
-------------------------------------------------------------------
Tue Apr 8 08:36:22 UTC 2014 - mmarek@suse.cz
- Remove the now obsolete test-files.tar.xz tarball
-------------------------------------------------------------------
Mon Apr 7 19:07:17 UTC 2014 - mmarek@suse.com
- Updated to kmod 17
* Do not require xsltproc for build
* Parse softdeps stored in kernel modules
* Add experimental python bindings (not enabled in the package yet)
* Misc bugfixes
- Deleted patches that went upstream. Only the unsupported modules
feature remains:
0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch
0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch
0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
0010-modprobe-Implement-allow-unsupported-modules.patch
-------------------------------------------------------------------
Tue Apr 1 13:01:28 UTC 2014 - mmarek@suse.cz
- libkmod: Ignore errors from softdeps (bnc#831227)
- config: also parse softdeps from modules (bnc#831227)
-------------------------------------------------------------------
Mon Mar 31 16:14:58 UTC 2014 - mmarek@suse.cz
- libkmod-config,depmod: Accept special files as configuration
files, too
- libkmod-config: Only match dot before '=' in /proc/cmdline
-------------------------------------------------------------------
Tue Mar 11 13:38:23 UTC 2014 - mmarek@suse.cz
- Provide and obsolete module-init-tools (bnc#867442)
-------------------------------------------------------------------
Fri Mar 7 09:25:02 UTC 2014 - mmarek@suse.cz
- testsuite: Fix uname() during glibc startup
-------------------------------------------------------------------
Wed Mar 5 14:50:34 UTC 2014 - mmarek@suse.cz
- testsuite: Check the list of loaded modules after a test
- testsuite: Add test for modprobe --force
- testsuite: Do not provide finit_module(2) on older kernels
- Add some tests for kernels without finit_module(2)
- libkmod-module: Simplify kmod_module_insert_module()
- libkmod: Implement filtering of unsupported modules (fate#316971)
- modprobe: Implement --allow-unsupported-modules (fate#316971)
- make the %check section fatal
-------------------------------------------------------------------
Wed Feb 26 13:23:41 UTC 2014 - mmarek@suse.cz
- Remove "rmmod -w" documentation and getopt entry
- modprobe: Recognize --allow-unsupported-modules on commandline
(fate#316971)
- libkmod-config: Recognize allow_unsupported_modules in the
configuration (fate#316971)
-------------------------------------------------------------------
Wed Feb 26 13:09:21 UTC 2014 - mmarek@suse.cz
- Drop the non-upstream kmod-no-static.diff; the size difference is
negligible.
-------------------------------------------------------------------
Tue Jan 7 11:59:38 UTC 2014 - jengelh@inai.de
- Update to new upstream release 16
* The option to wait on module removal has been removed from the
kernel, and now from rmmod. The constant KMOD_REMOVE_NOWAIT in
libkmod is still there for backwards compatibility but it is
always enforced, passing O_NONBLOCK to delete_module(2).
-------------------------------------------------------------------
Mon Sep 2 21:36:22 UTC 2013 - jengelh@inai.de
- Update to new upstream release 15
* kmod static-nodes no longer fails if modules.devname does not exist
* Fix getting boolean parameter from kernel cmdline in case the
value is omitted
* kmod static-nodes creates parent directories if given a -o option
- Add kmod-no-static.diff
-------------------------------------------------------------------
Wed Jul 3 22:18:38 UTC 2013 - jengelh@inai.de
- Update to new upstream release 14
* Some bug fixes and a new "static-nodes" command to parse
modules.devname.
-------------------------------------------------------------------
Mon Apr 15 22:27:55 UTC 2013 - crrodriguez@opensuse.org
- Update to new upstream release 13
* depmod: --symbol-prefix actually requires an argument
* depmod: fix builtin symbols resolution when the prefix symbol is set
* libkmod: Use secure_getenv if available
* rmmod: Teach rmmod about builtin modules
* libkmod: add finit_module logic
* modprobe: Fix assertion on --show-depends with bogus config file
* Many other bugfixes see https://lwn.net/Articles/546711
-------------------------------------------------------------------
Thu Dec 6 11:53:05 UTC 2012 - jengelh@inai.de
- Update to new upstream release 12
* Fix removing vermagic from module when told to force load a module
* Fix removing __versions section when told to force load a
module: we need to mangle the section header, not the section.
* modinfo no longer fails while loading a module from file when
path contains ".ko" substring
-------------------------------------------------------------------
Fri Nov 23 17:18:03 UTC 2012 - jengelh@inai.de
- Require suse-module-tools now that it is present in Base:System
- kmod-compat depends on kmod, add that missing Requires.
-------------------------------------------------------------------
Sat Nov 10 15:07:54 UTC 2012 - hrvoje.senjan@gmail.com
- Update to kmod-11
* Fix testsuite defining symbols twice on 32 bit systems
* Allow to check generated files against correct ones
* libkmod now keeps a file opened after the first call to
* kmod_module_get_{info,versions,symbols,dependency_symbols}. This
reduces signficantly the amount of time depmod tool takes to
execute. Particularly if compressed modules are used.
* Remove --with-rootprefix from build system. It was not a great
idea after all and should not be use since it causes more harm
than benefits.
* Hide --wait option on rmmod. This feature is being targeted for
removal from kernel. rmmod still accepts this option, but it is
hidden now: man page and usage() says nothing about it and if
it is used, user will get a 10s sleep. This way we can check and
help if anyone is using this feature.
* Refactor message logging on all tools, giving proper prefix,
routing everything to syslog when asked for, etc.
* Fix parsing of modules.order when using compressed modules
* Usage messages go to stdout instead of stderr
* Fix memory leak in hash implementation
-------------------------------------------------------------------
Thu Sep 13 23:19:10 UTC 2012 - jengelh@inai.de
- Provide the "modutils" virtual symbol
- Update to new upstream release 10
* Read coresize from /sys if supported
* Add flag to kmod_module_probe_insert() to apply blacklisting
during probe only if mod is an alias. Now modprobe uses this
flag by default.
-------------------------------------------------------------------
Wed Jun 20 08:41:03 UTC 2012 - rmilasan@suse.com
- Update to new upstream release 9
* build-sys: allow compressed modules in testsuite
* build-sys: Make dirs writable on rootfs creation
* depmod: use ferror and fclose to check for error
* depmod: return error when index is truncated due to ENOSPC
* depmod: fix coding-style issue in array declaration
* depmod: fail if any index could not be created
* depmod: don't return error if modules.builtin don't exist
* libkmod-util: split function for usec conversion
* libkmod-util: add missing stdbool.h include
- Fix broken testsuites on 32bit systems.
add: fix-32bits.diff
-------------------------------------------------------------------
Sat Apr 21 01:55:30 UTC 2012 - jengelh@medozas.de
- Restore patch descriptions
(and use `quilt setup` for rediff in future)
-------------------------------------------------------------------
Thu Apr 19 14:56:55 UTC 2012 - rmilasan@suse.com
- Update to new upstream release 8
* doc: remove links to NULL going nowhere.
* modprobe: handle -ENOENT return from init_module.
* doc: silent man page generation and fix gtk-doc warnings.
* modprobe: fix typo in config dump: option->options.
-------------------------------------------------------------------
Wed Apr 18 10:58:03 UTC 2012 - rmilasan@suse.com
- Update to new upstream release 7
* build-sys: don't set CFLAGS and LDFLAGS.
* build-sys: re-organize configure.ac.
* configure.ac: Move link only flags out of CFLAGS and into LDFLAGS.
* Add CC_CHECK_LDFLAGS_APPEND m4 macro.
* config: use order /etc, /run, /lib.
* modprobe: set log prio to 0 if user passed -q arg.
* modprobe: always try to remove all modules in command line.
* modprobe: don't check if module builtin to decide if it's builtin.
* modprobe: fix error path in removing modules.
-------------------------------------------------------------------
Sat Mar 10 17:44:05 UTC 2012 - rschweikert@suse.com
- place binary in /usr tree (UsrMerge project)
-------------------------------------------------------------------
Sat Mar 3 20:50:43 UTC 2012 - jengelh@medozas.de
- Update to new upstream release 6
* New API: kmod_module_apply_filter, a function to apply filters
in a list of modules
* Lookup modules.builtin.bin to decide if a module is built into
the kernel
* Resolve infinite loops with softdeps and user configs with
install commands
-------------------------------------------------------------------
Tue Feb 7 00:56:51 UTC 2012 - jengelh@medozas.de
- Update to new upstream release 5
* modprobe no longer works with paths: it only accepts module names
and/or aliases now. More code is now shared by libkmod and
modprobe.
-------------------------------------------------------------------
Fri Jan 20 18:13:50 UTC 2012 - jengelh@medozas.de
- Update to new upstream release 4
* new APIs in libkmod: blacklists, install/remove commands,
aliases, options, softdeps and dumping indexes
-------------------------------------------------------------------
Fri Jan 6 00:48:41 UTC 2012 - jengelh@medozas.de
- Update to new upstream release 3
* new APIs in libkmod: get symbols from module, parsing the ELF
section, dependency symbols, insert module like modprobe
* support for Xz-compressed modules
* the depmod tool
-------------------------------------------------------------------
Sat Dec 24 17:23:09 UTC 2011 - crrodriguez@opensuse.org
- Use --enable-zlib and buildRequire zlib
- run make check
-------------------------------------------------------------------
Sun Dec 18 20:16:11 UTC 2011 - jengelh@medozas.de
- Initial package for build.opensuse.org

BIN
kmod.keyring Normal file

Binary file not shown.

212
kmod.spec Normal file
View File

@ -0,0 +1,212 @@
#
# spec file for package kmod
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150200
%define use_zstd 1
%endif
Name: kmod
%define lname libkmod2
Version: 30
Release: 0
Summary: Utilities to load modules into the kernel
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Kernel
URL: https://www.kernel.org/pub/linux/utils/kernel/kmod/
#Git-Web: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary
#Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod
Source: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.xz
Source2: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.sign
Source3: %name.keyring
Source4: README.usrmerge
Patch1: 0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch
Patch2: 0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch
Patch3: 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch
Patch4: 0010-modprobe-Implement-allow-unsupported-modules.patch
Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch
Patch6: 0012-modprobe-print-unsupported-status.patch
Patch7: 0001-testsuite-repair-read-of-uninitialized-memory.patch
Patch8: man-depmod.d-Fix-incorrect-usr-lib-search-path.patch
Patch9: usr-lib-modprobe.patch
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-pkgconfig-file-with-kmod-compile-time-confi.patch
Patch15: usr-lib-modules.patch
Patch16: no-stylesheet-download.patch
Patch17: configure-Detect-openssl-sm3-support.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: docbook-xsl-stylesheets
BuildRequires: libopenssl-devel >= 1.1.0
BuildRequires: libtool
BuildRequires: libxslt-tools
BuildRequires: pkgconfig >= 0.21
BuildRequires: xz
BuildRequires: pkgconfig(liblzma) >= 4.99
%if 0%{?use_zstd}
BuildRequires: pkgconfig(libzstd)
Provides: kmod-zstd
%endif
BuildRequires: pkgconfig(zlib)
Requires(post): coreutils
Obsoletes: kmod-compat < %version-%release
Provides: kmod-compat = %version-%release
# kmod and libkmod have no dependency but we want to provide
# same features across kmod provided tools and tools linking to libkmod
Conflicts: %lname < %version-%release
Conflicts: %lname > %version-%release
Requires: suse-module-tools
Obsoletes: module-init-tools < 3.16
Provides: module-init-tools = 3.16
Provides: modutils
%description
kmod is a set of tools to handle common tasks with Linux kernel
modules like insert, remove, list, check properties, resolve
dependencies and aliases.
These tools are designed on top of libkmod, a library that is shipped
with kmod. The aim is to be compatible with tools, configurations and
indexes from module-init-tools project.
%package bash-completion
Summary: Bash completion routines for the kmod utilities
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Shells
BuildArch: noarch
Requires: %{name}
Requires: bash-completion
Supplements: (%{name} and bash-completion)
%description bash-completion
Contains bash completion support for kmod utilities.
%package -n %lname
Summary: Library to interact with Linux kernel modules
License: LGPL-2.1-or-later
Group: System/Libraries
%description -n %lname
libkmod was created to allow programs to easily insert, remove and
list modules, also checking its properties, dependencies and aliases.
%package -n libkmod-devel
Summary: Development files for libkmod
License: LGPL-2.1-or-later
Group: Development/Libraries/C and C++
Requires: %lname = %version
%description -n libkmod-devel
libkmod was created to allow programs to easily insert, remove and
list modules, also checking its properties, dependencies and aliases.
This package contains the development headers for the library found
in %lname.
%prep
%autosetup -p1
cp %{SOURCE4} .
%build
GTKDOCIZE=/bin/true autoreconf -fi
export LDFLAGS="-Wl,-z,relro,-z,now"
# The extra --includedir gives us the possibility to detect dependent
# packages which fail to properly use pkgconfig, cf. bugzilla.opensuse.org/795968
%configure \
--with-xz \
--with-zlib \
--with-openssl \
%if 0%{?use_zstd}
--with-zstd \
%endif
--includedir="%_includedir/kmod" \
--with-rootlibdir="%_libdir" \
%if 0%{?suse_version} > 1500
--with-module-directory="%_prefix/lib/modules" \
%endif
--bindir="%_bindir"
%make_build
%install
b="%buildroot"
%make_install
rm -f "$b/%_libdir"/*.la
mkdir -p "$b/%_sbindir" "$b/sbin"
for i in depmod insmod lsmod modinfo modprobe rmmod; do
ln -s "%_bindir/kmod" "$b/%_sbindir/$i"
%if 0%{?suse_version} < 1550
ln -s "%_bindir/kmod" "$b/sbin/$i"
%endif
done
mkdir -p "$b/%_bindir" "$b/bin"
for i in lsmod; do
ln -s "%_bindir/kmod" "$b/%_bindir/$i"
%if 0%{?suse_version} < 1550
ln -s "%_bindir/kmod" "$b/bin/$i"
%endif
done
%post
%{?regenerate_initrd_post}
%posttrans
%{?regenerate_initrd_posttrans}
%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig
%files
%if 0%{?suse_version} > 1500
%doc README.usrmerge
%endif
%_bindir/kmod
%_bindir/lsmod
%_sbindir/depmod
%_sbindir/insmod
%_sbindir/lsmod
%_sbindir/modinfo
%_sbindir/modprobe
%_sbindir/rmmod
%_mandir/man[58]/*.[58]*
%_libdir/pkgconfig/kmod.pc
%if 0%{?suse_version} < 1550
/bin/lsmod
/sbin/depmod
/sbin/insmod
/sbin/lsmod
/sbin/modinfo
/sbin/modprobe
/sbin/rmmod
%endif
%files bash-completion
%_datadir/bash-completion/
%files -n %lname
%_libdir/libkmod.so.2*
%files -n libkmod-devel
%_includedir/*
%_libdir/pkgconfig/libkmod.pc
%_libdir/libkmod.so
%changelog

View File

@ -0,0 +1,31 @@
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/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
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(-)
diff --git a/man/depmod.d.xml b/man/depmod.d.xml
index 76548e92a312..8d3d821cddc8 100644
--- a/man/depmod.d.xml
+++ b/man/depmod.d.xml
@@ -39,7 +39,7 @@
</refnamediv>
<refsynopsisdiv>
- <para><filename>/usr/lib/depmod.d/*.conf</filename></para>
+ <para><filename>/lib/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>
--
2.41.0

View File

@ -0,0 +1,24 @@
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 5/7] Do not download the docbook stylesheet during build, use
local copy instead.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
man/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/Makefile.am b/man/Makefile.am
index f550091a216a..a8ddb8bfd0ed 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -28,4 +28,4 @@ CLEANFILES = $(dist_man_MANS)
--nonet \
--stringparam man.output.quietly 1 \
--param funcsynopsis.style "'ansi'" \
- http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl -
+ /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl -
--
2.41.0

View File

@ -0,0 +1,178 @@
From 94fe372a5f6163f5bc8b620e6068ea2f1d99f858 Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.de.marchi@gmail.com>
Date: Thu, 9 Feb 2023 11:19:46 -0800
Subject: [PATCH 6/9] testsuite: Handle different sysconfdir
Instead of skipping tests if sysconfdir isn't /etc, just handle it
during the rootfs setup logic.
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
---
Makefile.am | 6 +-----
configure.ac | 3 ---
testsuite/setup-rootfs.sh | 8 ++++++++
testsuite/test-blacklist.c | 3 ---
testsuite/test-depmod.c | 15 ---------------
testsuite/test-modprobe.c | 6 ------
6 files changed, 9 insertions(+), 32 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 32f4b80e9870..246d4f5b138f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -245,7 +245,7 @@ EXTRA_DIST += testsuite/setup-rootfs.sh
MODULE_PLAYGROUND = testsuite/module-playground
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
+CREATE_ROOTFS = $(AM_V_GEN) $(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 \
@@ -330,10 +330,6 @@ TESTSUITE_LDADD = \
testsuite/libtestsuite.la libkmod/libkmod-internal.la \
shared/libshared.la
-if KMOD_SYSCONFDIR_NOT_ETC
-TESTSUITE_CPPFLAGS += -DKMOD_SYSCONFDIR_NOT_ETC
-endif
-
check_LTLIBRARIES += testsuite/libtestsuite.la
testsuite_libtestsuite_la_SOURCES = \
testsuite/testsuite.c testsuite/testsuite.h
diff --git a/configure.ac b/configure.ac
index 6989e9360da2..a74d3baf0a42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -224,9 +224,6 @@ GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
], [
AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
-# Some tests are skipped when sysconfdir != /etc.
-AM_CONDITIONAL([KMOD_SYSCONFDIR_NOT_ETC], [test "x$sysconfdir" != "x/etc"])
-
#####################################################################
# Default CFLAGS and LDFLAGS
#####################################################################
diff --git a/testsuite/setup-rootfs.sh b/testsuite/setup-rootfs.sh
index 3e814d22d813..8b13a40f2cae 100755
--- a/testsuite/setup-rootfs.sh
+++ b/testsuite/setup-rootfs.sh
@@ -6,6 +6,7 @@ ROOTFS_PRISTINE=$1
ROOTFS=$2
MODULE_PLAYGROUND=$3
CONFIG_H=$4
+SYSCONFDIR=$5
# create rootfs from rootfs-pristine
@@ -15,6 +16,13 @@ create_rootfs() {
cp -r "$ROOTFS_PRISTINE" "$ROOTFS"
find "$ROOTFS" -type d -exec chmod +w {} \;
find "$ROOTFS" -type f -name .gitignore -exec rm -f {} \;
+
+ if [ "$SYSCONFDIR" != "/etc" ]; then
+ find "$ROOTFS" -type d -name etc -printf "%h\n" | while read -r e; do
+ mkdir -p "$(dirname $e/$SYSCONFDIR)"
+ mv $e/{etc,$SYSCONFDIR}
+ done
+ fi
}
feature_enabled() {
diff --git a/testsuite/test-blacklist.c b/testsuite/test-blacklist.c
index d03eedb60106..969567ddc817 100644
--- a/testsuite/test-blacklist.c
+++ b/testsuite/test-blacklist.c
@@ -95,9 +95,6 @@ fail_lookup:
}
DEFINE_TEST(blacklist_1,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
- .skip = true,
-#endif
.description = "check if modules are correctly blacklisted",
.config = {
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-blacklist/",
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index 6e3ae562d766..42878cb4eb22 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -41,9 +41,6 @@ static noreturn int depmod_modules_order_for_compressed(const struct test *t)
}
DEFINE_TEST(depmod_modules_order_for_compressed,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
- .skip = true,
-#endif
.description = "check if depmod let aliases in right order when using compressed modules",
.config = {
[TC_UNAME_R] = MODULES_ORDER_UNAME,
@@ -75,9 +72,6 @@ static noreturn int depmod_modules_outdir(const struct test *t)
}
DEFINE_TEST(depmod_modules_outdir,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
- .skip = true,
-#endif
.description = "check if depmod honours the outdir option",
.config = {
[TC_UNAME_R] = MODULES_OUTDIR_UNAME,
@@ -158,9 +152,6 @@ static noreturn int depmod_detect_loop(const struct test *t)
exit(EXIT_FAILURE);
}
DEFINE_TEST(depmod_detect_loop,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
- .skip = true,
-#endif
.description = "check if depmod detects module loops correctly",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -184,9 +175,6 @@ static noreturn int depmod_search_order_external_first(const struct test *t)
exit(EXIT_FAILURE);
}
DEFINE_TEST(depmod_search_order_external_first,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
- .skip = true,
-#endif
.description = "check if depmod honor external keyword with higher priority",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -239,9 +227,6 @@ static noreturn int depmod_search_order_override(const struct test *t)
exit(EXIT_FAILURE);
}
DEFINE_TEST(depmod_search_order_override,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
- .skip = true,
-#endif
.description = "check if depmod honor override keyword",
.config = {
[TC_UNAME_R] = "4.4.4",
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index 0255f1aaccb5..bbdf11443d47 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -83,9 +83,6 @@ static noreturn int modprobe_show_alias_to_none(const struct test *t)
exit(EXIT_FAILURE);
}
DEFINE_TEST(modprobe_show_alias_to_none,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
- .skip = true,
-#endif
.description = "check if modprobe --show-depends doesn't explode with an alias to nothing",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -175,9 +172,6 @@ static noreturn int modprobe_softdep_loop(const struct test *t)
exit(EXIT_FAILURE);
}
DEFINE_TEST(modprobe_softdep_loop,
-#if defined(KMOD_SYSCONFDIR_NOT_ETC)
- .skip = true,
-#endif
.description = "check if modprobe breaks softdep loop",
.config = {
[TC_UNAME_R] = "4.4.4",
--
2.41.0

View File

@ -0,0 +1,91 @@
From 00c15bc0710c399749421335c2c9372c9afee080 Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.de.marchi@gmail.com>
Date: Thu, 9 Feb 2023 11:19:45 -0800
Subject: [PATCH 4/9] testsuite: Move setup-rootfs logic from Makefile to
script
It's easier to implement the logic outside of the Makefile, so rename
the populate-modules.sh script to setup-rootfs.sh and move the
additional logic from the makefile to the script.
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
---
Makefile.am | 10 ++--------
.../{populate-modules.sh => setup-rootfs.sh} | 19 +++++++++++++++++--
2 files changed, 19 insertions(+), 10 deletions(-)
rename testsuite/{populate-modules.sh => setup-rootfs.sh} (94%)
diff --git a/Makefile.am b/Makefile.am
index e7313fa8a33e..32f4b80e9870 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -240,18 +240,12 @@ endif
# TESTSUITE
# ------------------------------------------------------------------------------
-EXTRA_DIST += testsuite/populate-modules.sh
+EXTRA_DIST += testsuite/setup-rootfs.sh
MODULE_PLAYGROUND = testsuite/module-playground
ROOTFS = testsuite/rootfs
ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
-CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && mkdir -p $(dir $(ROOTFS)) && \
- cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \
- find $(ROOTFS) -type d -exec chmod +w {} \; && \
- find $(ROOTFS) -type f -name .gitignore -exec rm -f {} \; && \
- $(top_srcdir)/testsuite/populate-modules.sh \
- $(MODULE_PLAYGROUND) $(ROOTFS) $(top_builddir)/config.h ) && \
- touch testsuite/stamp-rootfs
+CREATE_ROOTFS = $(AM_V_GEN) $(top_srcdir)/testsuite/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h
build-module-playground:
$(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
diff --git a/testsuite/populate-modules.sh b/testsuite/setup-rootfs.sh
similarity index 94%
rename from testsuite/populate-modules.sh
rename to testsuite/setup-rootfs.sh
index 099f02669156..d9cc627f7224 100755
--- a/testsuite/populate-modules.sh
+++ b/testsuite/setup-rootfs.sh
@@ -2,9 +2,20 @@
set -e
-MODULE_PLAYGROUND=$1
+ROOTFS_PRISTINE=$1
ROOTFS=$2
-CONFIG_H=$3
+MODULE_PLAYGROUND=$3
+CONFIG_H=$4
+
+# create rootfs from rootfs-pristine
+
+create_rootfs() {
+ rm -rf "$ROOTFS"
+ mkdir -p $(dirname "$ROOTFS")
+ cp -r "$ROOTFS_PRISTINE" "$ROOTFS"
+ find "$ROOTFS" -type d -exec chmod +w {} \;
+ find "$ROOTFS" -type f -name .gitignore -exec rm -f {} \;
+}
feature_enabled() {
local feature=$1
@@ -94,6 +105,8 @@ attach_pkcs7_array=(
"test-modinfo/mod-simple-pkcs7.ko"
)
+create_rootfs
+
for k in "${!map[@]}"; do
dst=${ROOTFS}/$k
src=${MODULE_PLAYGROUND}/${map[$k]}
@@ -138,3 +151,5 @@ done
for m in "${attach_pkcs7_array[@]}"; do
cat "${MODULE_PLAYGROUND}/dummy.pkcs7" >>"${ROOTFS}/$m"
done
+
+touch testsuite/stamp-rootfs
--
2.41.0

View File

@ -0,0 +1,193 @@
From 892c2c451397a4f424196bc57e2536651b0549c3 Mon Sep 17 00:00:00 2001
From: Emil Velikov <emil.velikov@collabora.com>
Date: Mon, 6 Feb 2023 14:04:49 +0000
Subject: [PATCH 7/9] testsuite/depmod: use defines for the rootfs/lib_modules
The uname used across the tests is same, so drop "_ORDER" from the macro
name and use it throughout. Similarly - add respective LIB_MODULES
defines and use them in the tests.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
---
testsuite/test-depmod.c | 50 ++++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index 42878cb4eb22..93606947f18a 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -25,9 +25,9 @@
#include "testsuite.h"
-#define MODULES_ORDER_UNAME "4.4.4"
+#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_ORDER_UNAME
+#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_UNAME
static noreturn int depmod_modules_order_for_compressed(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -43,7 +43,7 @@ static noreturn int depmod_modules_order_for_compressed(const struct test *t)
DEFINE_TEST(depmod_modules_order_for_compressed,
.description = "check if depmod let aliases in right order when using compressed modules",
.config = {
- [TC_UNAME_R] = MODULES_ORDER_UNAME,
+ [TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = MODULES_ORDER_ROOTFS,
},
.output = {
@@ -54,10 +54,9 @@ DEFINE_TEST(depmod_modules_order_for_compressed,
},
});
-#define MODULES_OUTDIR_UNAME "4.4.4"
#define MODULES_OUTDIR_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-outdir"
-#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir/lib/modules/" MODULES_OUTDIR_UNAME
-#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS "/lib/modules/" MODULES_OUTDIR_UNAME
+#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
static noreturn int depmod_modules_outdir(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -74,7 +73,7 @@ static noreturn int depmod_modules_outdir(const struct test *t)
DEFINE_TEST(depmod_modules_outdir,
.description = "check if depmod honours the outdir option",
.config = {
- [TC_UNAME_R] = MODULES_OUTDIR_UNAME,
+ [TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = MODULES_OUTDIR_ROOTFS,
},
.output = {
@@ -88,6 +87,7 @@ DEFINE_TEST(depmod_modules_outdir,
});
#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
static noreturn int depmod_search_order_simple(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -102,18 +102,19 @@ static noreturn int depmod_search_order_simple(const struct test *t)
DEFINE_TEST(depmod_search_order_simple,
.description = "check if depmod honor search order in config",
.config = {
- [TC_UNAME_R] = "4.4.4",
+ [TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = SEARCH_ORDER_SIMPLE_ROOTFS,
},
.output = {
.files = (const struct keyval[]) {
- { SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
- SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+ { SEARCH_ORDER_SIMPLE_LIB_MODULES "/correct-modules.dep",
+ SEARCH_ORDER_SIMPLE_LIB_MODULES "/modules.dep" },
{ }
},
});
#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
static noreturn int depmod_search_order_same_prefix(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -128,13 +129,13 @@ static noreturn int depmod_search_order_same_prefix(const struct test *t)
DEFINE_TEST(depmod_search_order_same_prefix,
.description = "check if depmod honor search order in config with same prefix",
.config = {
- [TC_UNAME_R] = "4.4.4",
+ [TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = SEARCH_ORDER_SAME_PREFIX_ROOTFS,
},
.output = {
.files = (const struct keyval[]) {
- { SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
- SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+ { SEARCH_ORDER_SAME_PREFIX_LIB_MODULES "/correct-modules.dep",
+ SEARCH_ORDER_SAME_PREFIX_LIB_MODULES "/modules.dep" },
{ }
},
});
@@ -154,7 +155,7 @@ static noreturn int depmod_detect_loop(const struct test *t)
DEFINE_TEST(depmod_detect_loop,
.description = "check if depmod detects module loops correctly",
.config = {
- [TC_UNAME_R] = "4.4.4",
+ [TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = DETECT_LOOP_ROOTFS,
},
.expected_fail = true,
@@ -163,6 +164,7 @@ DEFINE_TEST(depmod_detect_loop,
});
#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
static noreturn int depmod_search_order_external_first(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -177,18 +179,19 @@ static noreturn int depmod_search_order_external_first(const struct test *t)
DEFINE_TEST(depmod_search_order_external_first,
.description = "check if depmod honor external keyword with higher priority",
.config = {
- [TC_UNAME_R] = "4.4.4",
+ [TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS,
},
.output = {
.files = (const struct keyval[]) {
- { SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
- SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+ { SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES "/correct-modules.dep",
+ SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES "/modules.dep" },
{ }
},
});
#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
static noreturn int depmod_search_order_external_last(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -203,18 +206,19 @@ static noreturn int depmod_search_order_external_last(const struct test *t)
DEFINE_TEST(depmod_search_order_external_last,
.description = "check if depmod honor external keyword with lower priority",
.config = {
- [TC_UNAME_R] = "4.4.4",
+ [TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = SEARCH_ORDER_EXTERNAL_LAST_ROOTFS,
},
.output = {
.files = (const struct keyval[]) {
- { SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
- SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+ { SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES "/correct-modules.dep",
+ SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES "/modules.dep" },
{ }
},
});
#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
static noreturn int depmod_search_order_override(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -229,13 +233,13 @@ static noreturn int depmod_search_order_override(const struct test *t)
DEFINE_TEST(depmod_search_order_override,
.description = "check if depmod honor override keyword",
.config = {
- [TC_UNAME_R] = "4.4.4",
+ [TC_UNAME_R] = MODULES_UNAME,
[TC_ROOTFS] = SEARCH_ORDER_OVERRIDE_ROOTFS,
},
.output = {
.files = (const struct keyval[]) {
- { SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
- SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+ { SEARCH_ORDER_OVERRIDE_LIB_MODULES "/correct-modules.dep",
+ SEARCH_ORDER_OVERRIDE_LIB_MODULES "/modules.dep" },
{ }
},
});
--
2.41.0

152
usr-lib-modprobe.patch Normal file
View File

@ -0,0 +1,152 @@
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/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.
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 search directories.
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 +
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 +
7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/Makefile.am b/Makefile.am
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)"\" \
+ -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..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",
+ DISTCONFDIR "/modprobe.d",
"/lib/modprobe.d",
NULL
};
@@ -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
- * 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..2fea8e46bf2f 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -17,9 +17,14 @@ EXTRA_DIST = $(MAN5:%.5=%.xml) $(MAN8:%.8=%.xml)
CLEANFILES = $(dist_man_MANS)
%.5 %.8: %.xml
- $(AM_V_XSLT)$(XSLT) \
+ $(AM_V_XSLT)if [ '$(distconfdir)' != '/lib' ] ; then \
+ sed -e 's|@DISTCONFDIR@|$(distconfdir)|g' $< ; \
+ else \
+ sed -e '/@DISTCONFDIR@/d' $< ; \
+ fi | \
+ $(XSLT) \
-o $@ \
--nonet \
--stringparam man.output.quietly 1 \
--param funcsynopsis.style "'ansi'" \
- 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..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>@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..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>@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 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",
+ DISTCONFDIR "/depmod.d",
"/lib/depmod.d",
NULL
};
--
2.41.0

596
usr-lib-modules.patch Normal file
View File

@ -0,0 +1,596 @@
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 4/7] libkmod, depmod, modprobe: Make directory for kernel
modules configurable
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
move kernel modules to /usr while others can keep them in /lib.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
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(-)
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)"\" \
-DDISTCONFDIR=\""$(distconfdir)"\" \
+ -DMODULE_DIRECTORY=\""$(module_directory)"\" \
${zlib_CFLAGS}
AM_CFLAGS = $(OUR_CFLAGS)
@@ -247,7 +248,7 @@ EXTRA_DIST += testsuite/setup-rootfs.sh
MODULE_PLAYGROUND = testsuite/module-playground
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_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 \
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/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])
@@ -316,6 +322,7 @@ AC_MSG_RESULT([
$PACKAGE $VERSION
=======
+ module_directory: ${module_directory}
prefix: ${prefix}
sysconfdir: ${sysconfdir}
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_DIRECTORY;
static char *get_kernel_release(const char *dirname)
{
@@ -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
- * defaults to /lib/modules/`uname -r`. If it's relative,
+ * defaults to ${module_prefix}/lib/modules/`uname -r`. If it's relative,
* 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
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 '/@DISTCONFDIR@/d' $< ; \
fi | \
+ sed -e 's|@MODULE_DIRECTORY@|$(module_directory)|g' | \
$(XSLT) \
-o $@ \
--nonet \
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_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
@@ -101,7 +101,7 @@
<command>depmod</command> command. It is possible to
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_DIRECTORY@ (or other
module location) where the target module is installed.
</para>
<para>
@@ -110,7 +110,7 @@
specifying the following command: "override kmod * extra".
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_DIRECTORY@ (or other module location) will take priority
over any likenamed module already provided by the kernel.
</para>
</listitem>
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_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
@@ -141,7 +141,7 @@
<listitem>
<para>
If your modules are not currently in the (normal) directory
- <filename>/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
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_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.
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_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
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_DIRECTORY@/modules.dep</filename></para>
+ <para><filename>@MODULE_DIRECTORY@/modules.dep.bin</filename></para>
</refsynopsisdiv>
<refsect1><title>DESCRIPTION</title>
@@ -43,7 +43,7 @@
<filename>modules.dep.bin</filename> is a binary file generated by
<command>depmod</command> listing the dependencies for
every module in the directories under
- <filename>/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>
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
# normal makefile
-KDIR ?= /lib/modules/`uname -r`/build
+KDIR ?= $(module_prefix)/lib/modules/`uname -r`/build
KVER ?= `uname -r`
ifeq ($(FAKE_BUILD),)
FAKE_BUILD=0
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 [ "$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 != 'external' ] || continue
+ mod="$(dirname $i)"
+ lib="$(dirname $mod)"
+ up="$(dirname $lib)$MODULE_DIRECTORY"
+ mkdir -p "$up"
+ mv "$i" "$up"
+ done
+ fi
if [ "$SYSCONFDIR" != "/etc" ]; then
find "$ROOTFS" -type d -name etc -printf "%h\n" | while read -r e; do
@@ -32,55 +45,55 @@ feature_enabled() {
declare -A map
map=(
- ["test-depmod/search-order-simple/lib/modules/4.4.4/kernel/crypto/"]="mod-simple.ko"
- ["test-depmod/search-order-simple/lib/modules/4.4.4/updates/"]="mod-simple.ko"
- ["test-depmod/search-order-same-prefix/lib/modules/4.4.4/foo/"]="mod-simple.ko"
- ["test-depmod/search-order-same-prefix/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-c.ko"]="mod-loop-c.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-d.ko"]="mod-loop-d.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-e.ko"]="mod-loop-e.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-f.ko"]="mod-loop-f.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-g.ko"]="mod-loop-g.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-h.ko"]="mod-loop-h.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-i.ko"]="mod-loop-i.ko"
- ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-j.ko"]="mod-loop-j.ko"
- ["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_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_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"
- ["test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/foo/"]="mod-foo-b.ko"
- ["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_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_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"
- ["test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
- ["test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
- ["test-modprobe/force/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
- ["test-modprobe/oldkernel/lib/modules/3.3.3/kernel/"]="mod-simple.ko"
- ["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_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"
- ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
- ["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_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"
@@ -88,20 +101,20 @@ map=(
["test-modinfo/mod-simple-sha256.ko"]="mod-simple.ko"
["test-modinfo/mod-simple-pkcs7.ko"]="mod-simple.ko"
["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_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_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_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_DIRECTORY/4.4.4/kernel/drivers/scsi/hpsa.ko"
)
attach_sha256_array=(
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_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_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_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";
@@ -87,7 +87,7 @@ DEFINE_TEST(depmod_modules_outdir,
});
#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_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_search_order_simple(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -114,7 +114,7 @@ DEFINE_TEST(depmod_search_order_simple,
});
#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_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_search_order_same_prefix(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -164,7 +164,7 @@ DEFINE_TEST(depmod_detect_loop,
});
#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_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_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_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_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_DIRECTORY "/" MODULES_UNAME
static noreturn int depmod_search_order_override(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
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_DIRECTORY "/a", "r");
if (fp == NULL)
return EXIT_FAILURE;;
@@ -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_DIRECTORY "/a", O_RDONLY);
if (fd < 0)
return EXIT_FAILURE;
@@ -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_DIRECTORY "/a", F_OK) < 0) {
ERR("access failed: %m\n");
return EXIT_FAILURE;
}
- if (stat("/lib/modules/a", &st) < 0) {
+ if (stat(MODULE_DIRECTORY "/a", &st) < 0) {
ERR("stat failed: %m\n");
return EXIT_FAILURE;
}
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_DIRECTORY/$VER/' */
char *uncrelpath; /* same as relpath but ending in .ko */
struct kmod_list *info_list;
struct kmod_list *dep_sym_list;
@@ -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_DIRECTORY "/%s",
root ?: "", cfg.kversion);
cfg.outdirnamelen = snprintf(cfg.outdirname, PATH_MAX,
- "%s/lib/modules/%s",
+ "%s" MODULE_DIRECTORY "/%s",
out_root ?: (root ?: ""), cfg.kversion);
if (optind == argc)
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_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 *argv[])
}
kversion = u.release;
}
- snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s" MODULE_DIRECTORY "/%s",
root, kversion);
dirname = dirname_buf;
}
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_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 **orig_argv)
kversion = u.release;
}
snprintf(dirname_buf, sizeof(dirname_buf),
- "%s/lib/modules/%s", root,
+ "%s" MODULE_DIRECTORY "/%s", root,
kversion);
dirname = dirname_buf;
}
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_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_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_DIRECTORY "/%s/modules.devname - %m\n",
kernel.release);
ret = EXIT_FAILURE;
}
--
2.41.0