Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kconfig: Add `make mod2noconfig` to disable module options

When converting a modular kernel to a monolithic kernel, once the kernel
works without loading any modules, this helps to quickly disable all the
modules before turning off module support entirely.

Refactor conf_rewrite_mod_or_yes to a more general
conf_rewrite_tristates that accepts an old and new state.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Tested-by: Björn Töpel <bjorn@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Josh Triplett and committed by
Masahiro Yamada
c39afe62 d58071a8

+12 -8
+2 -1
scripts/kconfig/Makefile
··· 69 69 # deprecated for external use 70 70 simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ 71 71 alldefconfig randconfig listnewconfig olddefconfig syncconfig \ 72 - helpnewconfig yes2modconfig mod2yesconfig 72 + helpnewconfig yes2modconfig mod2yesconfig mod2noconfig 73 73 74 74 PHONY += $(simple-targets) 75 75 ··· 134 134 @echo ' randconfig - New config with random answer to all options' 135 135 @echo ' yes2modconfig - Change answers from yes to mod if possible' 136 136 @echo ' mod2yesconfig - Change answers from mod to yes if possible' 137 + @echo ' mod2noconfig - Change answers from mod to no if possible' 137 138 @echo ' listnewconfig - List new options' 138 139 @echo ' helpnewconfig - List new options and help text' 139 140 @echo ' olddefconfig - Same as oldconfig but sets new symbols to their'
+10 -7
scripts/kconfig/conf.c
··· 35 35 olddefconfig, 36 36 yes2modconfig, 37 37 mod2yesconfig, 38 + mod2noconfig, 38 39 }; 39 40 static enum input_mode input_mode = oldaskconfig; 40 41 static int input_mode_opt; ··· 164 163 def_default, 165 164 def_yes, 166 165 def_mod, 167 - def_y2m, 168 - def_m2y, 169 166 def_no, 170 167 def_random 171 168 }; ··· 301 302 return has_changed; 302 303 } 303 304 304 - static void conf_rewrite_mod_or_yes(enum conf_def_mode mode) 305 + static void conf_rewrite_tristates(tristate old_val, tristate new_val) 305 306 { 306 307 struct symbol *sym; 307 308 int i; 308 - tristate old_val = (mode == def_y2m) ? yes : mod; 309 - tristate new_val = (mode == def_y2m) ? mod : yes; 310 309 311 310 for_all_symbols(i, sym) { 312 311 if (sym_get_type(sym) == S_TRISTATE && ··· 682 685 {"olddefconfig", no_argument, &input_mode_opt, olddefconfig}, 683 686 {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig}, 684 687 {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig}, 688 + {"mod2noconfig", no_argument, &input_mode_opt, mod2noconfig}, 685 689 {NULL, 0, NULL, 0} 686 690 }; 687 691 ··· 711 713 printf(" --randconfig New config with random answer to all options\n"); 712 714 printf(" --yes2modconfig Change answers from yes to mod if possible\n"); 713 715 printf(" --mod2yesconfig Change answers from mod to yes if possible\n"); 716 + printf(" --mod2noconfig Change answers from mod to no if possible\n"); 714 717 printf(" (If none of the above is given, --oldaskconfig is the default)\n"); 715 718 } 716 719 ··· 787 788 case olddefconfig: 788 789 case yes2modconfig: 789 790 case mod2yesconfig: 791 + case mod2noconfig: 790 792 conf_read(NULL); 791 793 break; 792 794 case allnoconfig: ··· 862 862 case savedefconfig: 863 863 break; 864 864 case yes2modconfig: 865 - conf_rewrite_mod_or_yes(def_y2m); 865 + conf_rewrite_tristates(yes, mod); 866 866 break; 867 867 case mod2yesconfig: 868 - conf_rewrite_mod_or_yes(def_m2y); 868 + conf_rewrite_tristates(mod, yes); 869 + break; 870 + case mod2noconfig: 871 + conf_rewrite_tristates(mod, no); 869 872 break; 870 873 case oldaskconfig: 871 874 rootEntry = &rootmenu;