Skip to contentSkip to conversation

kbuild: Improved external module support

PATCH New Sam Ravnborg 1 participant 1 message Apr 20, 2004 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: Improved external module support

The external module support recently introduced caused a number of problems:
- To build an external module the Module.symvers file was needed
- To create the Module.symvers file a module was required
- If Module.symvers was missing kbuild boiled out with an error
- If vmlinux was missing also the stage 2 of module build failed (make -k)
- It was not documented what was needed to actually bauild a module

The following patch addresses this by adding the following functionality:
- Always generate the Module.symvers file
- Ignore a missing Module.symvers file
- Add a new target modules_prepare, it prepares the kernel for building external modules, and is also usefull with O=
- And it adds some more comments to Makefile.modpost, so others may follow it with some luck
- .modpost.cmd is no longer generated

This should close all reports on issues with respect to building external modules with current kernel - which has been identified as kernel problems.

Sam

===== Makefile 1.480 vs edited =====

Makefile +5 -1
@@ -715,8 +715,12 @@
 	@echo '  Building modules, stage 2.';
 	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
 
-#	Install modules
 
+# Target to prepare building external modules
+.PHONY: modules_prepare
+modules_prepare: prepare-all scripts
+
+# Target to install modules
 .PHONY: modules_install
 modules_install: _modinst_ _modinst_post
 

===== scripts/Makefile.modpost 1.9 vs edited =====

scripts/Makefile.modpost +58 -28

115 lines not on this page · raw message

===== scripts/modpost.c 1.27 vs edited =====

scripts/modpost.c +3 -4
@@ -625,10 +625,9 @@
 	void *file = grab_file(fname, &size);
 	char *line;
 
-        if (!file) {
-                perror(fname);
-                abort();
-        }
+        if (!file)
+		/* No symbol versions, silently ignore */
+		return;
 
 	while ((line = get_next_line(&pos, file, size))) {
 		char *symname, *modname, *d;