aboutsummaryrefslogtreecommitdiff
path: root/core/busybox/patches/modprobe-kernel-version.patch
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-04-23 00:35:57 +0300
committerCem Keylan <cem@ckyln.com>2020-04-23 00:35:57 +0300
commit4d00567bf269b7e5cd2bc53b45c9282a726eaaa1 (patch)
tree9653616716f9add193e2c0399e378dd99983506c /core/busybox/patches/modprobe-kernel-version.patch
parent6685001a647c8810802c4fdab3279909a7d58ef1 (diff)
downloadrepository-4d00567bf269b7e5cd2bc53b45c9282a726eaaa1.tar.gz
busybox: apply patches
Diffstat (limited to 'core/busybox/patches/modprobe-kernel-version.patch')
-rw-r--r--core/busybox/patches/modprobe-kernel-version.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/core/busybox/patches/modprobe-kernel-version.patch b/core/busybox/patches/modprobe-kernel-version.patch
new file mode 100644
index 00000000..2d4274ad
--- /dev/null
+++ b/core/busybox/patches/modprobe-kernel-version.patch
@@ -0,0 +1,71 @@
+diff --git a/modutils/modprobe.c b/modutils/modprobe.c
+index 0a372a049..ecb29a8fd 100644
+--- a/modutils/modprobe.c
++++ b/modutils/modprobe.c
+@@ -111,7 +111,7 @@
+ //usage: " from the command line\n"
+ //usage:
+ //usage:#define modprobe_trivial_usage
+-//usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]"
++//usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]" " [-S VERSION]"
+ //usage: " MODULE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...")
+ //usage:#define modprobe_full_usage "\n\n"
+ //usage: " -a Load multiple MODULEs"
+@@ -121,6 +121,7 @@
+ //usage: "\n -v Verbose"
+ //usage: "\n -s Log to syslog"
+ //usage: "\n -D Show dependencies"
++//usage: "\n -S Set kernel version"
+ //usage: IF_FEATURE_MODPROBE_BLACKLIST(
+ //usage: "\n -b Apply blacklist to module names too"
+ //usage: )
+@@ -131,7 +132,7 @@
+ * Note2: -b is always accepted, but if !FEATURE_MODPROBE_BLACKLIST,
+ * it is a no-op.
+ */
+-#define MODPROBE_OPTS "alrDb"
++#define MODPROBE_OPTS "alrDS:b"
+ /* -a and -D _are_ in fact compatible */
+ #define MODPROBE_COMPLEMENTARY "q-v:v-q:l--arD:r--alD:a--lr:D--rl"
+ //#define MODPROBE_OPTS "acd:lnrt:C:b"
+@@ -147,7 +148,8 @@ enum {
+ //OPT_VERONLY = (INSMOD_OPT_UNUSED << x), /* V */
+ //OPT_CONFIGFILE = (INSMOD_OPT_UNUSED << x), /* C */
+ OPT_SHOW_DEPS = (INSMOD_OPT_UNUSED << 3), /* D */
+- OPT_BLACKLIST = (INSMOD_OPT_UNUSED << 4) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
++ OPT_KERNEL = (INSMOD_OPT_UNUSED << 4), /* S */
++ OPT_BLACKLIST = (INSMOD_OPT_UNUSED << 5) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
+ };
+ #if ENABLE_LONG_OPTS
+ static const char modprobe_longopts[] ALIGN1 =
+@@ -560,6 +562,7 @@ int modprobe_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+ {
+ int rc;
++ char *kernel;
+ unsigned opt;
+ struct module_entry *me;
+
+@@ -567,13 +570,20 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+
+ opt = getopt32long(argv, "^" INSMOD_OPTS MODPROBE_OPTS "\0" MODPROBE_COMPLEMENTARY,
+ modprobe_longopts
+- INSMOD_ARGS
++ INSMOD_ARGS,
++ &kernel
+ );
+ argv += optind;
+
++ /* Set user specified kernel version */
++ if (opt & OPT_KERNEL) {
++ safe_strncpy(G.uts.release, kernel, sizeof(G.uts.release));
++ } else {
++ uname(&G.uts);
++ }
++
+ /* Goto modules location */
+ xchdir(CONFIG_DEFAULT_MODULES_DIR);
+- uname(&G.uts);
+ xchdir(G.uts.release);
+
+ if (opt & OPT_LIST_ONLY) { \ No newline at end of file