1 diff --git a/modutils/modprobe.c b/modutils/modprobe.c
2 index 0a372a049..ecb29a8fd 100644
3 --- a/modutils/modprobe.c
4 +++ b/modutils/modprobe.c
6 //usage: " from the command line\n"
8 //usage:#define modprobe_trivial_usage
9 -//usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]"
10 +//usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]" " [-S VERSION]"
11 //usage: " MODULE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...")
12 //usage:#define modprobe_full_usage "\n\n"
13 //usage: " -a Load multiple MODULEs"
15 //usage: "\n -v Verbose"
16 //usage: "\n -s Log to syslog"
17 //usage: "\n -D Show dependencies"
18 +//usage: "\n -S Set kernel version"
19 //usage: IF_FEATURE_MODPROBE_BLACKLIST(
20 //usage: "\n -b Apply blacklist to module names too"
23 * Note2: -b is always accepted, but if !FEATURE_MODPROBE_BLACKLIST,
26 -#define MODPROBE_OPTS "alrDb"
27 +#define MODPROBE_OPTS "alrDS:b"
28 /* -a and -D _are_ in fact compatible */
29 #define MODPROBE_COMPLEMENTARY "q-v:v-q:l--arD:r--alD:a--lr:D--rl"
30 //#define MODPROBE_OPTS "acd:lnrt:C:b"
31 @@ -147,7 +148,8 @@ enum {
32 //OPT_VERONLY = (INSMOD_OPT_UNUSED << x), /* V */
33 //OPT_CONFIGFILE = (INSMOD_OPT_UNUSED << x), /* C */
34 OPT_SHOW_DEPS = (INSMOD_OPT_UNUSED << 3), /* D */
35 - OPT_BLACKLIST = (INSMOD_OPT_UNUSED << 4) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
36 + OPT_KERNEL = (INSMOD_OPT_UNUSED << 4), /* S */
37 + OPT_BLACKLIST = (INSMOD_OPT_UNUSED << 5) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
40 static const char modprobe_longopts[] ALIGN1 =
41 @@ -560,6 +562,7 @@ int modprobe_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
42 int modprobe_main(int argc UNUSED_PARAM, char **argv)
47 struct module_entry *me;
49 @@ -567,13 +570,20 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
51 opt = getopt32long(argv, "^" INSMOD_OPTS MODPROBE_OPTS "\0" MODPROBE_COMPLEMENTARY,
59 + /* Set user specified kernel version */
60 + if (opt & OPT_KERNEL) {
61 + safe_strncpy(G.uts.release, kernel, sizeof(G.uts.release));
66 /* Goto modules location */
67 xchdir(CONFIG_DEFAULT_MODULES_DIR);
69 xchdir(G.uts.release);
71 if (opt & OPT_LIST_ONLY) {