Skip to content

Commit

Permalink
busybox: Add modprobe patch
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanaraps committed Apr 15, 2020
1 parent 086a0c1 commit 240478f
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/busybox/checksums
@@ -1,6 +1,7 @@
d0f940a72f648943c1f2211e0e3117387c31d765137d92bd8284a3fb9752a998 busybox-1.31.1.tar.bz2
09c2f601fec4e5c10664c22f787dafb9424efe219bf826727c356da90dfd60d5 adduser-no-setgid.patch
8d84b1719dca2a751c09072c20cd782a3c47f119a68d35316f89d851daf67b88 fsck-resolve-uuid.patch
0f54301a73af461e8066bc805b48d991cfed513d08a2f036e015b19f97cb424a modprobe-kernel-version.patch
bb5c0067607c1af43248203d1e5d47b77c996a1466f2b4fc367639e18d490f05 .config
b4479adaabffb1fe9af7db676929e8f5f6bbc47869c5309a19056aa66196fbce .config-suid
76978b2b69361d47b3bb314a8a320ca274b2af7339c571be1a19f0e1d8c4da6a acpid.run
Expand Down
71 changes: 71 additions & 0 deletions 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) {
1 change: 1 addition & 0 deletions core/busybox/sources
@@ -1,6 +1,7 @@
https://busybox.net/downloads/busybox-1.31.1.tar.bz2
patches/adduser-no-setgid.patch
patches/fsck-resolve-uuid.patch
patches/modprobe-kernel-version.patch
files/.config
files/.config-suid
files/acpid.run
Expand Down

0 comments on commit 240478f

Please sign in to comment.