From: Richard Hacker <[EMAIL PROTECTED]> This patch adds a new command line option -E to modpost, expecting a comma separated list of additional files as an argument whose symbols should be read before processing. Passing EXTRA_SYMBOLS on the make command line will then call modpost with this symbol list.
Signed-off-by: Richard Hacker <[EMAIL PROTECTED]> --- When building kernel modules that depend on other modules not in the main kernel tree, modpost complains about undefined symbols: # make -C /path/to/linux/kernel M=/path/to/my/module ... Building modules, stage 2. .... WARNING: "rt_copy_buf" [/home/rich/osc_etl_rtw/osc_kmod.ko] undefined! ...etc I have written this small patch allowing developers to supply a list of symbol files to make which modpost then reads before processing the current module, thus not generating these annoying warnings. The patch adds a new command line option -E to modpost which expects a comma separated list of additional files whose symbols should be read. scripts/Makefile.modpost is also extended to accept the variable EXTRA_SYMBOLS, which in turn calls modpost with the -E argument. Therefore it is possible to supply the list during the make process make -C /path/to/linux/kernel M=/path/to/my/module \ EXTRA_SYMBOLS=/extra/modules/Modules.symvers,/another/Modules.symvers I was not successful in putting EXTRA_SYMBOLS living aside EXTRA_CFLAGS, etc. as a make variable into the Kbuild makefile. This is where it would fit best. Maybe someone can contribute this. I hope this patch is useful and finds its way into the kernel. diff -uprN linux-2.6.23-vanilla/scripts/Makefile.modpost linux-2.6.23/scripts/Makefile.modpost --- linux-2.6.23-vanilla/scripts/Makefile.modpost 2008-01-18 22:47:09.000000000 +0100 +++ linux-2.6.23/scripts/Makefile.modpost 2008-02-25 16:54:42.000000000 +0100 @@ -61,6 +61,7 @@ modpost = scripts/mod/modpost $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ + $(if $(EXTRA_SYMBOLS),-E $(EXTRA_SYMBOLS)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) diff -uprN linux-2.6.23-vanilla/scripts/mod/modpost.c linux-2.6.23/scripts/mod/modpost.c --- linux-2.6.23-vanilla/scripts/mod/modpost.c 2008-01-18 22:47:09.000000000 +0100 +++ linux-2.6.23/scripts/mod/modpost.c 2008-02-25 16:53:58.000000000 +0100 @@ -1645,11 +1645,12 @@ int main(int argc, char **argv) struct buffer buf = { }; char fname[SZ]; char *kernel_read = NULL, *module_read = NULL; + char *external_read = NULL, *comma; char *dump_write = NULL; int opt; int err; - while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) { + while ((opt = getopt(argc, argv, "i:I:E:mso:aw")) != -1) { switch(opt) { case 'i': kernel_read = optarg; @@ -1658,6 +1659,10 @@ int main(int argc, char **argv) module_read = optarg; external_module = 1; break; + case 'E': + external_read = optarg; + external_module = 1; + break; case 'm': modversions = 1; break; @@ -1682,6 +1687,13 @@ int main(int argc, char **argv) read_dump(kernel_read, 1); if (module_read) read_dump(module_read, 0); + while (external_read) { + comma = strchr(external_read, ','); + if (comma) + *comma = '\0'; + read_dump(external_read, 0); + external_read = comma ? comma + 1 : NULL; + } while (optind < argc) { read_symbols(argv[optind++]); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/