Skip to contentSkip to conversation

KBUILD: prevent building modules that wont load

PATCH In review Ram Pai 1 participant 1 message May 10, 2006 Kbuild

lore
Share & tools
lore

Ram Pai

author
#0 lore raw

PATCH 3/4 KBUILD: prevent building modules that wont load

From: Andreas Gruenbacher <[email protected]>

Implements license compliance testing in modpost. This prevents kbuild from producing modules that won't load.

 include/linux/license.h |   14 ++++++++++
 kernel/module.c         |   11 --------
 scripts/mod/modpost.c   |   62 ++++++++++++++++++++++++++++++++++++++++++++++--
 scripts/mod/modpost.h   |    1 
 4 files changed, 76 insertions(+), 12 deletions(-)
include/linux/license.h new file +14 -0
Index: linux-2.6.17-rc3/include/linux/license.h
===================================================================
@@ -0,0 +1,14 @@
+#ifndef __LICENSE_H
+#define __LICENSE_H
+
+static inline int license_is_gpl_compatible(const char *license)
+{
+	return (strcmp(license, "GPL") == 0
+		|| strcmp(license, "GPL v2") == 0
+		|| strcmp(license, "GPL and additional rights") == 0
+		|| strcmp(license, "Dual BSD/GPL") == 0
+		|| strcmp(license, "Dual MIT/GPL") == 0
+		|| strcmp(license, "Dual MPL/GPL") == 0);
+}
+
+#endif
kernel/module.c +1 -10
Index: linux-2.6.17-rc3/kernel/module.c
===================================================================
@@ -43,6 +43,7 @@
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 #include <asm/cacheflush.h>
+#include <linux/license.h>
 
 #if 0
 #define DEBUGP printk
@@ -1248,16 +1249,6 @@ static void layout_sections(struct modul
 	}
 }
 
-static inline int license_is_gpl_compatible(const char *license)
-{
-	return (strcmp(license, "GPL") == 0
-		|| strcmp(license, "GPL v2") == 0
-		|| strcmp(license, "GPL and additional rights") == 0
-		|| strcmp(license, "Dual BSD/GPL") == 0
-		|| strcmp(license, "Dual MIT/GPL") == 0
-		|| strcmp(license, "Dual MPL/GPL") == 0);
-}
-
 static void set_license(struct module *mod, const char *license)
 {
 	if (!license)
scripts/mod/modpost.c +60 -2

115 lines not on this page · raw message

scripts/mod/modpost.h +1 -0
Index: linux-2.6.17-rc3/scripts/mod/modpost.h
===================================================================
@@ -81,6 +81,7 @@ buf_write(struct buffer *buf, const char
 struct module {
 	struct module *next;
 	const char *name;
+	int gpl_compatible;
 	struct symbol *unres;
 	int seen;
 	int skip;