[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMP44s1gZKKO_BPDcKzsk3hd4ob=S=6UuE0GE6JwwSjC0YSajw@mail.gmail.com>
Date: Sat, 10 Dec 2011 06:08:44 +0200
From: Felipe Contreras <felipe.contreras@...il.com>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Is there something like MODULE_DEPEND?
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists