Accepting request 1096217 from Base:System

- 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 (forwarded request 1096182 from michals)

OBS-URL: https://build.opensuse.org/request/show/1096217
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kmod?expand=0&rev=75
This commit is contained in:
Dominique Leuenberger 2023-07-01 21:18:05 +00:00 committed by Git OBS Bridge
commit 4c73647ab2
12 changed files with 1111 additions and 211 deletions

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

View File

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

View File

@ -40,11 +40,16 @@ 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: usr-lib-modprobe.patch
Patch8: no-stylesheet-download.patch
Patch9: 0001-testsuite-repair-read-of-uninitialized-memory.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: usr-lib-modules.patch
Patch11: depmod-Introduce-outdir-option.patch
Patch12: testsuite-Handle-different-sysconfdir.patch
Patch13: testsuite-depmod-use-defines-for-the-rootfs-lib_modu.patch
Patch14: kmod-Add-config-command-to-show-compile-time-configu.patch
Patch15: usr-lib-modules.patch
Patch16: no-stylesheet-download.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: docbook-xsl-stylesheets
@ -74,9 +79,6 @@ buildloop with the kernel.
%prep
%setup -q -n kmod-%version
%autopatch -p1
%if 0%{?suse_version} < 1550
%patch11 -p1 -R
%endif
%build
GTKDOCIZE=/bin/true autoreconf -fi
@ -92,6 +94,9 @@ export LDFLAGS="-Wl,-z,relro,-z,now"
%endif
--includedir="%_includedir/kmod" \
--with-rootlibdir="%_libdir" \
%if 0%{?suse_version} > 1500
--with-module-prefix="%_prefix" \
%endif
--bindir="%_bindir"
%make_build KDIR="%kdir"

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
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>

View File

@ -40,11 +40,16 @@ 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: usr-lib-modprobe.patch
Patch8: no-stylesheet-download.patch
Patch9: 0001-testsuite-repair-read-of-uninitialized-memory.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: usr-lib-modules.patch
Patch11: depmod-Introduce-outdir-option.patch
Patch12: testsuite-Handle-different-sysconfdir.patch
Patch13: testsuite-depmod-use-defines-for-the-rootfs-lib_modu.patch
Patch14: kmod-Add-config-command-to-show-compile-time-configu.patch
Patch15: usr-lib-modules.patch
Patch16: no-stylesheet-download.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: docbook-xsl-stylesheets
@ -116,9 +121,6 @@ in %lname.
%prep
%autosetup -p1
%if 0%{?suse_version} < 1550
%patch11 -p1 -R
%endif
%build
GTKDOCIZE=/bin/true autoreconf -fi
@ -134,6 +136,9 @@ export LDFLAGS="-Wl,-z,relro,-z,now"
%endif
--includedir="%_includedir/kmod" \
--with-rootlibdir="%_libdir" \
%if 0%{?suse_version} > 1500
--with-module-prefix="%_prefix" \
%endif
--bindir="%_bindir"
%make_build

View File

@ -0,0 +1,29 @@
From a792ef9a42b9bd8cc76260b4aa61a681f6998364 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 30 Jun 2023 10:56:31 +0200
Subject: [PATCH 1/9] man/depmod.d: Fix incorrect /usr/lib search path
depmod searches /lib/depmod.d but the man page says /usr/lib/depmod.d is
reached. Aling the documentation with the code.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
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

@ -1,7 +1,7 @@
From e89e12c40ab05fb26066e7f4f82326b545041bd3 Mon Sep 17 00:00:00 2001
From cd775d005f7d36395ef554d128c849fac5430f37 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 6 Sep 2021 14:52:35 +0200
Subject: [PATCH] Do not download the docbook stylesheet during build, use
Subject: [PATCH 9/9] Do not download the docbook stylesheet during build, use
local copy instead.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
@ -10,16 +10,15 @@ Signed-off-by: Michal Suchanek <msuchanek@suse.de>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/Makefile.am b/man/Makefile.am
index b6603e34c4bf..7dc73b348ce2 100644
index 1a9a92f9c224..6b89400e9d39 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -22,5 +22,5 @@ CLEANFILES = $(dist_man_MANS)
@@ -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 $<
sed -i -e 's|@PREFIX@|$(prefix)|g' $@
- http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl -
+ /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl -
--
2.40.0
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

@ -1,7 +1,8 @@
From 846439397efd9fa54763cc80da0e6d8bdf27c0e5 Mon Sep 17 00:00:00 2001
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] testsuite: Move setup-rootfs logic from Makefile to script
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
@ -86,5 +87,5 @@ index 099f02669156..d9cc627f7224 100755
+
+touch testsuite/stamp-rootfs
--
2.40.0
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

View File

@ -1,7 +1,8 @@
From 99208681c29cec2097cb9c7a4b109d9c3d3f47a9 Mon Sep 17 00:00:00 2001
From 9d4c3adcd051408a9a4489984be73f9c06b938ab Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Tue, 12 Jan 2021 16:54:46 +0100
Subject: [PATCH] modprobe.d, depmod.d: load from $prefix/lib.
Subject: [PATCH 2/9] libkmod, depmod: Load modprobe.d, depmod.d from
$prefix/lib.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -10,6 +11,13 @@ 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 seach directories.
Cc: Marcus Rückert <mrueckert@suse.com>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Dominique Leuenberger <dimstar@opensuse.org>
@ -17,11 +25,11 @@ Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
Makefile.am | 1 +
libkmod/libkmod.c | 3 ++-
man/Makefile.am | 1 +
man/depmod.d.xml | 3 ++-
man/Makefile.am | 9 +++++++--
man/depmod.d.xml | 1 +
man/modprobe.d.xml | 1 +
tools/depmod.c | 1 +
6 files changed, 8 insertions(+), 2 deletions(-)
6 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 0e4877074f40..e7313fa8a33e 100644
@ -57,24 +65,34 @@ index 7c2b889d713e..75fc8be3fadc 100644
* be null terminated.
*
diff --git a/man/Makefile.am b/man/Makefile.am
index 11514d52a190..b6603e34c4bf 100644
index 11514d52a190..ad07c30bbd24 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -23,3 +23,4 @@ CLEANFILES = $(dist_man_MANS)
@@ -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 [ -n '$(prefix)' ] ; then \
+ sed -e 's|@PREFIX@|$(prefix)|g' $< ; \
+ else \
+ sed -e '/@PREFIX@/d' $< ; \
+ fi | \
+ $(XSLT) \
-o $@ \
--nonet \
--stringparam man.output.quietly 1 \
--param funcsynopsis.style "'ansi'" \
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+ sed -i -e 's|@PREFIX@|$(prefix)|g' $@
- 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 76548e92a312..431ebca6654b 100644
index 8d3d821cddc8..431ebca6654b 100644
--- a/man/depmod.d.xml
+++ b/man/depmod.d.xml
@@ -39,7 +39,8 @@
</refnamediv>
@@ -40,6 +40,7 @@
<refsynopsisdiv>
- <para><filename>/usr/lib/depmod.d/*.conf</filename></para>
+ <para><filename>/lib/depmod.d/*.conf</filename></para>
<para><filename>/lib/depmod.d/*.conf</filename></para>
+ <para><filename>@PREFIX@/lib/depmod.d/*.conf</filename></para>
<para><filename>/usr/local/lib/depmod.d/*.conf</filename></para>
<para><filename>/run/depmod.d/*.conf</filename></para>
@ -104,5 +122,5 @@ index 364b7d4faa9e..a9349b20ee9c 100644
NULL
};
--
2.40.0
2.41.0

View File

@ -1,48 +1,85 @@
From 220ef8e24e731da2d435ae85ad3003d1f215ef2f Mon Sep 17 00:00:00 2001
From cb784d4f70cd49565a934bfae87373fe495adec8 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 26 May 2023 10:38:05 +0200
Subject: [PATCH] libkmod: Search for kernel modules under $prefix
Subject: [PATCH 8/9] libkmod, depmod, modprobe: Search for kernel modules
under ${module_prefix}
modprobe.d is now searched under /usr/lib, search kernel modules there as
well.
modprobe.d is now searched under ${prefix}/lib, add ${module_prefix} to
specify the directory where to search for kernel modules.
With this it shoud be possible to build a kernel without a compatibility
symlink.
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>
---
Makefile.am | 2 +-
libkmod/libkmod.c | 4 +-
Makefile.am | 3 +-
configure.ac | 7 ++
libkmod/libkmod.c | 6 +-
man/Makefile.am | 1 +
man/depmod.d.xml | 6 +-
man/depmod.xml | 4 +-
man/modinfo.xml | 2 +-
man/modprobe.xml | 2 +-
man/modules.dep.xml | 6 +-
testsuite/module-playground/Makefile | 2 +-
testsuite/setup-rootfs.sh | 103 +++++++++++++++------------
testsuite/test-depmod.c | 22 +++---
testsuite/test-testsuite.c | 8 +--
tools/depmod.c | 4 +-
testsuite/setup-rootfs.sh | 109 +++++++++++++++------------
testsuite/test-depmod.c | 16 ++--
testsuite/test-testsuite.c | 8 +-
tools/depmod.c | 6 +-
tools/kmod.c | 1 +
tools/modinfo.c | 4 +-
tools/modprobe.c | 4 +-
tools/static-nodes.c | 6 +-
15 files changed, 96 insertions(+), 83 deletions(-)
18 files changed, 108 insertions(+), 85 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 32f4b80e9870..aff931f33348 100644
index 246d4f5b138f..b25a95cfe266 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -245,7 +245,7 @@ EXTRA_DIST += testsuite/setup-rootfs.sh
@@ -20,6 +20,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPREFIX=\""$(prefix)"\" \
+ -DMODULE_PREFIX=\""$(module_prefix)"\" \
${zlib_CFLAGS}
AM_CFLAGS = $(OUR_CFLAGS)
@@ -245,7 +246,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) PREFIX=$(prefix) $(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)
+CREATE_ROOTFS = $(AM_V_GEN) MODULE_PREFIX=$(module_prefix) $(top_srcdir)/testsuite/setup-rootfs.sh $(ROOTFS_PRISTINE) $(ROOTFS) $(MODULE_PLAYGROUND) $(top_builddir)/config.h $(sysconfdir)
build-module-playground:
$(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
diff --git a/configure.ac b/configure.ac
index a74d3baf0a42..f5947dd7b446 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,12 @@ AC_ARG_WITH([rootlibdir],
[], [with_rootlibdir=$libdir])
AC_SUBST([rootlibdir], [$with_rootlibdir])
+# Ideally this would be $prefix but default to empty for compatibility with earlier versions
+AC_ARG_WITH([module_prefix],
+ AS_HELP_STRING([--with-module-prefix=DIR], [directory in which to look for /lib/modules directory with kernel modules - typically '' or ${prefix}]),
+ [], [with_module_prefix=])
+AC_SUBST([module_prefix], [$with_module_prefix])
+
AC_ARG_WITH([zstd],
AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
[], [with_zstd=no])
@@ -302,6 +308,7 @@ AC_MSG_RESULT([
=======
prefix: ${prefix}
+ module_prefix: ${module_prefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
rootlibdir: ${rootlibdir}
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 75fc8be3fadc..af061a408409 100644
index 75fc8be3fadc..8a0b2f243b30 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -209,7 +209,7 @@ static int log_priority(const char *priority)
@ -50,21 +87,41 @@ index 75fc8be3fadc..af061a408409 100644
}
-static const char *dirname_default_prefix = "/lib/modules";
+static const char *dirname_default_prefix = PREFIX "/lib/modules";
+static const char *dirname_default_prefix = MODULE_PREFIX "/lib/modules";
static char *get_kernel_release(const char *dirname)
{
@@ -231,7 +231,7 @@ static char *get_kernel_release(const char *dirname)
@@ -231,14 +231,14 @@ 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 PREFIX/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
* to load from user-defined configuration parameters such as
* alias, blacklists, commands (install, remove). If NULL
* defaults to /etc/modprobe.d, /run/modprobe.d,
- * /usr/local/lib/modprobe.d and PREFIX/lib/modprobe.d. Give an empty
+ * /usr/local/lib/modprobe.d and ${module_prefix}/lib/modprobe.d. Give an empty
* vector if configuration should not be read. This array must
* be null terminated.
*
diff --git a/man/Makefile.am b/man/Makefile.am
index ad07c30bbd24..1a9a92f9c224 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -22,6 +22,7 @@ CLEANFILES = $(dist_man_MANS)
else \
sed -e '/@PREFIX@/d' $< ; \
fi | \
+ sed -e 's|@MODULE_PREFIX@|$(module_prefix)|g' | \
$(XSLT) \
-o $@ \
--nonet \
diff --git a/man/depmod.d.xml b/man/depmod.d.xml
index 431ebca6654b..81305737ae39 100644
index 431ebca6654b..2583a8d8a5fc 100644
--- a/man/depmod.d.xml
+++ b/man/depmod.d.xml
@@ -70,7 +70,7 @@
@ -72,7 +129,7 @@ index 431ebca6654b..81305737ae39 100644
<listitem>
<para>
- This allows you to specify the order in which /lib/modules
+ This allows you to specify the order in which @PREFIX@/lib/modules
+ This allows you to specify the order in which @MODULE_PREFIX@/lib/modules
(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
@ -81,7 +138,7 @@ index 431ebca6654b..81305737ae39 100644
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 @PREFIX@/lib/modules (or other
+ name of the subdirectory under @MODULE_PREFIX@/lib/modules (or other
module location) where the target module is installed.
</para>
<para>
@ -90,34 +147,34 @@ index 431ebca6654b..81305737ae39 100644
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
+ @PREFIX@/lib/modules (or other module location) will take priority
+ @MODULE_PREFIX@/lib/modules (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 ea0be27280b2..df5cd47ed870 100644
index 3b0097184fd7..9d9cf195a355 100644
--- a/man/depmod.xml
+++ b/man/depmod.xml
@@ -79,7 +79,7 @@
@@ -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>@PREFIX@/lib/modules/</filename><replaceable>version</replaceable> and
+ <filename>@MODULE_PREFIX@/lib/modules/</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
@@ -140,7 +140,7 @@
@@ -141,7 +141,7 @@
<listitem>
<para>
If your modules are not currently in the (normal) directory
- <filename>/lib/modules/</filename><replaceable>version</replaceable>,
+ <filename>@PREFIX@/lib/modules/</filename><replaceable>version</replaceable>,
+ <filename>@MODULE_PREFIX@/lib/modules/</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..9bc58e4930e0 100644
index 9fe0324a2527..d48c64560e9d 100644
--- a/man/modinfo.xml
+++ b/man/modinfo.xml
@@ -54,7 +54,7 @@
@ -125,12 +182,12 @@ index 9fe0324a2527..9bc58e4930e0 100644
modules given on the command line. If the module name is not a filename,
then the
- <filename>/lib/modules/</filename><replaceable>version</replaceable>
+ <filename>@PREFIX@/lib/modules/</filename><replaceable>version</replaceable>
+ <filename>@MODULE_PREFIX@/lib/modules/</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..9074ead11f3e 100644
index db39c7a18bb7..2c5ede617e23 100644
--- a/man/modprobe.xml
+++ b/man/modprobe.xml
@@ -78,7 +78,7 @@
@ -138,12 +195,12 @@ index db39c7a18bb7..9074ead11f3e 100644
underscore conversion is performed).
<command>modprobe</command> looks in the module directory
- <filename>/lib/modules/`uname -r`</filename> for all
+ <filename>@PREFIX@/lib/modules/`uname -r`</filename> for all
+ <filename>@MODULE_PREFIX@/lib/modules/`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..c51de2774df8 100644
index ed633694ec9e..9130ec392089 100644
--- a/man/modules.dep.xml
+++ b/man/modules.dep.xml
@@ -34,8 +34,8 @@
@ -152,8 +209,8 @@ index ed633694ec9e..c51de2774df8 100644
<refsynopsisdiv>
- <para><filename>/lib/modules/modules.dep</filename></para>
- <para><filename>/lib/modules/modules.dep.bin</filename></para>
+ <para><filename>@PREFIX@/lib/modules/modules.dep</filename></para>
+ <para><filename>@PREFIX@/lib/modules/modules.dep.bin</filename></para>
+ <para><filename>@MODULE_PREFIX@/lib/modules/modules.dep</filename></para>
+ <para><filename>@MODULE_PREFIX@/lib/modules/modules.dep.bin</filename></para>
</refsynopsisdiv>
<refsect1><title>DESCRIPTION</title>
@ -162,12 +219,12 @@ index ed633694ec9e..c51de2774df8 100644
<command>depmod</command> listing the dependencies for
every module in the directories under
- <filename>/lib/modules/</filename><replaceable>version</replaceable>.
+ <filename>@PREFIX@/lib/modules/</filename><replaceable>version</replaceable>.
+ <filename>@MODULE_PREFIX@/lib/modules/</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..804611afc600 100644
index e6045b0dd932..a7ab09bea2bf 100644
--- a/testsuite/module-playground/Makefile
+++ b/testsuite/module-playground/Makefile
@@ -47,7 +47,7 @@ endif
@ -175,35 +232,35 @@ index e6045b0dd932..804611afc600 100644
else
# normal makefile
-KDIR ?= /lib/modules/`uname -r`/build
+KDIR ?= $(prefix)/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 d9cc627f7224..a3460d4ec3b4 100755
index 8b13a40f2cae..abc3790715db 100755
--- a/testsuite/setup-rootfs.sh
+++ b/testsuite/setup-rootfs.sh
@@ -15,6 +15,19 @@ create_rootfs() {
@@ -16,6 +16,19 @@ create_rootfs() {
cp -r "$ROOTFS_PRISTINE" "$ROOTFS"
find "$ROOTFS" -type d -exec chmod +w {} \;
find "$ROOTFS" -type f -name .gitignore -exec rm -f {} \;
+ if [ -n "$PREFIX" ] ; then
+ sed -i -e "s|/lib/modules|$PREFIX/lib/modules|g" $(find "$ROOTFS" -name \*.txt -o -name \*.conf -o -name \*.dep)
+ sed -i -e "s|$PREFIX/lib/modules/external|/lib/modules/external|g" $(find "$ROOTFS" -name \*.txt -o -name \*.conf -o -name \*.dep)
+ if [ -n "$MODULE_PREFIX" ] ; then
+ sed -i -e "s|/lib/modules|$MODULE_PREFIX/lib/modules|g" $(find "$ROOTFS" -name \*.txt -o -name \*.conf -o -name \*.dep)
+ sed -i -e "s|$MODULE_PREFIX/lib/modules/external|/lib/modules/external|g" $(find "$ROOTFS" -name \*.txt -o -name \*.conf -o -name \*.dep)
+ for i in "$ROOTFS"/*/lib/modules/* "$ROOTFS"/*/*/lib/modules/* ; do
+ version=$(basename $i)
+ [ $version != 'external' ] || continue
+ i=$(dirname $i)
+ lib="$(dirname $i)"
+ up="$(dirname $lib)$PREFIX"
+ up="$(dirname $lib)$MODULE_PREFIX"
+ mkdir -p "$up"
+ mv "$lib" "$up"
+ done
+ fi
}
feature_enabled() {
@@ -24,52 +37,52 @@ feature_enabled() {
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=(
@ -224,28 +281,28 @@ index d9cc627f7224..a3460d4ec3b4 100755
- ["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$PREFIX/lib/modules/4.4.4/kernel/crypto/"]="mod-simple.ko"
+ ["test-depmod/search-order-simple$PREFIX/lib/modules/4.4.4/updates/"]="mod-simple.ko"
+ ["test-depmod/search-order-same-prefix$PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-same-prefix$PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-c.ko"]="mod-loop-c.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-d.ko"]="mod-loop-d.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-e.ko"]="mod-loop-e.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-f.ko"]="mod-loop-f.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-g.ko"]="mod-loop-g.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-h.ko"]="mod-loop-h.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-i.ko"]="mod-loop-i.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-j.ko"]="mod-loop-j.ko"
+ ["test-depmod/detect-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-k.ko"]="mod-loop-k.ko"
+ ["test-depmod/search-order-external-first$PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-first$PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/search-order-simple$MODULE_PREFIX/lib/modules/4.4.4/kernel/crypto/"]="mod-simple.ko"
+ ["test-depmod/search-order-simple$MODULE_PREFIX/lib/modules/4.4.4/updates/"]="mod-simple.ko"
+ ["test-depmod/search-order-same-prefix$MODULE_PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-same-prefix$MODULE_PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-c.ko"]="mod-loop-c.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-d.ko"]="mod-loop-d.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-e.ko"]="mod-loop-e.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-f.ko"]="mod-loop-f.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-g.ko"]="mod-loop-g.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-h.ko"]="mod-loop-h.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-i.ko"]="mod-loop-i.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-j.ko"]="mod-loop-j.ko"
+ ["test-depmod/detect-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-k.ko"]="mod-loop-k.ko"
+ ["test-depmod/search-order-external-first$MODULE_PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-first$MODULE_PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
["test-depmod/search-order-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$PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-last$PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-last$MODULE_PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-external-last$MODULE_PREFIX/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
["test-depmod/search-order-external-last/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"
@ -253,20 +310,20 @@ index d9cc627f7224..a3460d4ec3b4 100755
- ["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$PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-override$PREFIX/lib/modules/4.4.4/override/"]="mod-simple.ko"
+ ["test-dependencies$PREFIX/lib/modules/4.0.20-kmod/kernel/fs/foo/"]="mod-foo-b.ko"
+ ["test-dependencies$PREFIX/lib/modules/4.0.20-kmod/kernel/"]="mod-foo-c.ko"
+ ["test-dependencies$PREFIX/lib/modules/4.0.20-kmod/kernel/lib/"]="mod-foo-a.ko"
+ ["test-dependencies$PREFIX/lib/modules/4.0.20-kmod/kernel/fs/"]="mod-foo.ko"
+ ["test-depmod/search-order-override$MODULE_PREFIX/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-override$MODULE_PREFIX/lib/modules/4.4.4/override/"]="mod-simple.ko"
+ ["test-dependencies$MODULE_PREFIX/lib/modules/4.0.20-kmod/kernel/fs/foo/"]="mod-foo-b.ko"
+ ["test-dependencies$MODULE_PREFIX/lib/modules/4.0.20-kmod/kernel/"]="mod-foo-c.ko"
+ ["test-dependencies$MODULE_PREFIX/lib/modules/4.0.20-kmod/kernel/lib/"]="mod-foo-a.ko"
+ ["test-dependencies$MODULE_PREFIX/lib/modules/4.0.20-kmod/kernel/fs/"]="mod-foo.ko"
["test-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$PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/show-depends$PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/show-depends$PREFIX/lib/modules/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
+ ["test-modprobe/show-depends$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/show-depends$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/show-depends$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
["test-modprobe/show-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"
@ -277,121 +334,128 @@ index d9cc627f7224..a3460d4ec3b4 100755
- ["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$PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/softdep-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/install-cmd-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/install-cmd-loop$PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/force$PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/oldkernel$PREFIX/lib/modules/3.3.3/kernel/"]="mod-simple.ko"
+ ["test-modprobe/oldkernel-force$PREFIX/lib/modules/3.3.3/kernel/"]="mod-simple.ko"
+ ["test-modprobe/alias-to-none$PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/module-param-kcmdline$PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/softdep-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/softdep-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/install-cmd-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
+ ["test-modprobe/install-cmd-loop$MODULE_PREFIX/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
+ ["test-modprobe/force$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/oldkernel$MODULE_PREFIX/lib/modules/3.3.3/kernel/"]="mod-simple.ko"
+ ["test-modprobe/oldkernel-force$MODULE_PREFIX/lib/modules/3.3.3/kernel/"]="mod-simple.ko"
+ ["test-modprobe/alias-to-none$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-modprobe/module-param-kcmdline$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
["test-modprobe/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-order-compressed$PREFIX/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
+ ["test-depmod/modules-order-compressed$PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
+ ["test-depmod/modules-order-compressed$PREFIX/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_PREFIX/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
+ ["test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
+ ["test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
+ ["test-depmod/modules-outdir$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
+ ["test-depmod/modules-outdir$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
+ ["test-depmod/modules-outdir$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
["test-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"
@@ -77,20 +90,20 @@ map=(
@@ -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$PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-tools/remove$PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-tools/insert$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
+ ["test-tools/remove$MODULE_PREFIX/lib/modules/4.4.4/kernel/"]="mod-simple.ko"
)
gzip_array=(
- "test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"
+ "test-depmod/modules-order-compressed$PREFIX/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"
+ "test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"
)
xz_array=(
- "test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"
+ "test-depmod/modules-order-compressed$PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"
+ "test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"
)
zstd_array=(
- "test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"
+ "test-depmod/modules-order-compressed$PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"
+ "test-depmod/modules-order-compressed$MODULE_PREFIX/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"
)
attach_sha256_array=(
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index d7802d7b2e0b..d82ffdf90e7e 100644
index 93606947f18a..870f2667862b 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -27,7 +27,7 @@
#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 PREFIX "/lib/modules/" MODULES_ORDER_UNAME
-#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_UNAME
+#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
static noreturn int depmod_modules_order_for_compressed(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -77,8 +77,8 @@ DEFINE_TEST(depmod_search_order_simple,
},
.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_ROOTFS PREFIX "/lib/modules/4.4.4/correct-modules.dep",
+ SEARCH_ORDER_SIMPLE_ROOTFS PREFIX "/lib/modules/4.4.4/modules.dep" },
{ }
},
@@ -55,8 +55,8 @@ DEFINE_TEST(depmod_modules_order_for_compressed,
});
@@ -103,8 +103,8 @@ DEFINE_TEST(depmod_search_order_same_prefix,
},
.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_ROOTFS PREFIX "/lib/modules/4.4.4/correct-modules.dep",
+ SEARCH_ORDER_SAME_PREFIX_ROOTFS PREFIX "/lib/modules/4.4.4/modules.dep" },
{ }
},
#define MODULES_OUTDIR_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-outdir"
-#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir/lib/modules/" MODULES_UNAME
-#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS "/lib/modules/" MODULES_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir" MODULE_PREFIX "/lib/modules/" MODULES_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
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,
});
@@ -158,8 +158,8 @@ DEFINE_TEST(depmod_search_order_external_first,
},
.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_ROOTFS PREFIX "/lib/modules/4.4.4/correct-modules.dep",
+ SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS PREFIX "/lib/modules/4.4.4/modules.dep" },
{ }
},
#define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
-#define SEARCH_ORDER_SIMPLE_LIB_MODULES SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_SIMPLE_LIB_MODULES SEARCH_ORDER_SIMPLE_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
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,
});
@@ -184,8 +184,8 @@ DEFINE_TEST(depmod_search_order_external_last,
},
.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_ROOTFS PREFIX "/lib/modules/4.4.4/correct-modules.dep",
+ SEARCH_ORDER_EXTERNAL_LAST_ROOTFS PREFIX "/lib/modules/4.4.4/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
+#define SEARCH_ORDER_SAME_PREFIX_LIB_MODULES SEARCH_ORDER_SAME_PREFIX_ROOTFS MODULE_PREFIX "/lib/modules/" 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,
});
@@ -213,8 +213,8 @@ DEFINE_TEST(depmod_search_order_override,
},
.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_ROOTFS PREFIX "/lib/modules/4.4.4/correct-modules.dep",
+ SEARCH_ORDER_OVERRIDE_ROOTFS PREFIX "/lib/modules/4.4.4/modules.dep" },
{ }
},
#define SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-first"
-#define SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/" MODULES_UNAME
+#define SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS MODULE_PREFIX "/lib/modules/" MODULES_UNAME
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_PREFIX "/lib/modules/" 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_PREFIX "/lib/modules/" 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..26395b5f71ae 100644
index 56e73609f204..903a0102105e 100644
--- a/testsuite/test-testsuite.c
+++ b/testsuite/test-testsuite.c
@@ -64,7 +64,7 @@ static int testsuite_rootfs_fopen(const struct test *t)
@ -399,7 +463,7 @@ index 56e73609f204..26395b5f71ae 100644
int n;
- fp = fopen("/lib/modules/a", "r");
+ fp = fopen(PREFIX "/lib/modules/a", "r");
+ fp = fopen(MODULE_PREFIX "/lib/modules/a", "r");
if (fp == NULL)
return EXIT_FAILURE;;
@ -408,7 +472,7 @@ index 56e73609f204..26395b5f71ae 100644
int fd, done;
- fd = open("/lib/modules/a", O_RDONLY);
+ fd = open(PREFIX "/lib/modules/a", O_RDONLY);
+ fd = open(MODULE_PREFIX "/lib/modules/a", O_RDONLY);
if (fd < 0)
return EXIT_FAILURE;
@ -417,40 +481,57 @@ index 56e73609f204..26395b5f71ae 100644
struct stat st;
- if (access("/lib/modules/a", F_OK) < 0) {
+ if (access(PREFIX "/lib/modules/a", F_OK) < 0) {
+ if (access(MODULE_PREFIX "/lib/modules/a", F_OK) < 0) {
ERR("access failed: %m\n");
return EXIT_FAILURE;
}
- if (stat("/lib/modules/a", &st) < 0) {
+ if (stat(PREFIX "/lib/modules/a", &st) < 0) {
+ if (stat(MODULE_PREFIX "/lib/modules/a", &st) < 0) {
ERR("stat failed: %m\n");
return EXIT_FAILURE;
}
diff --git a/tools/depmod.c b/tools/depmod.c
index a9349b20ee9c..746e2bde6db7 100644
index 2d4cf75fdfee..9aa350c5f8d6 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -907,7 +907,7 @@ struct vertex;
@@ -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$PREFIX/lib/modules/$VER/' */
+ const char *relpath; /* path relative to '$ROOT$MODULE_PREFIX/lib/modules/$VER/' */
char *uncrelpath; /* same as relpath but ending in .ko */
struct kmod_list *info_list;
struct kmod_list *dep_sym_list;
@@ -3009,7 +3009,7 @@ static int do_depmod(int argc, char *argv[])
@@ -3024,11 +3024,11 @@ static int do_depmod(int argc, char *argv[])
}
cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
- "%s/lib/modules/%s",
+ "%s" PREFIX "/lib/modules/%s",
root == NULL ? "" : root, cfg.kversion);
+ "%s" MODULE_PREFIX "/lib/modules/%s",
root ?: "", cfg.kversion);
cfg.outdirnamelen = snprintf(cfg.outdirname, PATH_MAX,
- "%s/lib/modules/%s",
+ "%s" MODULE_PREFIX "/lib/modules/%s",
out_root ?: (root ?: ""), cfg.kversion);
if (optind == argc)
diff --git a/tools/kmod.c b/tools/kmod.c
index 28aefb463492..76f52fcae921 100644
--- a/tools/kmod.c
+++ b/tools/kmod.c
@@ -114,6 +114,7 @@ static int kmod_config(int argc, char *argv[])
{
unsigned i;
printf("{\"prefix\":\"" PREFIX "\""
+ ",\"module_prefix\":\"" MODULE_PREFIX "\""
",\"module_compression\":[");
for(i = 0; compressions[i]; i++) {
printf("%s\"%s\"", i ? "," : "", compressions[i]);
diff --git a/tools/modinfo.c b/tools/modinfo.c
index d0aab200af4e..0c999b49ca5e 100644
index d0aab200af4e..c10ce7ec5ef3 100644
--- a/tools/modinfo.c
+++ b/tools/modinfo.c
@@ -367,7 +367,7 @@ static void help(void)
@ -458,7 +539,7 @@ index d0aab200af4e..0c999b49ca5e 100644
"\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 " PREFIX "/lib/modules\n"
+ "\t-b, --basedir=DIR Use DIR as filesystem root for " MODULE_PREFIX "/lib/modules\n"
"\t-V, --version Show version\n"
"\t-h, --help Show this help\n",
program_invocation_short_name);
@ -467,12 +548,12 @@ index d0aab200af4e..0c999b49ca5e 100644
kversion = u.release;
}
- snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s" PREFIX "/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s" MODULE_PREFIX "/lib/modules/%s",
root, kversion);
dirname = dirname_buf;
}
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 2a2ae21f5370..72fb44c71097 100644
index 2a2ae21f5370..a36d3186901e 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -142,7 +142,7 @@ static void help(void)
@ -480,7 +561,7 @@ index 2a2ae21f5370..72fb44c71097 100644
"\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 " PREFIX "/lib/modules\n"
+ "\t-d, --dirname=DIR Use DIR as filesystem root for " MODULE_PREFIX "/lib/modules\n"
"\t-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
"\t-s, --syslog print to syslog, not stderr\n"
@ -489,12 +570,12 @@ index 2a2ae21f5370..72fb44c71097 100644
}
snprintf(dirname_buf, sizeof(dirname_buf),
- "%s/lib/modules/%s", root,
+ "%s" PREFIX "/lib/modules/%s", root,
+ "%s" MODULE_PREFIX "/lib/modules/%s", root,
kversion);
dirname = dirname_buf;
}
diff --git a/tools/static-nodes.c b/tools/static-nodes.c
index 8d2356da73f3..b74ad35fedd7 100644
index 8d2356da73f3..868af3b58ac7 100644
--- a/tools/static-nodes.c
+++ b/tools/static-nodes.c
@@ -212,15 +212,15 @@ static int do_static_nodes(int argc, char *argv[])
@ -502,20 +583,20 @@ index 8d2356da73f3..b74ad35fedd7 100644
}
- snprintf(modules, sizeof(modules), "/lib/modules/%s/modules.devname", kernel.release);
+ snprintf(modules, sizeof(modules), PREFIX "/lib/modules/%s/modules.devname", kernel.release);
+ snprintf(modules, sizeof(modules), MODULE_PREFIX "/lib/modules/%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: " PREFIX "/lib/modules/%s/modules.devname not found - ignoring\n",
+ fprintf(stderr, "Warning: " MODULE_PREFIX "/lib/modules/%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 " PREFIX "/lib/modules/%s/modules.devname - %m\n",
+ fprintf(stderr, "Error: could not open " MODULE_PREFIX "/lib/modules/%s/modules.devname - %m\n",
kernel.release);
ret = EXIT_FAILURE;
}
--
2.40.0
2.41.0