streamline_config.pl (0fdc50dfab47d525b71a9f0d8310746cdc0c09c5) streamline_config.pl (c027b02d89fd42ecee911c39e9098b9609a5ca0b)
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3#
4# Copyright 2005-2009 - Steven Rostedt
5#
6# It's simple enough to figure out how this works.
7# If not, then you can ask me at stripconfig@goodmis.org
8#

--- 129 unchanged lines hidden (view full) ---

138
139my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`;
140chomp @makefiles;
141
142my %depends;
143my %selects;
144my %prompts;
145my %objects;
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3#
4# Copyright 2005-2009 - Steven Rostedt
5#
6# It's simple enough to figure out how this works.
7# If not, then you can ask me at stripconfig@goodmis.org
8#

--- 129 unchanged lines hidden (view full) ---

138
139my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`;
140chomp @makefiles;
141
142my %depends;
143my %selects;
144my %prompts;
145my %objects;
146my %config2kfile;
146my $var;
147my $iflevel = 0;
148my @ifdeps;
149
150# prevent recursion
151my %read_kconfigs;
152
153sub read_kconfig {

--- 42 unchanged lines hidden (view full) ---

196 }
197 next;
198 }
199
200 # configs found
201 if (/^\s*(menu)?config\s+(\S+)\s*$/) {
202 $state = "NEW";
203 $config = $2;
147my $var;
148my $iflevel = 0;
149my @ifdeps;
150
151# prevent recursion
152my %read_kconfigs;
153
154sub read_kconfig {

--- 42 unchanged lines hidden (view full) ---

197 }
198 next;
199 }
200
201 # configs found
202 if (/^\s*(menu)?config\s+(\S+)\s*$/) {
203 $state = "NEW";
204 $config = $2;
205 $config2kfile{"CONFIG_$config"} = $kconfig;
204
205 # Add depends for 'if' nesting
206 for (my $i = 0; $i < $iflevel; $i++) {
207 if ($i) {
208 $depends{$config} .= " " . $ifdeps[$i];
209 } else {
210 $depends{$config} = $ifdeps[$i];
211 }

--- 374 unchanged lines hidden (view full) ---

586
587 $repeat = 0;
588
589 # Now we need to see if we have to check selects;
590 loop_select;
591}
592
593my %setconfigs;
206
207 # Add depends for 'if' nesting
208 for (my $i = 0; $i < $iflevel; $i++) {
209 if ($i) {
210 $depends{$config} .= " " . $ifdeps[$i];
211 } else {
212 $depends{$config} = $ifdeps[$i];
213 }

--- 374 unchanged lines hidden (view full) ---

588
589 $repeat = 0;
590
591 # Now we need to see if we have to check selects;
592 loop_select;
593}
594
595my %setconfigs;
596my @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP});
594
597
598sub 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}
610
595# Finally, read the .config file and turn off any module enabled that
596# we could not find a reason to keep enabled.
597foreach my $line (@config_file) {
598 $_ = $line;
599
600 if (/CONFIG_IKCONFIG/) {
601 if (/# CONFIG_IKCONFIG is not set/) {
602 # enable IKCONFIG at least as a module

--- 36 unchanged lines hidden (view full) ---

639 print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n";
640 } else {
641 print;
642 }
643 next;
644 }
645
646 if (/^(CONFIG.*)=(m|y)/) {
611# Finally, read the .config file and turn off any module enabled that
612# we could not find a reason to keep enabled.
613foreach my $line (@config_file) {
614 $_ = $line;
615
616 if (/CONFIG_IKCONFIG/) {
617 if (/# CONFIG_IKCONFIG is not set/) {
618 # enable IKCONFIG at least as a module

--- 36 unchanged lines hidden (view full) ---

655 print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n";
656 } else {
657 print;
658 }
659 next;
660 }
661
662 if (/^(CONFIG.*)=(m|y)/) {
663 if (in_preserved_kconfigs($1)) {
664 dprint "Preserve config $1";
665 print;
666 next;
667 }
647 if (defined($configs{$1})) {
648 if ($localyesconfig) {
649 $setconfigs{$1} = 'y';
650 print "$1=y\n";
651 next;
652 } else {
653 $setconfigs{$1} = $2;
654 }

--- 26 unchanged lines hidden ---
668 if (defined($configs{$1})) {
669 if ($localyesconfig) {
670 $setconfigs{$1} = 'y';
671 print "$1=y\n";
672 next;
673 } else {
674 $setconfigs{$1} = $2;
675 }

--- 26 unchanged lines hidden ---