X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/a656395fe8018b9cdc0432a53e551a3af890b698..de50d6624ffd8250930462e43163bdec1747a999:/package/busybox/patches/470-insmod_search.patch diff --git a/package/busybox/patches/470-insmod_search.patch b/package/busybox/patches/470-insmod_search.patch index 022ca24e6..7f0188fc8 100644 --- a/package/busybox/patches/470-insmod_search.patch +++ b/package/busybox/patches/470-insmod_search.patch @@ -1,6 +1,17 @@ +--- a/modutils/Config.src ++++ b/modutils/Config.src +@@ -247,7 +247,7 @@ config FEATURE_MODUTILS_SYMBOLS + config DEFAULT_MODULES_DIR + string "Default directory containing modules" + default "/lib/modules" +- depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO ++ depends on DEPMOD || INSMOD || MODPROBE || MODPROBE_SMALL || MODINFO + help + Directory that contains kernel modules. + Defaults to "/lib/modules" --- a/modutils/insmod.c +++ b/modutils/insmod.c -@@ -9,6 +9,99 @@ +@@ -11,6 +11,106 @@ #include "libbb.h" #include "modutils.h" @@ -37,20 +48,27 @@ + char *module_dir, real_module_dir[FILENAME_MAX]; + int len, slen, ret = ENOENT, k_version; + struct utsname myuname; -+ const char *suffix; ++ const char *suffix = ".ko"; + struct stat st; + + /* check the kernel version */ -+ if ((uname(&myuname) != 0) || (myuname.release[0] != '2')) ++ if (uname(&myuname) != 0) ++ return EINVAL; ++ ++ k_version = myuname.release[0] - '0'; ++ ++ if (k_version < 2 || k_version > 9) + return EINVAL; + -+ k_version = myuname.release[2] - '0'; ++ if (k_version == 2) { ++ int k_patchlevel = myuname.release[2] - '0'; ++ if (k_patchlevel <= 4) +#if ENABLE_FEATURE_2_4_MODULES -+ if (k_version <= 4) -+ suffix = ".o"; -+ else ++ suffix = ".o"; ++#else ++ return EINVAL; +#endif -+ suffix = ".ko"; ++ } + + len = strlen(filename); + slen = strlen(suffix); @@ -98,18 +116,18 @@ + return ret; +} - int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; - int insmod_main(int argc UNUSED_PARAM, char **argv) -@@ -33,9 +126,15 @@ int insmod_main(int argc UNUSED_PARAM, c + /* 2.6 style insmod has no options and required filename + * (not module name - .ko can't be omitted) */ +@@ -58,9 +158,15 @@ int insmod_main(int argc UNUSED_PARAM, c if (!filename) bb_show_usage(); -- rc = bb_init_module(filename, parse_cmdline_module_options(argv)); +- rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0)); + rc = find_module(filename); + if (rc || (g_filename == NULL)) -+ goto done; ++ goto done; + -+ rc = bb_init_module(g_filename, parse_cmdline_module_options(argv)); ++ rc = bb_init_module(g_filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0)); if (rc) bb_error_msg("can't insert '%s': %s", filename, moderror(rc)); + free (g_filename); @@ -117,14 +135,3 @@ +done: return rc; } ---- a/modutils/Config.in -+++ b/modutils/Config.in -@@ -210,7 +210,7 @@ config FEATURE_MODUTILS_SYMBOLS - config DEFAULT_MODULES_DIR - string "Default directory containing modules" - default "/lib/modules" -- depends on DEPMOD || MODPROBE || MODPROBE_SMALL -+ depends on DEPMOD || INSMOD || MODPROBE || MODPROBE_SMALL - help - Directory that contains kernel modules. - Defaults to "/lib/modules"