From eed7d2798ce7b78547106d0c3557a88251b413d0 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 25 Apr 2008 20:13:30 +0200 Subject: kbuild: error out on missing MODULE_LICENSE Adrian Bunk suggested a build time check for missing MODULE_LICENSE annotation in modules. The build time check is fatal as we really want this fixed for all modules. In-tree modules should all have been fixed up by now. Signed-off-by: Sam Ravnborg Cc: Adrian Bunk --- scripts/mod/modpost.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 110cf243fa4..843f6fa517c 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1552,6 +1552,10 @@ static void read_symbols(char *modname) } license = get_modinfo(info.modinfo, info.modinfo_len, "license"); + if (!license && !is_vmlinux(modname)) + fatal("modpost: missing MODULE_LICENSE() in %s\n" + "see include/linux/module.h for " + "more information\n", modname); while (license) { if (license_is_gpl_compatible(license)) mod->gpl_compatible = 1; -- cgit v1.2.3 From 3156fd0529b5216f4f444f4a7752b82dc1bd99c0 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Mon, 18 Feb 2008 04:48:20 -0500 Subject: kbuild: fix some minor typoes Signed-off-by: Robert P. J. Day Signed-off-by: Sam Ravnborg --- scripts/Makefile.build | 6 +++--- scripts/Makefile.clean | 2 +- scripts/Makefile.host | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 67fb4530a6f..277cfe0b710 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -27,12 +27,12 @@ ccflags-y := cppflags-y := ldflags-y := -# Read .config if it exist, otherwise ignore +# Read auto.conf if it exists, otherwise ignore -include include/config/auto.conf include scripts/Kbuild.include -# For backward compatibility check that these variables does not change +# For backward compatibility check that these variables do not change save-cflags := $(CFLAGS) # The filename Kbuild has precedence over Makefile @@ -55,7 +55,7 @@ hostprogs-y += $(host-progs) endif endif -# Do not include host rules unles needed +# Do not include host rules unless needed ifneq ($(hostprogs-y)$(hostprogs-m),) include scripts/Makefile.host endif diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 2c647107c9c..6f89fbb5625 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -37,7 +37,7 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) -# build a list of files to remove, usually releative to the current +# build a list of files to remove, usually relative to the current # directory __clean-files := $(extra-y) $(always) \ diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 6943a7a5bb9..1ac414fd503 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -3,9 +3,9 @@ # Binaries are used during the compilation of the kernel, for example # to preprocess a data file. # -# Both C and C++ is supported, but preferred language is C for such utilities. +# Both C and C++ are supported, but preferred language is C for such utilities. # -# Samle syntax (see Documentation/kbuild/makefile.txt for reference) +# Sample syntax (see Documentation/kbuild/makefiles.txt for reference) # hostprogs-y := bin2hex # Will compile bin2hex.c and create an executable named bin2hex # @@ -23,10 +23,10 @@ # hostprogs-y := conf # conf-objs := conf.o libkconfig.so # libkconfig-objs := expr.o type.o -# Will create a shared library named libkconfig.so that consist of -# expr.o and type.o (they are both compiled as C code and the object file +# Will create a shared library named libkconfig.so that consists of +# expr.o and type.o (they are both compiled as C code and the object files # are made as position independent code). -# conf.c is compiled as a c program, and conf.o is linked together with +# conf.c is compiled as a C program, and conf.o is linked together with # libkconfig.so as the executable conf. # Note: Shared libraries consisting of C++ files are not supported @@ -61,7 +61,7 @@ host-cobjs := $(filter-out %.so,$(host-cobjs)) host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) # output directory for programs/.o files -# hostprogs-y := tools/build may have been specified. Retreive directory +# hostprogs-y := tools/build may have been specified. Retrieve directory host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) # directory of .o files from prog-objs notation host-objdirs += $(foreach f,$(host-cmulti), \ -- cgit v1.2.3 From 2d04b5ae1bf527201a7505c9be7526c43ebd2930 Mon Sep 17 00:00:00 2001 From: Richard Hacker Date: Thu, 28 Feb 2008 09:40:52 +0100 Subject: kbuild: support loading extra symbols in modpost This patch adds a new command line option -E to modpost, expecting a symbol file as an argument which is read prior to symbol processing. -E can be supplied multiple times for as many files as is needed. 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 This situation occurs when modpost processes the new module's symbols. When it finds symbols not exported by the mainline kernel, it issues this warning. The patch adds a new command line option -e to modpost which expects a symbol file as an argument. The symbols listed in this file are added to modpost's symbol tables during startup. -e can be supplied as often as required. This patch works together with the second patch. It introduces a new make variable, KBUILD_EXTRA_SYMBOLS, which is used when calling modpost. Signed-off-by: Richard Hacker Signed-off-by: Sam Ravnborg --- scripts/mod/modpost.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 843f6fa517c..f8b42ab0724 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2019,6 +2019,11 @@ static void write_markers(const char *fname) write_if_changed(&buf, fname); } +struct ext_sym_list { + struct ext_sym_list *next; + const char *file; +}; + int main(int argc, char **argv) { struct module *mod; @@ -2029,8 +2034,10 @@ int main(int argc, char **argv) char *markers_write = NULL; int opt; int err; + struct ext_sym_list *extsym_iter; + struct ext_sym_list *extsym_start = NULL; - while ((opt = getopt(argc, argv, "i:I:cmsSo:awM:K:")) != -1) { + while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:")) != -1) { switch (opt) { case 'i': kernel_read = optarg; @@ -2042,6 +2049,14 @@ int main(int argc, char **argv) case 'c': cross_build = 1; break; + case 'e': + external_module = 1; + extsym_iter = + NOFAIL(malloc(sizeof(*extsym_iter))); + extsym_iter->next = extsym_start; + extsym_iter->file = optarg; + extsym_start = extsym_iter; + break; case 'm': modversions = 1; break; @@ -2075,6 +2090,12 @@ int main(int argc, char **argv) read_dump(kernel_read, 1); if (module_read) read_dump(module_read, 0); + while (extsym_start) { + read_dump(extsym_start->file, 0); + extsym_iter = extsym_start->next; + free(extsym_start); + extsym_start = extsym_iter; + } while (optind < argc) read_symbols(argv[optind++]); -- cgit v1.2.3 From 0d96fb20b7ed757fc936bb35e26c22251a75b734 Mon Sep 17 00:00:00 2001 From: Richard Hacker Date: Thu, 28 Feb 2008 09:40:58 +0100 Subject: kbuild: Add new Kbuild variable KBUILD_EXTRA_SYMBOLS This patch adds a new (Kbuild) Makefile variable KBUILD_EXTRA_SYMBOLS. The space separated list of file names assigned to KBUILD_EXTRA_SYMBOLS is used when calling scripts/mod/modpost during stage 2 of the Kbuild process for non-kernel-tree modules. Signed-off-by: Richard Hacker Signed-off-by: Sam Ravnborg --- scripts/Makefile.modpost | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts') diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 2d20640854b..24b3c8fe6bc 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -42,6 +42,13 @@ _modpost: __modpost include include/config/auto.conf include scripts/Kbuild.include + +ifneq ($(KBUILD_EXTMOD),) +# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS +include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ + $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) +endif + include scripts/Makefile.lib kernelsymfile := $(objtree)/Module.symvers @@ -69,6 +76,7 @@ modpost = scripts/mod/modpost \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ + $(if $(iKBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ -- cgit v1.2.3