From f560422fa079b07a761a572ca4f9cf287c2cc47e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 10 Jan 2017 14:58:54 +0100 Subject: Big cleanup in config help and description Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko --- modutils/Config.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modutils/Config.src') diff --git a/modutils/Config.src b/modutils/Config.src index 84ff34a08..1808f332d 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -133,7 +133,7 @@ config FEATURE_CHECK_TAINTED_MODULE This option is required to support GPLONLY modules. config FEATURE_MODUTILS_ALIAS - bool "Support for module.aliases file" + bool "Support module.aliases file" default y depends on DEPMOD || MODPROBE select PLATFORM_LINUX @@ -150,7 +150,7 @@ config FEATURE_MODUTILS_ALIAS Say Y if unsure. config FEATURE_MODUTILS_SYMBOLS - bool "Support for module.symbols file" + bool "Support module.symbols file" default y depends on DEPMOD || MODPROBE select PLATFORM_LINUX -- cgit v1.2.3-55-g6feb From 065e988e7ae66b3f36d280ed6ca580e29cb6358d Mon Sep 17 00:00:00 2001 From: Kang-Che Sung Date: Mon, 30 Jan 2017 19:14:50 +0100 Subject: modutils: fix config options dependency module.aliases and module.symbols files have no use in modprobe-small implementation. So FEATURE_MODUTILS_ALIAS and FEATURE_MODUTILS_SYMBOLS will depend on !MODPROBE_SMALL. The try_to_mmap_module() function is not called in modprobe-small.c, so I will let FEATURE_INSMOD_TRY_MMAP depend on !MODPROBE_SMALL for now. Signed-off-by: Kang-Che Sung Likewise, FEATURE_2_4_MODULES is not used by modprobe-small. Signed-off-by: Denys Vlasenko --- configs/TEST_nommu_defconfig | 3 --- configs/TEST_rh9_defconfig | 3 --- configs/android2_defconfig | 3 --- configs/android_502_defconfig | 3 --- configs/android_defconfig | 3 --- configs/android_ndk_defconfig | 3 --- modutils/Config.src | 8 ++++---- 7 files changed, 4 insertions(+), 22 deletions(-) (limited to 'modutils/Config.src') diff --git a/configs/TEST_nommu_defconfig b/configs/TEST_nommu_defconfig index b7d9a35c2..7fbbbecc7 100644 --- a/configs/TEST_nommu_defconfig +++ b/configs/TEST_nommu_defconfig @@ -452,15 +452,12 @@ CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y # Options common to multiple modutils # # CONFIG_FEATURE_2_4_MODULES is not set -CONFIG_FEATURE_INSMOD_TRY_MMAP=y # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set -# CONFIG_FEATURE_MODUTILS_ALIAS is not set -# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="/lib/modules" CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" diff --git a/configs/TEST_rh9_defconfig b/configs/TEST_rh9_defconfig index 99deb67fe..34d8e31e2 100644 --- a/configs/TEST_rh9_defconfig +++ b/configs/TEST_rh9_defconfig @@ -467,15 +467,12 @@ CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y # Options common to multiple modutils # # CONFIG_FEATURE_2_4_MODULES is not set -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set -# CONFIG_FEATURE_MODUTILS_ALIAS is not set -# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="/lib/modules" CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" diff --git a/configs/android2_defconfig b/configs/android2_defconfig index b079fa759..20866c32b 100644 --- a/configs/android2_defconfig +++ b/configs/android2_defconfig @@ -487,15 +487,12 @@ CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y # Options common to multiple modutils # # CONFIG_FEATURE_2_4_MODULES is not set -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set -# CONFIG_FEATURE_MODUTILS_ALIAS is not set -# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="/lib/modules" CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" diff --git a/configs/android_502_defconfig b/configs/android_502_defconfig index 4273d3382..bdca9eebb 100644 --- a/configs/android_502_defconfig +++ b/configs/android_502_defconfig @@ -597,15 +597,12 @@ CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y # Options common to multiple modutils # # CONFIG_FEATURE_2_4_MODULES is not set -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set -# CONFIG_FEATURE_MODUTILS_ALIAS is not set -# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="/lib/modules" CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" diff --git a/configs/android_defconfig b/configs/android_defconfig index b9489c456..6ef81750e 100644 --- a/configs/android_defconfig +++ b/configs/android_defconfig @@ -511,15 +511,12 @@ CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y # Options common to multiple modutils # # CONFIG_FEATURE_2_4_MODULES is not set -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set -# CONFIG_FEATURE_MODUTILS_ALIAS is not set -# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="/lib/modules" CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" diff --git a/configs/android_ndk_defconfig b/configs/android_ndk_defconfig index caf22e57b..35d03b42e 100644 --- a/configs/android_ndk_defconfig +++ b/configs/android_ndk_defconfig @@ -522,15 +522,12 @@ CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y # Options common to multiple modutils # # CONFIG_FEATURE_2_4_MODULES is not set -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set -# CONFIG_FEATURE_MODUTILS_ALIAS is not set -# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="/system/lib/modules" CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" diff --git a/modutils/Config.src b/modutils/Config.src index 1808f332d..1aee57ee7 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -43,7 +43,7 @@ comment "Options common to multiple modutils" config FEATURE_2_4_MODULES bool "Support version 2.2/2.4 Linux kernels" default n - depends on INSMOD || RMMOD || LSMOD + depends on (INSMOD || RMMOD || LSMOD) && !MODPROBE_SMALL select PLATFORM_LINUX help Support module loading for 2.2.x and 2.4.x Linux kernels. @@ -53,7 +53,7 @@ config FEATURE_2_4_MODULES config FEATURE_INSMOD_TRY_MMAP bool "Try to load module from a mmap'ed area" default n - depends on INSMOD || MODPROBE_SMALL + depends on INSMOD && !MODPROBE_SMALL select PLATFORM_LINUX help This option causes module loading code to try to mmap @@ -135,7 +135,7 @@ config FEATURE_CHECK_TAINTED_MODULE config FEATURE_MODUTILS_ALIAS bool "Support module.aliases file" default y - depends on DEPMOD || MODPROBE + depends on (DEPMOD || MODPROBE) && !MODPROBE_SMALL select PLATFORM_LINUX help Generate and parse modules.alias containing aliases for bus @@ -152,7 +152,7 @@ config FEATURE_MODUTILS_ALIAS config FEATURE_MODUTILS_SYMBOLS bool "Support module.symbols file" default y - depends on DEPMOD || MODPROBE + depends on (DEPMOD || MODPROBE) && !MODPROBE_SMALL select PLATFORM_LINUX help Generate and parse modules.symbols containing aliases for -- cgit v1.2.3-55-g6feb From dc7637d0aa0efeb7cc8a7bcd798f0b5679251ad9 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 1 Feb 2017 01:22:37 +0100 Subject: modprobe-small: improve config help text Signed-off-by: Denys Vlasenko --- modutils/Config.src | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'modutils/Config.src') diff --git a/modutils/Config.src b/modutils/Config.src index 1aee57ee7..a9aa63993 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -10,7 +10,10 @@ config MODPROBE_SMALL default y select PLATFORM_LINUX help - Simplified modutils. + Build smaller (~1.5 kbytes), simplified module tools. + + This option by itself does not enable any applets - + you need to select applets individually below. With this option modprobe does not require modules.dep file and does not use /etc/modules.conf file. @@ -31,11 +34,6 @@ config MODPROBE_SMALL Additional module parameters can be stored in /etc/modules/$module_name files. - Apart from modprobe, other utilities are also provided: - - insmod is an alias to modprobe - - rmmod is an alias to modprobe -r - - depmod generates modules.dep.bb - INSERT comment "Options common to multiple modutils" -- cgit v1.2.3-55-g6feb From 264cb01540cdd995e7c376fd8bcef94e09e31819 Mon Sep 17 00:00:00 2001 From: Kang-Che Sung Date: Wed, 1 Feb 2017 01:43:32 +0100 Subject: modutils: remove redundant "select PLATFORM_LINUX" configs It is enough to have only applets' configs select PLATFORM_LINUX. Signed-off-by: Kang-Che Sung Signed-off-by: Denys Vlasenko --- modutils/Config.src | 11 ----------- modutils/lsmod.c | 1 - modutils/modprobe.c | 1 - 3 files changed, 13 deletions(-) (limited to 'modutils/Config.src') diff --git a/modutils/Config.src b/modutils/Config.src index a9aa63993..f2448c914 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -8,7 +8,6 @@ menu "Linux Module Utilities" config MODPROBE_SMALL bool "Simplified modutils" default y - select PLATFORM_LINUX help Build smaller (~1.5 kbytes), simplified module tools. @@ -42,7 +41,6 @@ config FEATURE_2_4_MODULES bool "Support version 2.2/2.4 Linux kernels" default n depends on (INSMOD || RMMOD || LSMOD) && !MODPROBE_SMALL - select PLATFORM_LINUX help Support module loading for 2.2.x and 2.4.x Linux kernels. This increases size considerably. Say N unless you plan @@ -52,7 +50,6 @@ config FEATURE_INSMOD_TRY_MMAP bool "Try to load module from a mmap'ed area" default n depends on INSMOD && !MODPROBE_SMALL - select PLATFORM_LINUX help This option causes module loading code to try to mmap module first. If it does not work (for example, @@ -69,7 +66,6 @@ config FEATURE_INSMOD_VERSION_CHECKING bool "Enable module version checking" default n depends on FEATURE_2_4_MODULES && (INSMOD || MODPROBE) - select PLATFORM_LINUX help Support checking of versions for modules. This is used to ensure that the kernel and module are made for each other. @@ -78,7 +74,6 @@ config FEATURE_INSMOD_KSYMOOPS_SYMBOLS bool "Add module symbols to kernel symbol table" default n depends on FEATURE_2_4_MODULES && (INSMOD || MODPROBE) - select PLATFORM_LINUX help By adding module symbols to the kernel symbol table, Oops messages occuring within kernel modules can be properly debugged. By enabling @@ -90,7 +85,6 @@ config FEATURE_INSMOD_LOADINKMEM bool "In kernel memory optimization (uClinux only)" default n depends on FEATURE_2_4_MODULES && (INSMOD || MODPROBE) - select PLATFORM_LINUX help This is a special uClinux only memory optimization that lets insmod load the specified kernel module directly into kernel space, reducing @@ -101,7 +95,6 @@ config FEATURE_INSMOD_LOAD_MAP bool "Enable insmod load map (-m) option" default n depends on FEATURE_2_4_MODULES && INSMOD - select PLATFORM_LINUX help Enabling this, one would be able to get a load map output on stdout. This makes kernel module debugging @@ -113,7 +106,6 @@ config FEATURE_INSMOD_LOAD_MAP_FULL bool "Symbols in load map" default y depends on FEATURE_INSMOD_LOAD_MAP && !MODPROBE_SMALL - select PLATFORM_LINUX help Without this option, -m will only output section load map. With this option, -m will also output @@ -123,7 +115,6 @@ config FEATURE_CHECK_TAINTED_MODULE bool "Support tainted module checking with new kernels" default y depends on (LSMOD || FEATURE_2_4_MODULES) && !MODPROBE_SMALL - select PLATFORM_LINUX help Support checking for tainted modules. These are usually binary only modules that will make the linux-kernel list ignore your @@ -134,7 +125,6 @@ config FEATURE_MODUTILS_ALIAS bool "Support module.aliases file" default y depends on (DEPMOD || MODPROBE) && !MODPROBE_SMALL - select PLATFORM_LINUX help Generate and parse modules.alias containing aliases for bus identifiers: @@ -151,7 +141,6 @@ config FEATURE_MODUTILS_SYMBOLS bool "Support module.symbols file" default y depends on (DEPMOD || MODPROBE) && !MODPROBE_SMALL - select PLATFORM_LINUX help Generate and parse modules.symbols containing aliases for symbol_request() kernel calls, such as: diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 9ab49f35b..24e5d35b9 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c @@ -18,7 +18,6 @@ //config: bool "Pretty output" //config: default y //config: depends on LSMOD && !MODPROBE_SMALL -//config: select PLATFORM_LINUX //config: help //config: This option makes output format of lsmod adjusted to //config: the format of module-init-tools for Linux kernel 2.6. diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 09e3de6c3..cbec43888 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -19,7 +19,6 @@ //config: bool "Blacklist support" //config: default y //config: depends on MODPROBE && !MODPROBE_SMALL -//config: select PLATFORM_LINUX //config: help //config: Say 'y' here to enable support for the 'blacklist' command in //config: modprobe.conf. This prevents the alias resolver to resolve -- cgit v1.2.3-55-g6feb From b1d6a2c6247bae0b9f1903ba0e0d16c56f4ef556 Mon Sep 17 00:00:00 2001 From: Kang-Che Sung Date: Tue, 31 Jan 2017 21:09:17 +0800 Subject: cmdline module options can be disabled on "big" modutils Allow module options on command line to be disabled on "big" modutils. Config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is renamed to FEATURE_CMDLINE_MODULE_OPTIONS and no longer depends on !MODPROBE_SMALL (I'm not sure if disabling this is useful on "big" modutils, but at least the macro can serve as a marker and ensure both implementations of same feature have consistent behavior.) Signed-off-by: Kang-Che Sung Signed-off-by: Denys Vlasenko --- modutils/Config.src | 8 ++++++++ modutils/insmod.c | 6 +++--- modutils/modprobe-small.c | 23 ++++++++--------------- modutils/modprobe.c | 8 +++++++- modutils/modutils.c | 2 ++ modutils/modutils.h | 4 ++++ 6 files changed, 32 insertions(+), 19 deletions(-) (limited to 'modutils/Config.src') diff --git a/modutils/Config.src b/modutils/Config.src index f2448c914..a15cce518 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -37,6 +37,14 @@ INSERT comment "Options common to multiple modutils" +config FEATURE_CMDLINE_MODULE_OPTIONS + bool "Accept module options on modprobe command line" + default y + depends on INSMOD || MODPROBE + help + Allow insmod and modprobe take module options from the applets' + command line. + config FEATURE_2_4_MODULES bool "Support version 2.2/2.4 Linux kernels" default n diff --git a/modutils/insmod.c b/modutils/insmod.c index f2c70e16f..8526979eb 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -27,9 +27,9 @@ //usage:#if !ENABLE_MODPROBE_SMALL //usage:#define insmod_trivial_usage -//usage: IF_FEATURE_2_4_MODULES("[OPTIONS] MODULE ") -//usage: IF_NOT_FEATURE_2_4_MODULES("FILE ") -//usage: "[SYMBOL=VALUE]..." +//usage: IF_FEATURE_2_4_MODULES("[OPTIONS] MODULE") +//usage: IF_NOT_FEATURE_2_4_MODULES("FILE") +//usage: IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...") //usage:#define insmod_full_usage "\n\n" //usage: "Load kernel module" //usage: IF_FEATURE_2_4_MODULES( "\n" diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 325f8376b..04242634b 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c @@ -10,13 +10,6 @@ /* config MODPROBE_SMALL is defined in Config.src to ensure better "make config" order */ -//config:config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE -//config: bool "Accept module options on modprobe command line" -//config: default y -//config: depends on MODPROBE_SMALL && (INSMOD || MODPROBE) -//config: help -//config: Allow insmod and modprobe take module options from command line. -//config: //config:config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED //config: bool "Skip loading of already loaded modules" //config: default y @@ -690,7 +683,7 @@ static int rmmod(const char *filename) * NB: also called by depmod with bogus name "/", * just in order to force modprobe.dep.bb creation. */ -#if !ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE +#if !ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS #define process_module(a,b) process_module(a) #define cmdline_options "" #endif @@ -735,7 +728,7 @@ static int process_module(char *name, const char *cmdline_options) options = xmalloc_open_read_close(opt_filename, NULL); if (options) replace(options, '\n', ' '); -#if ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS if (cmdline_options) { /* NB: cmdline_options always have one leading ' ' * (see main()), we remove it here */ @@ -910,7 +903,7 @@ The following options are useful for people managing distributions: //usage:#define depmod_full_usage "" //usage:#define insmod_trivial_usage -//usage: "FILE" IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(" [SYMBOL=VALUE]...") +//usage: "FILE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...") //usage:#define insmod_full_usage "\n\n" //usage: "Load kernel module" @@ -920,7 +913,7 @@ The following options are useful for people managing distributions: //usage: "Unload kernel modules" //usage:#define modprobe_trivial_usage -//usage: "[-rq] MODULE" IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(" [SYMBOL=VALUE]...") +//usage: "[-rq] MODULE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...") //usage:#define modprobe_full_usage "\n\n" //usage: " -r Remove MODULE" //usage: "\n -q Quiet" @@ -934,7 +927,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) int exitcode; #endif struct utsname uts; - IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(char *options = NULL;) + IF_FEATURE_CMDLINE_MODULE_OPTIONS(char *options = NULL;) INIT_G(); @@ -998,7 +991,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) if (!ONLY_APPLET) option_mask32 |= OPT_r; } else if (!ENABLE_MODPROBE || !(option_mask32 & OPT_r)) { -# if ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE +# if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS /* If not rmmod/-r, parse possible module options given on command line. * insmod/modprobe takes one module name, the rest are parameters. */ char **arg = argv; @@ -1023,7 +1016,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) if (!map) bb_perror_msg_and_die("can't read '%s'", *argv); if (init_module(map, len, - (IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : ) "") + (IF_FEATURE_CMDLINE_MODULE_OPTIONS(options ? options : ) "") ) != 0 ) { bb_error_msg_and_die("can't insert '%s': %s", @@ -1045,7 +1038,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) } while (*++argv); if (ENABLE_FEATURE_CLEAN_UP) { - IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(free(options);) + IF_FEATURE_CMDLINE_MODULE_OPTIONS(free(options);) } return exitcode; #endif /* MODPROBE || INSMOD || RMMOD */ diff --git a/modutils/modprobe.c b/modutils/modprobe.c index cbec43888..a6224fa63 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -112,7 +112,7 @@ //usage: //usage:#define modprobe_trivial_usage //usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]" -//usage: " MODULE [SYMBOL=VALUE]..." +//usage: " MODULE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...") //usage:#define modprobe_full_usage "\n\n" //usage: " -a Load multiple MODULEs" //usage: "\n -l List (MODULE is a pattern)" @@ -174,7 +174,9 @@ static const char modprobe_longopts[] ALIGN1 = struct globals { llist_t *probes; /* MEs of module(s) requested on cmdline */ +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS char *cmdline_mopts; /* module options from cmdline */ +#endif int num_unresolved_deps; /* bool. "Did we have 'symbol:FOO' requested on cmdline?" */ smallint need_symbols; @@ -458,8 +460,10 @@ static int do_modprobe(struct module_entry *m) options = m2->options; m2->options = NULL; options = parse_and_add_kcmdline_module_options(options, m2->modname); +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS if (m == m2) options = gather_options_str(options, G.cmdline_mopts); +#endif if (option_mask32 & OPT_SHOW_DEPS) { printf(options ? "insmod %s/%s/%s %s\n" @@ -626,7 +630,9 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) /* First argument is module name, rest are parameters */ DBG("probing just module %s", *argv); add_probe(argv[0]); +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS G.cmdline_mopts = parse_cmdline_module_options(argv, /*quote_spaces:*/ 1); +#endif } /* Happens if all requested modules are already loaded */ diff --git a/modutils/modutils.c b/modutils/modutils.c index 4204f06fe..dae623ee4 100644 --- a/modutils/modutils.c +++ b/modutils/modutils.c @@ -120,6 +120,7 @@ char* FAST_FUNC filename2modname(const char *filename, char *modname) return modname; } +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS char* FAST_FUNC parse_cmdline_module_options(char **argv, int quote_spaces) { char *options; @@ -155,6 +156,7 @@ char* FAST_FUNC parse_cmdline_module_options(char **argv, int quote_spaces) /* if (optlen != 0) options[optlen-1] = '\0'; */ return options; } +#endif #if ENABLE_FEATURE_INSMOD_TRY_MMAP void* FAST_FUNC try_to_mmap_module(const char *filename, size_t *image_size_p) diff --git a/modutils/modutils.h b/modutils/modutils.h index 2cbd1448a..76ce242ba 100644 --- a/modutils/modutils.h +++ b/modutils/modutils.h @@ -51,7 +51,11 @@ void replace(char *s, char what, char with) FAST_FUNC; char *replace_underscores(char *s) FAST_FUNC; int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC; char *filename2modname(const char *filename, char *modname) FAST_FUNC; +#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS char *parse_cmdline_module_options(char **argv, int quote_spaces) FAST_FUNC; +#else +# define parse_cmdline_module_options(argv, quote_spaces) "" +#endif /* insmod for 2.4 and modprobe's options (insmod 2.6 has no options at all): */ #define INSMOD_OPTS \ -- cgit v1.2.3-55-g6feb From 4ae658f077c9b8859e8f1aabee4b95c2c96dae1c Mon Sep 17 00:00:00 2001 From: Kang-Che Sung Date: Sun, 5 Feb 2017 19:02:34 +0100 Subject: modutils: fix config options dependency (2) - The modprobe-small implementation of rmmod no longer chdir's to "/lib/modules/`uname -r`" as it was not necessary for rmmod's operation. (And it no longer need to die if such modules directory doesn't exist.) - Configs DEFAULT_MODULES_DIR and DEFAULT_DEPMOD_FILE no longer depend on MODPROBE_SMALL as the latter may not enable depmod or modprobe that requires these configs. - Clarify DEFAULT_DEPMOD_FILE's description regarding the ".bb" name suffix. Signed-off-by: Kang-Che Sung Signed-off-by: Denys Vlasenko --- modutils/Config.src | 10 +++++++--- modutils/modprobe-small.c | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'modutils/Config.src') diff --git a/modutils/Config.src b/modutils/Config.src index a15cce518..d0bae2ea3 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -159,7 +159,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 || MODPROBE || MODINFO help Directory that contains kernel modules. Defaults to "/lib/modules" @@ -167,9 +167,13 @@ config DEFAULT_MODULES_DIR config DEFAULT_DEPMOD_FILE string "Default name of modules.dep" default "modules.dep" - depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO + depends on DEPMOD || MODPROBE || MODINFO help Filename that contains kernel modules dependencies. - Defaults to "modules.dep" + Defaults to "modules.dep". + If you configured the "simplified modutils" (MODPROBE_SMALL), a + ".bb" suffix will be added after this name. Do not specify ".bb" + here unless you intend your depmod or modprobe to work on + "modules.dep.bb.bb" or such. endmenu diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 04242634b..726a3108c 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c @@ -934,11 +934,11 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) /* Prevent ugly corner cases with no modules at all */ modinfo = xzalloc(sizeof(modinfo[0])); - if (!is_insmod) { + if (is_depmod || is_modprobe) { /* Goto modules directory */ xchdir(CONFIG_DEFAULT_MODULES_DIR); + uname(&uts); /* never fails */ } - uname(&uts); /* never fails */ /* depmod? */ if (is_depmod) { @@ -980,7 +980,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) getopt32(argv, "qrfsvwb"); argv += optind; - if (!is_insmod) { + if (is_modprobe) { /* Goto $VERSION directory */ xchdir(uts.release); } -- cgit v1.2.3-55-g6feb From 415cc42b6aab3a3a90749354432e7d780840b1d8 Mon Sep 17 00:00:00 2001 From: Kang-Che Sung Date: Wed, 1 Feb 2017 19:43:54 +0800 Subject: Reorder modutils config options & fix yet more dependency - modprobe can indirectly benefit from FEATURE_2_4_MODULES and FEATURE_INSMOD_TRY_MAP options. - The position of config FEATURE_INSMOD_TRY_MMAP prevented some other config options from indenting under FEATURE_2_4_MODULES. Reorder to fix this. - FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is now moved to Config.src under "Common options" section. (I wished to edit this config so that it also work with "big" modutils, but it's not done at the moment. Sorry.) Signed-off-by: Kang-Che Sung Signed-off-by: Denys Vlasenko --- modutils/Config.src | 43 +++++++++++++++++++++++++------------------ modutils/modprobe-small.c | 10 ++-------- 2 files changed, 27 insertions(+), 26 deletions(-) (limited to 'modutils/Config.src') diff --git a/modutils/Config.src b/modutils/Config.src index d0bae2ea3..5f0b0cec4 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -45,31 +45,22 @@ config FEATURE_CMDLINE_MODULE_OPTIONS Allow insmod and modprobe take module options from the applets' command line. +config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED + bool "Skip loading of already loaded modules" + default y + depends on MODPROBE_SMALL && (DEPMOD || INSMOD || MODPROBE) + help + Check if the module is already loaded. + config FEATURE_2_4_MODULES bool "Support version 2.2/2.4 Linux kernels" default n - depends on (INSMOD || RMMOD || LSMOD) && !MODPROBE_SMALL + depends on (INSMOD || LSMOD || MODPROBE || RMMOD) && !MODPROBE_SMALL help Support module loading for 2.2.x and 2.4.x Linux kernels. This increases size considerably. Say N unless you plan to run ancient kernels. -config FEATURE_INSMOD_TRY_MMAP - bool "Try to load module from a mmap'ed area" - default n - depends on INSMOD && !MODPROBE_SMALL - help - This option causes module loading code to try to mmap - module first. If it does not work (for example, - it does not work for compressed modules), module will be read - (and unpacked if needed) into a memory block allocated by malloc. - - The only case when mmap works but malloc does not is when - you are trying to load a big module on a very memory-constrained - machine. Malloc will momentarily need 2x as much memory as mmap. - - Choosing N saves about 250 bytes of code (on 32-bit x86). - config FEATURE_INSMOD_VERSION_CHECKING bool "Enable module version checking" default n @@ -113,7 +104,7 @@ config FEATURE_INSMOD_LOAD_MAP config FEATURE_INSMOD_LOAD_MAP_FULL bool "Symbols in load map" default y - depends on FEATURE_INSMOD_LOAD_MAP && !MODPROBE_SMALL + depends on FEATURE_INSMOD_LOAD_MAP help Without this option, -m will only output section load map. With this option, -m will also output @@ -129,6 +120,22 @@ config FEATURE_CHECK_TAINTED_MODULE support request. This option is required to support GPLONLY modules. +config FEATURE_INSMOD_TRY_MMAP + bool "Try to load module from a mmap'ed area" + default n + depends on (INSMOD || MODPROBE) && !MODPROBE_SMALL + help + This option causes module loading code to try to mmap + module first. If it does not work (for example, + it does not work for compressed modules), module will be read + (and unpacked if needed) into a memory block allocated by malloc. + + The only case when mmap works but malloc does not is when + you are trying to load a big module on a very memory-constrained + machine. Malloc will momentarily need 2x as much memory as mmap. + + Choosing N saves about 250 bytes of code (on 32-bit x86). + config FEATURE_MODUTILS_ALIAS bool "Support module.aliases file" default y diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 726a3108c..d6f481415 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c @@ -8,14 +8,8 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ -/* config MODPROBE_SMALL is defined in Config.src to ensure better "make config" order */ - -//config:config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED -//config: bool "Skip loading of already loaded modules" -//config: default y -//config: depends on MODPROBE_SMALL && (DEPMOD || INSMOD || MODPROBE) -//config: help -//config: Check if the module is already loaded. +/* modprobe-small configs are defined in Config.src to ensure better + * "make config" order */ //applet:IF_LSMOD( IF_MODPROBE_SMALL(APPLET(lsmod, BB_DIR_SBIN, BB_SUID_DROP))) //applet:IF_MODPROBE(IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP))) -- cgit v1.2.3-55-g6feb