Is there something like MODULE_DEPEND?
From: Felipe Contreras
Date: Fri Dec 09 2011 - 23:08:54 EST
Hi,
So I've finally found that my problem was that I have to load module
B, before loading module A. The dependency is in the Kconfig file, but
module A doesn't use any symbols from module B, so it's not
automatically loaded.
Apparently FreeBSD has a macro named MODULE_DEPEND for that, which
would make sense.
After reading some code, it seems to me that there's no easy way to
achieve this, as by default there are no symbols that can be found by
modpost, so something like this is needed:
const const char *module_b;
EXPORT_SYMBOL(module_b);
note: KBUILD_MODNAME can't be used.
And then, use it in module A:
extern const char *module_b;
static const char **test __used = &module_b;
But ultimately, all we want is to add "module_b" to the "depends"
field in the .modinfo section. It should be relatively easy to achieve
by having a special section modpost can detect, and then just put it
into "depends".
Apparently I'm not the first one to have this need[1], but I wonder
why not more people have it.
Cheers.
[1] http://article.gmane.org/gmane.linux.kernel/1183905/match=module_depend
--
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/