diff options
author | Tom Gundersen <teg@jklm.no> | 2011-05-26 20:57:55 +0200 |
---|---|---|
committer | Jon Masters <jcm@jonmasters.org> | 2011-05-30 23:01:22 -0400 |
commit | 69c099d4371aef5df2129816fefe50d51cb6ae19 (patch) | |
tree | b77406bddb0cb8869113d6e2a264daab81fb7a6c | |
parent | 4bf5e394ea98521ace30cec78c1054083ee92007 (diff) | |
download | module-init-tools-69c099d4371aef5df2129816fefe50d51cb6ae19.tar.gz |
modprobe: blacklist modules on kernel commandline
Modules mod1, mod2 and mod3 can now be blacklisted by passing
modprobe.blacklist=mod1,mod2,mod3
on the kernel command line.
This is useful in case a module prevents the system from booting.
Cc: Jon Masters <jcm@jonmasters.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Aaron Griffin <aaron@archlinux.org>
Cc: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Jon Masters <jcm@jonmasters.org>
-rw-r--r-- | modprobe.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -1134,11 +1134,13 @@ static void parse_toplevel_config(const char *filename, } /* Read possible module arguments from the kernel command line. */ -static int parse_kcmdline(int dump_only, struct module_options **options) +static int parse_kcmdline(int dump_only, struct modprobe_conf *conf) { char *line; unsigned int linenum = 0; FILE *kcmdline; + struct module_options **options = &conf->options; + struct module_blacklist **blacklist = &conf->blacklist; kcmdline = fopen("/proc/cmdline", "r"); if (!kcmdline) @@ -1151,6 +1153,17 @@ static int parse_kcmdline(int dump_only, struct module_options **options) while ((arg = strsep_skipspace(&ptr, "\t ")) != NULL) { char *sep, *modname, *opt; + if (strstr(arg, "modprobe.blacklist=") != NULL) { + ptr = strchr(arg,'=') + 1; + + while ((modname = strsep(&ptr, ",")) != NULL) { + if (dump_only) + printf("blacklist %s\n", modname); + + *blacklist = add_blacklist(underscores(modname), *blacklist); + } + } + sep = strchr(arg, '.'); if (sep) { if (!strchr(sep, '=')) @@ -1836,7 +1849,7 @@ int main(int argc, char *argv[]) parse_toplevel_config(configname, &conf, dump_config, flags & mit_remove); /* Read module options from kernel command line */ - parse_kcmdline(dump_config, &conf.options); + parse_kcmdline(dump_config, &conf); if (dump_config) { char *aliasfilename, *symfilename; |