Discussion:
Making depmod, etc more flexible?
Andy Lutomirski
2014-02-28 17:33:52 UTC
Permalink
I'm working on virtme
(https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git/), a tool
to easily test a kernel without a disk image or any need to install
that kernel. I want to have full support for loading modules from a
kernel tree, but depmod is getting in the way.

What I think I want is a way to generate modules.dep, etc in a
subdirectory of the kernel build directory. The hierarchy needs to be
such that:

- modprobe --show-depends would work.
- I could symlink and/or bind-mount things into /lib/modules so that
modprobe, udev, etc all work.

One approach that should work:

.tmp_moddep/build: a symlink to '..'
.tmp_moddep/modules.dep, etc: the usual, with module paths that point
into build/

The problem is that getting depmod to generate anything remotely like
this is basically impossible.

Here are two changes to depmod that would, I think, make this possible:

1. Add --moddir, an option to specify the target directory directly.
That is, if --moddir is used, then -b would be illegal, the kernel
version could not be specified, and cfg.dirname would be set to the
argument of --moddir, literally.

2. Allow relative paths to modules on the command line. Such paths
would be interpreted relative to cfg.dirname. (That would probably be
easiest if depmod would chdir into cfg.dirname.)

To finish the job, modprobe would need a --moddir argument as well.

Thoughts? Is there a different approach I should be taking here?

--Andy
Lucas De Marchi
2014-02-28 18:27:21 UTC
Permalink
Post by Andy Lutomirski
I'm working on virtme
(https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git/), a tool
to easily test a kernel without a disk image or any need to install
that kernel. I want to have full support for loading modules from a
kernel tree, but depmod is getting in the way.
What I think I want is a way to generate modules.dep, etc in a
subdirectory of the kernel build directory. The hierarchy needs to be
- modprobe --show-depends would work.
- I could symlink and/or bind-mount things into /lib/modules so that
modprobe, udev, etc all work.
.tmp_moddep/build: a symlink to '..'
.tmp_moddep/modules.dep, etc: the usual, with module paths that point
into build/
The problem is that getting depmod to generate anything remotely like
this is basically impossible.
1. Add --moddir, an option to specify the target directory directly.
That is, if --moddir is used, then -b would be illegal, the kernel
version could not be specified, and cfg.dirname would be set to the
argument of --moddir, literally.
2. Allow relative paths to modules on the command line. Such paths
would be interpreted relative to cfg.dirname. (That would probably be
easiest if depmod would chdir into cfg.dirname.)
To finish the job, modprobe would need a --moddir argument as well.
Thoughts? Is there a different approach I should be taking here?
Did you already take a look in the testsuite? We can execute modprobe
and depmod there.
Would that approach be feasible for you?

Lucas De Marchi
Andy Lutomirski
2014-02-28 20:23:45 UTC
Permalink
On Fri, Feb 28, 2014 at 10:27 AM, Lucas De Marchi
Post by Lucas De Marchi
Post by Andy Lutomirski
I'm working on virtme
(https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git/), a tool
to easily test a kernel without a disk image or any need to install
that kernel. I want to have full support for loading modules from a
kernel tree, but depmod is getting in the way.
What I think I want is a way to generate modules.dep, etc in a
subdirectory of the kernel build directory. The hierarchy needs to be
- modprobe --show-depends would work.
- I could symlink and/or bind-mount things into /lib/modules so that
modprobe, udev, etc all work.
.tmp_moddep/build: a symlink to '..'
.tmp_moddep/modules.dep, etc: the usual, with module paths that point
into build/
The problem is that getting depmod to generate anything remotely like
this is basically impossible.
1. Add --moddir, an option to specify the target directory directly.
That is, if --moddir is used, then -b would be illegal, the kernel
version could not be specified, and cfg.dirname would be set to the
argument of --moddir, literally.
2. Allow relative paths to modules on the command line. Such paths
would be interpreted relative to cfg.dirname. (That would probably be
easiest if depmod would chdir into cfg.dirname.)
To finish the job, modprobe would need a --moddir argument as well.
Thoughts? Is there a different approach I should be taking here?
Did you already take a look in the testsuite? We can execute modprobe
and depmod there.
Would that approach be feasible for you?
I don't think so. I could make a silly hierarchy like
build_dir/lib/modules/version/whatever, but populating it is a PITA --
there's no good way to specify explicit *relative* paths. I'll follow
up with a patch.
Post by Lucas De Marchi
Lucas De Marchi
--
Andy Lutomirski
AMA Capital Management, LLC
Andy Lutomirski
2014-02-28 20:43:56 UTC
Permalink
Currently, depmod and modprobe can only use directories of the form
ROOT/lib/modules/VERSION, where ROOT and VERSION can be specified on
the command line. Additionally, when used with explicitly-listed
modules depmod requires absolute paths, making it difficult to
generate a nonstandard module layout without symlink hacks and
absolute paths.

This lifts both restrictions with a new --moddir option. --moddir
specifies an exact directory name and, when --moddir is used, depmod
will accept relative module paths on the command line.

Signed-off-by: Andy Lutomirski <luto-***@public.gmane.org>
---
man/depmod.xml | 29 +++++++++++++++++++++++++++++
man/modprobe.xml | 18 ++++++++++++++++++
tools/depmod.c | 56 ++++++++++++++++++++++++++++++++++++++++++++------------
tools/modprobe.c | 16 ++++++++++++++++
4 files changed, 107 insertions(+), 12 deletions(-)

diff --git a/man/depmod.xml b/man/depmod.xml
index a9b61d9..1a8c10e 100644
--- a/man/depmod.xml
+++ b/man/depmod.xml
@@ -65,6 +65,7 @@
<arg><option>-n</option></arg>
<arg><option>-v</option></arg>
<arg><option>-P <replaceable>prefix</replaceable></option></arg>
+ <arg><option>--moddir <replaceable>moddir</replaceable></option></arg>
<arg><option>-w</option></arg>
<arg><option><replaceable>version</replaceable></option></arg>
<arg rep='repeat'><option><replaceable>filename</replaceable></option></arg>
@@ -148,6 +149,34 @@
option if you are a distribution vendor who needs to pre-generate
the meta-data files rather than running depmod again later.
</para>
+ <para>
+ The <command>--moddir</command> option can be used instead.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--moddir <replaceable>moddir</replaceable></option>
+ </term>
+ <listitem>
+ <para>
+ If your modules are not currently in the (normal) directory
+ <filename>/lib/modules/</filename><replaceable>version</replaceable>,
+ but in a staging area, you can specify a
+ <replaceable>moddir</replaceable> to override the directory
+ in which <command>depmod</command> writes its output and
+ possibly searches for modules.
+ </para>
+ <para>
+ If <command>--moddir</command> is specified, then module
+ file names listed on the command line are permitted to use
+ relative paths; relative paths will be interpreted relative
+ to <replaceable>moddir</replaceable>.
+ </para>
+ <para>
+ This option cannot be used with <command>-b</command> or
+ with an explicit kernel version.
+ </para>
</listitem>
</varlistentry>
<varlistentry>
diff --git a/man/modprobe.xml b/man/modprobe.xml
index 4c6c832..735acf1 100644
--- a/man/modprobe.xml
+++ b/man/modprobe.xml
@@ -407,6 +407,24 @@
</varlistentry>
<varlistentry>
<term>
+ <option>--moddir <replaceable>moddir</replaceable></option>
+ </term>
+ <listitem>
+ <para>
+ If your modules are not currently in the (normal) directory
+ <filename>/lib/modules/</filename><replaceable>version</replaceable>,
+ but in a staging area, you can specify a
+ <replaceable>moddir</replaceable> to override the directory
+ in which <command>modprobe</command> searches.
+ </para>
+ <para>
+ This option cannot be used with <command>--set-version</command> or
+ <command>--dirname</command>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
<option>--show-depends</option>
</term>
<listitem>
diff --git a/tools/depmod.c b/tools/depmod.c
index b1b5874..5cba93b 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -48,6 +48,9 @@ static const char *default_cfg_paths[] = {
NULL
};

+enum LONGOPTS {
+ MODDIR_OPT = 1000,
+};
static const char cmdopts_s[] = "aAb:C:E:F:euqrvnP:wmVh";
static const struct option cmdopts[] = {
{ "all", no_argument, 0, 'a' },
@@ -66,6 +69,7 @@ static const struct option cmdopts[] = {
{ "symbol-prefix", required_argument, 0, 'P' },
{ "warn", no_argument, 0, 'w' },
{ "map", no_argument, 0, 'm' }, /* deprecated */
+ { "moddir", required_argument, 0, MODDIR_OPT },
{ "version", no_argument, 0, 'V' },
{ "help", no_argument, 0, 'h' },
{ }
@@ -94,6 +98,8 @@ 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--moddir=MODDIR Specify a target directory and allow relative\n"
+ "\t paths. Do not use -b or specify a version.\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"
@@ -1045,7 +1051,8 @@ static void depmod_shutdown(struct depmod *depmod)
kmod_unref(depmod->ctx);
}

-static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
+static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod,
+ const char *relpath)
{
const struct cfg *cfg = depmod->cfg;
const char *modname, *lastslash;
@@ -1070,11 +1077,14 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
mod->path = strdup(kmod_module_get_path(kmod));
lastslash = strrchr(mod->path, '/');
mod->baselen = lastslash - mod->path;
- if (strncmp(mod->path, cfg->dirname, cfg->dirnamelen) == 0 &&
- mod->path[cfg->dirnamelen] == '/')
+ if (relpath) {
+ mod->relpath = strdup(relpath);
+ } else if (strncmp(mod->path, cfg->dirname, cfg->dirnamelen) == 0 &&
+ mod->path[cfg->dirnamelen] == '/') {
mod->relpath = mod->path + cfg->dirnamelen + 1;
- else
+ } else {
mod->relpath = NULL;
+ }

err = hash_add_unique(depmod->modules_by_name, mod->modname, mod);
if (err < 0) {
@@ -1082,7 +1092,7 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
goto fail;
}

- if (mod->relpath != NULL) {
+ if (mod->relpath != NULL && !relpath) {
size_t uncrelpathlen = lastslash - mod->relpath + modnamelen
+ kmod_exts[KMOD_EXT_UNC].len;
mod->uncrelpath = memdup(mod->relpath, uncrelpathlen + 1);
@@ -1221,7 +1231,7 @@ add:
return err;
}

- err = depmod_module_add(depmod, kmod);
+ err = depmod_module_add(depmod, kmod, NULL);
if (err < 0) {
ERR("could not add module %s: %s\n",
path, strerror(-err));
@@ -2467,6 +2477,7 @@ static int do_depmod(int argc, char *argv[])
const char *system_map = NULL;
const char *module_symvers = NULL;
const char *null_kmod_config = NULL;
+ const char *moddir = NULL;
struct utsname un;
struct kmod_ctx *ctx = NULL;
struct cfg cfg;
@@ -2540,6 +2551,9 @@ static int do_depmod(int argc, char *argv[])
WRN("Ignored deprecated option -%c\n", c);

break;
+ case MODDIR_OPT:
+ moddir = optarg;
+ break;
case 'h':
help();
free(config_paths);
@@ -2556,7 +2570,14 @@ static int do_depmod(int argc, char *argv[])
}
}

- if (optind < argc && is_version_number(argv[optind])) {
+ if (moddir && root) {
+ ERR("--moddir and -b cannot be used together.\n");
+ goto cmdline_failed;
+ }
+
+ if (moddir) {
+ cfg.kversion = NULL;
+ } else if (optind < argc && is_version_number(argv[optind])) {
cfg.kversion = argv[optind];
optind++;
} else {
@@ -2567,9 +2588,20 @@ static int do_depmod(int argc, char *argv[])
cfg.kversion = un.release;
}

- cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
- "%s/lib/modules/%s",
- root == NULL ? "" : root, cfg.kversion);
+ if (moddir) {
+ if (chdir(moddir) != 0) {
+ CRIT("chdir(%s): %s\n", moddir, strerror(errno));
+ goto cmdline_failed;
+ }
+
+ strcpy(cfg.dirname, ".");
+ cfg.dirnamelen = 1;
+ } else {
+ cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
+ "%s/lib/modules/%s",
+ root == NULL ? "" : root,
+ cfg.kversion);
+ }

if (optind == argc)
all = 1;
@@ -2638,7 +2670,7 @@ static int do_depmod(int argc, char *argv[])
const char *path = argv[i];
struct kmod_module *mod;

- if (path[0] != '/') {
+ if (path[0] != '/' && !moddir) {
CRIT("%s: not absolute path.\n", path);
goto cmdline_modules_failed;
}
@@ -2650,7 +2682,7 @@ static int do_depmod(int argc, char *argv[])
goto cmdline_modules_failed;
}

- err = depmod_module_add(&depmod, mod);
+ err = depmod_module_add(&depmod, mod, path);
if (err < 0) {
CRIT("could not add module %s: %s\n",
path, strerror(-err));
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 6b34658..b6d8693 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -56,6 +56,9 @@ static int strip_vermagic = 0;
static int remove_dependencies = 0;
static int quiet_inuse = 0;

+enum LONGOPTS {
+ MODDIR_OPT = 1000,
+};
static const char cmdopts_s[] = "arRibfDcnC:d:S:sqvVh";
static const struct option cmdopts[] = {
{"all", no_argument, 0, 'a'},
@@ -82,6 +85,7 @@ static const struct option cmdopts[] = {
{"config", required_argument, 0, 'C'},
{"dirname", required_argument, 0, 'd'},
{"set-version", required_argument, 0, 'S'},
+ {"moddir", required_argument, 0, MODDIR_OPT},

{"syslog", no_argument, 0, 's'},
{"quiet", no_argument, 0, 'q'},
@@ -131,6 +135,8 @@ static void help(void)
"\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-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
+ "\t--moddir=MODDIR Specify a target directory and allow\n"
+ "\t relative paths. Do not use with -d or -s.\n"

"\t-s, --syslog print to syslog, not stderr\n"
"\t-q, --quiet disable messages\n"
@@ -749,6 +755,7 @@ static int do_modprobe(int argc, char **orig_argv)
const char *dirname = NULL;
const char *root = NULL;
const char *kversion = NULL;
+ const char *moddir = NULL;
int use_all = 0;
int do_remove = 0;
int do_show_config = 0;
@@ -835,6 +842,9 @@ static int do_modprobe(int argc, char **orig_argv)
case 'S':
kversion = optarg;
break;
+ case MODDIR_OPT:
+ moddir = optarg;
+ break;
case 's':
env_modprobe_options_append("-s");
use_syslog = 1;
@@ -878,8 +888,14 @@ static int do_modprobe(int argc, char **orig_argv)
}
}

+ if (moddir != NULL)
+ dirname = moddir;
if (root != NULL || kversion != NULL) {
struct utsname u;
+ if (moddir != NULL) {
+ ERR("--moddir cannot be used with -d or -S.\n");
+ goto done;
+ }
if (root == NULL)
root = "";
if (kversion == NULL) {
--
1.8.5.3
Andy Lutomirski
2014-03-08 19:47:58 UTC
Permalink
Post by Andy Lutomirski
Currently, depmod and modprobe can only use directories of the form
ROOT/lib/modules/VERSION, where ROOT and VERSION can be specified on
the command line. Additionally, when used with explicitly-listed
modules depmod requires absolute paths, making it difficult to
generate a nonstandard module layout without symlink hacks and
absolute paths.
This lifts both restrictions with a new --moddir option. --moddir
specifies an exact directory name and, when --moddir is used, depmod
will accept relative module paths on the command line.
Will an approach like this be okay (possibly with further changes) or
do I need to find some hack to get existing depmod and modprobe
binaries to work?

--Andy
Andy Lutomirski
2014-04-08 19:37:23 UTC
Permalink
Post by Andy Lutomirski
Post by Andy Lutomirski
Currently, depmod and modprobe can only use directories of the form
ROOT/lib/modules/VERSION, where ROOT and VERSION can be specified on
the command line. Additionally, when used with explicitly-listed
modules depmod requires absolute paths, making it difficult to
generate a nonstandard module layout without symlink hacks and
absolute paths.
This lifts both restrictions with a new --moddir option. --moddir
specifies an exact directory name and, when --moddir is used, depmod
will accept relative module paths on the command line.
Will an approach like this be okay (possibly with further changes) or
do I need to find some hack to get existing depmod and modprobe
binaries to work?
Hi-

A quick ping on this, now that kmod 17 is out :)

Thanks,
Andy
Lucas De Marchi
2014-04-29 12:33:36 UTC
Permalink
Hi Andy,

sorry for taking so long to reply
Post by Andy Lutomirski
Currently, depmod and modprobe can only use directories of the form
ROOT/lib/modules/VERSION, where ROOT and VERSION can be specified on
the command line. Additionally, when used with explicitly-listed
modules depmod requires absolute paths, making it difficult to
generate a nonstandard module layout without symlink hacks and
absolute paths.
This lifts both restrictions with a new --moddir option. --moddir
specifies an exact directory name and, when --moddir is used, depmod
will accept relative module paths on the command line.
---
First the reasoning why we still don't have something like this:

I was trying to avoid adding new options to modprobe/depmod. My hope
was to finish the tool interface so they could share command options.
It's already a mess between modprobe and depmod (--dirname vs
--basedir, -S vs positional arg).

And now a new option... incompatible with the previous 2 to operate in
the same string.

However I realize the usefulness of this option. It's intended for
people developing modules, right? So you don't have to install it and
can run depmod/modprobe on the local dir. What if you depend on
another module? That dependency won't be satisfied and you will need
to start copying other modules to your "staging" dir. Is this really
the use-case? I can't imagine another one.


About the patch, I think it's a bit intrusive. It should just operate
on the base prefix like --dirname does. Why does it need to do so many
things like copying strings around, changing dir, etc? See below.
Post by Andy Lutomirski
man/depmod.xml | 29 +++++++++++++++++++++++++++++
man/modprobe.xml | 18 ++++++++++++++++++
tools/depmod.c | 56 ++++++++++++++++++++++++++++++++++++++++++++------------
tools/modprobe.c | 16 ++++++++++++++++
4 files changed, 107 insertions(+), 12 deletions(-)
[ ... ]
Post by Andy Lutomirski
diff --git a/tools/depmod.c b/tools/depmod.c
index b1b5874..5cba93b 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -48,6 +48,9 @@ static const char *default_cfg_paths[] = {
NULL
};
+enum LONGOPTS {
+ MODDIR_OPT = 1000,
+};
static const char cmdopts_s[] = "aAb:C:E:F:euqrvnP:wmVh";
static const struct option cmdopts[] = {
{ "all", no_argument, 0, 'a' },
@@ -66,6 +69,7 @@ static const struct option cmdopts[] = {
{ "symbol-prefix", required_argument, 0, 'P' },
{ "warn", no_argument, 0, 'w' },
{ "map", no_argument, 0, 'm' }, /* deprecated */
+ { "moddir", required_argument, 0, MODDIR_OPT },
{ "version", no_argument, 0, 'V' },
{ "help", no_argument, 0, 'h' },
{ }
@@ -94,6 +98,8 @@ 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--moddir=MODDIR Specify a target directory and allow relative\n"
+ "\t paths. Do not use -b or specify a version.\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"
@@ -1045,7 +1051,8 @@ static void depmod_shutdown(struct depmod *depmod)
kmod_unref(depmod->ctx);
}
-static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
+static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod,
+ const char *relpath)
this parameter should not exist
Post by Andy Lutomirski
{
const struct cfg *cfg = depmod->cfg;
const char *modname, *lastslash;
@@ -1070,11 +1077,14 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
mod->path = strdup(kmod_module_get_path(kmod));
lastslash = strrchr(mod->path, '/');
mod->baselen = lastslash - mod->path;
- if (strncmp(mod->path, cfg->dirname, cfg->dirnamelen) == 0 &&
- mod->path[cfg->dirnamelen] == '/')
cfg->dirname should rather contain the right prefix already, so this
change wouldn't be needed.
Post by Andy Lutomirski
+ if (relpath) {
+ mod->relpath = strdup(relpath);
Because of the way you passed relpath in, here you leak mod->relpath.
In the "else if" below we just point mod->relpath to the right portion
of the string, we don't copy it.
Post by Andy Lutomirski
+ } else if (strncmp(mod->path, cfg->dirname, cfg->dirnamelen) == 0 &&
+ mod->path[cfg->dirnamelen] == '/') {
mod->relpath = mod->path + cfg->dirnamelen + 1;
- else
+ } else {
mod->relpath = NULL;
+ }
err = hash_add_unique(depmod->modules_by_name, mod->modname, mod);
if (err < 0) {
@@ -1082,7 +1092,7 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
goto fail;
}
- if (mod->relpath != NULL) {
+ if (mod->relpath != NULL && !relpath) {
size_t uncrelpathlen = lastslash - mod->relpath + modnamelen
+ kmod_exts[KMOD_EXT_UNC].len;
mod->uncrelpath = memdup(mod->relpath, uncrelpathlen + 1);
return err;
}
- err = depmod_module_add(depmod, kmod);
+ err = depmod_module_add(depmod, kmod, NULL);
so this only work for modules in the command line? Confusing, I
thought you wanted something like:

depmod -a --moddir .

And let depmod do its job on the local dir instead of $root/lib/modules/$kver
Post by Andy Lutomirski
if (err < 0) {
ERR("could not add module %s: %s\n",
path, strerror(-err));
@@ -2467,6 +2477,7 @@ static int do_depmod(int argc, char *argv[])
const char *system_map = NULL;
const char *module_symvers = NULL;
const char *null_kmod_config = NULL;
+ const char *moddir = NULL;
struct utsname un;
struct kmod_ctx *ctx = NULL;
struct cfg cfg;
@@ -2540,6 +2551,9 @@ static int do_depmod(int argc, char *argv[])
WRN("Ignored deprecated option -%c\n", c);
break;
+ moddir = optarg;
+ break;
help();
free(config_paths);
@@ -2556,7 +2570,14 @@ static int do_depmod(int argc, char *argv[])
}
}
- if (optind < argc && is_version_number(argv[optind])) {
+ if (moddir && root) {
+ ERR("--moddir and -b cannot be used together.\n");
+ goto cmdline_failed;
+ }
+
+ if (moddir) {
+ cfg.kversion = NULL;
+ } else if (optind < argc && is_version_number(argv[optind])) {
cfg.kversion = argv[optind];
optind++;
} else {
@@ -2567,9 +2588,20 @@ static int do_depmod(int argc, char *argv[])
cfg.kversion = un.release;
}
- cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
- "%s/lib/modules/%s",
- root == NULL ? "" : root, cfg.kversion);
+ if (moddir) {
+ if (chdir(moddir) != 0) {
+ CRIT("chdir(%s): %s\n", moddir, strerror(errno));
+ goto cmdline_failed;
+ }
why? just set cfg.dirname and it should work
Post by Andy Lutomirski
+
+ strcpy(cfg.dirname, ".");
+ cfg.dirnamelen = 1;
+ } else {
+ cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
+ "%s/lib/modules/%s",
IMO this is the string you should be changing, to allow for anything else
--
Lucas De Marchi
Loading...