Package: busybox / 1:1.22.0-19

modprobe-read-modules-builtin.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Ben Hutchings <ben@decadent.org.uk>
Subject: modprobe: Read modules.builtin
Bug-Debian: http://bugs.debian.org/652672

This allows explicit probing to succeed when the requested module
is actually built-in, and corrects the error message for removal.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -146,6 +146,7 @@ static const char modprobe_longopts[] AL
 /* "was seen in modules.dep": */
 #define MODULE_FLAG_FOUND_IN_MODDEP     0x0004
 #define MODULE_FLAG_BLACKLISTED         0x0008
+#define MODULE_FLAG_BUILTIN             0x0010
 
 struct module_entry { /* I'll call it ME. */
 	unsigned flags;
@@ -240,7 +241,7 @@ static void add_probe(const char *name)
 
 	m = get_or_add_modentry(name);
 	if (!(option_mask32 & (OPT_REMOVE | OPT_SHOW_DEPS))
-	 && (m->flags & MODULE_FLAG_LOADED)
+	 && (m->flags & (MODULE_FLAG_LOADED | MODULE_FLAG_BUILTIN))
 	) {
 		DBG("skipping %s, it is already loaded", name);
 		return;
@@ -394,8 +395,10 @@ static int do_modprobe(struct module_ent
 
 	if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) {
 		if (!(option_mask32 & INSMOD_OPT_SILENT))
-			bb_error_msg("module %s not found in modules.dep",
-				humanly_readable_name(m));
+			bb_error_msg((m->flags & MODULE_FLAG_BUILTIN) ?
+				     "module %s is builtin" :
+				     "module %s not found in modules.dep",
+				     humanly_readable_name(m));
 		return -ENOENT;
 	}
 	DBG("do_modprob'ing %s", m->modname);
@@ -595,6 +598,11 @@ int modprobe_main(int argc UNUSED_PARAM,
 		while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL & ~PARSE_GREEDY))
 			get_or_add_modentry(s)->flags |= MODULE_FLAG_LOADED;
 		config_close(parser);
+
+		parser = config_open2("modules.builtin", fopen_for_read);
+		while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL))
+			get_or_add_modentry(s)->flags |= MODULE_FLAG_BUILTIN;
+		config_close(parser);
 	}
 
 	if (opt & (OPT_INSERT_ALL | OPT_REMOVE)) {