File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed
Documentation/admin-guide Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -209,15 +209,22 @@ Configuring the kernel
209209 store the lsmod of that machine into a file
210210 and pass it in as a LSMOD parameter.
211211
212+ Also, you can preserve modules in certain folders
213+ or kconfig files by specifying their paths in
214+ parameter LMC_KEEP.
215+
212216 target$ lsmod > /tmp/mylsmod
213217 target$ scp /tmp/mylsmod host:/tmp
214218
215- host$ make LSMOD=/tmp/mylsmod localmodconfig
219+ host$ make LSMOD=/tmp/mylsmod \
220+ LMC_KEEP="drivers/usb:drivers/gpu:fs" \
221+ localmodconfig
216222
217223 The above also works when cross compiling.
218224
219225 "make localyesconfig" Similar to localmodconfig, except it will convert
220- all module options to built in (=y) options.
226+ all module options to built in (=y) options. You can
227+ also preserve modules by LMC_KEEP.
221228
222229 "make kvmconfig" Enable additional options for kvm guest kernel support.
223230
Original file line number Diff line number Diff line change @@ -123,7 +123,9 @@ help:
123123 @echo ' gconfig - Update current config utilising a GTK+ based front-end'
124124 @echo ' oldconfig - Update current config utilising a provided .config as base'
125125 @echo ' localmodconfig - Update current config disabling modules not loaded'
126+ @echo ' except those preserved by LMC_KEEP environment variable'
126127 @echo ' localyesconfig - Update current config converting local mods to core'
128+ @echo ' except those preserved by LMC_KEEP environment variable'
127129 @echo ' defconfig - New config with default from ARCH supplied defconfig'
128130 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
129131 @echo ' allnoconfig - New config where all options are answered with no'
Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ sub read_config {
143143my %selects ;
144144my %prompts ;
145145my %objects ;
146+ my %config2kfile ;
146147my $var ;
147148my $iflevel = 0;
148149my @ifdeps ;
@@ -201,6 +202,7 @@ sub read_kconfig {
201202 if (/ ^\s *(menu)?config\s +(\S +)\s *$ / ) {
202203 $state = " NEW" ;
203204 $config = $2 ;
205+ $config2kfile {" CONFIG_$config " } = $kconfig ;
204206
205207 # Add depends for 'if' nesting
206208 for (my $i = 0; $i < $iflevel ; $i ++) {
@@ -591,6 +593,20 @@ sub loop_select {
591593}
592594
593595my %setconfigs ;
596+ my @preserved_kconfigs = split (/ :/ ,$ENV {LMC_KEEP });
597+
598+ sub in_preserved_kconfigs {
599+ my $kconfig = $config2kfile {$_ [0]};
600+ if (!defined ($kconfig )) {
601+ return 0;
602+ }
603+ foreach my $excl (@preserved_kconfigs ) {
604+ if ($kconfig =~ / ^$excl / ) {
605+ return 1;
606+ }
607+ }
608+ return 0;
609+ }
594610
595611# Finally, read the .config file and turn off any module enabled that
596612# we could not find a reason to keep enabled.
@@ -644,6 +660,11 @@ sub loop_select {
644660 }
645661
646662 if (/ ^(CONFIG.*)=(m|y)/ ) {
663+ if (in_preserved_kconfigs($1 )) {
664+ dprint " Preserve config $1 " ;
665+ print ;
666+ next ;
667+ }
647668 if (defined ($configs {$1 })) {
648669 if ($localyesconfig ) {
649670 $setconfigs {$1 } = ' y' ;
You can’t perform that action at this time.
0 commit comments