2009-04-29 20:52:21 -06:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
#
|
2011-01-24 13:12:01 -07:00
|
|
|
# Copyright 2005-2009 - Steven Rostedt
|
2009-04-29 20:52:21 -06:00
|
|
|
# Licensed under the terms of the GNU GPL License version 2
|
|
|
|
#
|
|
|
|
# It's simple enough to figure out how this works.
|
|
|
|
# If not, then you can ask me at stripconfig@goodmis.org
|
|
|
|
#
|
|
|
|
# What it does?
|
|
|
|
#
|
|
|
|
# If you have installed a Linux kernel from a distribution
|
|
|
|
# that turns on way too many modules than you need, and
|
|
|
|
# you only want the modules you use, then this program
|
|
|
|
# is perfect for you.
|
|
|
|
#
|
|
|
|
# It gives you the ability to turn off all the modules that are
|
|
|
|
# not loaded on your system.
|
|
|
|
#
|
|
|
|
# Howto:
|
|
|
|
#
|
|
|
|
# 1. Boot up the kernel that you want to stream line the config on.
|
|
|
|
# 2. Change directory to the directory holding the source of the
|
|
|
|
# kernel that you just booted.
|
|
|
|
# 3. Copy the configuraton file to this directory as .config
|
|
|
|
# 4. Have all your devices that you need modules for connected and
|
|
|
|
# operational (make sure that their corresponding modules are loaded)
|
|
|
|
# 5. Run this script redirecting the output to some other file
|
|
|
|
# like config_strip.
|
|
|
|
# 6. Back up your old config (if you want too).
|
|
|
|
# 7. copy the config_strip file to .config
|
|
|
|
# 8. Run "make oldconfig"
|
|
|
|
#
|
|
|
|
# Now your kernel is ready to be built with only the modules that
|
|
|
|
# are loaded.
|
|
|
|
#
|
|
|
|
# Here's what I did with my Debian distribution.
|
|
|
|
#
|
|
|
|
# cd /usr/src/linux-2.6.10
|
|
|
|
# cp /boot/config-2.6.10-1-686-smp .config
|
|
|
|
# ~/bin/streamline_config > config_strip
|
|
|
|
# mv .config config_sav
|
|
|
|
# mv config_strip .config
|
|
|
|
# make oldconfig
|
|
|
|
#
|
2010-08-17 04:49:18 -06:00
|
|
|
use strict;
|
2011-07-19 22:40:09 -06:00
|
|
|
use Getopt::Long;
|
2010-08-17 04:49:18 -06:00
|
|
|
|
2012-06-18 20:41:15 -06:00
|
|
|
# set the environment variable LOCALMODCONFIG_DEBUG to get
|
|
|
|
# debug output.
|
|
|
|
my $debugprint = 0;
|
|
|
|
$debugprint = 1 if (defined($ENV{LOCALMODCONFIG_DEBUG}));
|
|
|
|
|
|
|
|
sub dprint {
|
|
|
|
return if (!$debugprint);
|
|
|
|
print STDERR @_;
|
|
|
|
}
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
my $config = ".config";
|
|
|
|
|
2009-04-30 12:39:48 -06:00
|
|
|
my $uname = `uname -r`;
|
|
|
|
chomp $uname;
|
|
|
|
|
|
|
|
my @searchconfigs = (
|
2009-05-07 09:01:34 -06:00
|
|
|
{
|
|
|
|
"file" => ".config",
|
|
|
|
"exec" => "cat",
|
|
|
|
},
|
2009-04-30 12:39:48 -06:00
|
|
|
{
|
|
|
|
"file" => "/proc/config.gz",
|
|
|
|
"exec" => "zcat",
|
|
|
|
},
|
2009-04-30 17:30:04 -06:00
|
|
|
{
|
|
|
|
"file" => "/boot/config-$uname",
|
|
|
|
"exec" => "cat",
|
|
|
|
},
|
2009-04-30 12:39:48 -06:00
|
|
|
{
|
|
|
|
"file" => "/boot/vmlinuz-$uname",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "vmlinux",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "/lib/modules/$uname/kernel/kernel/configs.ko",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "kernel/configs.ko",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "kernel/configs.o",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
2012-08-09 07:23:21 -06:00
|
|
|
sub read_config {
|
2009-04-30 12:39:48 -06:00
|
|
|
foreach my $conf (@searchconfigs) {
|
|
|
|
my $file = $conf->{"file"};
|
|
|
|
|
|
|
|
next if ( ! -f "$file");
|
|
|
|
|
|
|
|
if (defined($conf->{"test"})) {
|
|
|
|
`$conf->{"test"} $conf->{"file"} 2>/dev/null`;
|
|
|
|
next if ($?);
|
|
|
|
}
|
|
|
|
|
|
|
|
my $exec = $conf->{"exec"};
|
|
|
|
|
|
|
|
print STDERR "using config: '$file'\n";
|
|
|
|
|
2012-08-09 07:23:21 -06:00
|
|
|
open(my $infile, '-|', "$exec $file") || die "Failed to run $exec $file";
|
|
|
|
my @x = <$infile>;
|
|
|
|
close $infile;
|
|
|
|
return @x;
|
2009-04-30 12:39:48 -06:00
|
|
|
}
|
|
|
|
die "No config file found";
|
|
|
|
}
|
|
|
|
|
2012-08-09 07:23:21 -06:00
|
|
|
my @config_file = read_config;
|
2012-06-18 19:43:53 -06:00
|
|
|
|
2011-07-19 22:40:09 -06:00
|
|
|
# Parse options
|
|
|
|
my $localmodconfig = 0;
|
|
|
|
my $localyesconfig = 0;
|
|
|
|
|
|
|
|
GetOptions("localmodconfig" => \$localmodconfig,
|
|
|
|
"localyesconfig" => \$localyesconfig);
|
|
|
|
|
2009-11-20 07:21:12 -07:00
|
|
|
# Get the build source and top level Kconfig file (passed in)
|
2012-08-09 07:23:20 -06:00
|
|
|
my $ksource = ($ARGV[0] ? $ARGV[0] : '.');
|
2009-11-20 07:21:12 -07:00
|
|
|
my $kconfig = $ARGV[1];
|
2011-07-01 15:45:31 -06:00
|
|
|
my $lsmod_file = $ENV{'LSMOD'};
|
2009-11-20 07:21:12 -07:00
|
|
|
|
2015-07-26 16:06:55 -06:00
|
|
|
my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`;
|
2010-05-26 12:22:02 -06:00
|
|
|
chomp @makefiles;
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
my %depends;
|
|
|
|
my %selects;
|
|
|
|
my %prompts;
|
|
|
|
my %objects;
|
|
|
|
my $var;
|
2010-01-06 15:56:12 -07:00
|
|
|
my $iflevel = 0;
|
|
|
|
my @ifdeps;
|
2009-04-29 20:52:21 -06:00
|
|
|
|
|
|
|
# prevent recursion
|
|
|
|
my %read_kconfigs;
|
|
|
|
|
|
|
|
sub read_kconfig {
|
|
|
|
my ($kconfig) = @_;
|
|
|
|
|
|
|
|
my $state = "NONE";
|
|
|
|
my $config;
|
|
|
|
|
2010-10-28 20:13:51 -06:00
|
|
|
my $cont = 0;
|
|
|
|
my $line;
|
|
|
|
|
2010-10-28 22:56:46 -06:00
|
|
|
my $source = "$ksource/$kconfig";
|
|
|
|
my $last_source = "";
|
|
|
|
|
|
|
|
# Check for any environment variables used
|
|
|
|
while ($source =~ /\$(\w+)/ && $last_source ne $source) {
|
|
|
|
my $env = $1;
|
|
|
|
$last_source = $source;
|
|
|
|
$source =~ s/\$$env/$ENV{$env}/;
|
|
|
|
}
|
|
|
|
|
2012-08-09 07:23:22 -06:00
|
|
|
open(my $kinfile, '<', $source) || die "Can't open $kconfig";
|
|
|
|
while (<$kinfile>) {
|
2009-04-29 20:52:21 -06:00
|
|
|
chomp;
|
|
|
|
|
2010-10-28 20:13:51 -06:00
|
|
|
# Make sure that lines ending with \ continue
|
|
|
|
if ($cont) {
|
|
|
|
$_ = $line . " " . $_;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s/\\$//) {
|
|
|
|
$cont = 1;
|
|
|
|
$line = $_;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
$cont = 0;
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
# collect any Kconfig sources
|
|
|
|
if (/^source\s*"(.*)"/) {
|
2013-04-29 13:18:38 -06:00
|
|
|
my $kconfig = $1;
|
|
|
|
# prevent reading twice.
|
|
|
|
if (!defined($read_kconfigs{$kconfig})) {
|
|
|
|
$read_kconfigs{$kconfig} = 1;
|
|
|
|
read_kconfig($kconfig);
|
|
|
|
}
|
|
|
|
next;
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
# configs found
|
2010-10-28 20:21:57 -06:00
|
|
|
if (/^\s*(menu)?config\s+(\S+)\s*$/) {
|
2009-04-29 20:52:21 -06:00
|
|
|
$state = "NEW";
|
2010-10-28 20:21:57 -06:00
|
|
|
$config = $2;
|
2009-04-29 20:52:21 -06:00
|
|
|
|
2012-06-18 12:09:22 -06:00
|
|
|
# Add depends for 'if' nesting
|
2010-01-06 15:56:12 -07:00
|
|
|
for (my $i = 0; $i < $iflevel; $i++) {
|
|
|
|
if ($i) {
|
|
|
|
$depends{$config} .= " " . $ifdeps[$i];
|
|
|
|
} else {
|
|
|
|
$depends{$config} = $ifdeps[$i];
|
|
|
|
}
|
|
|
|
$state = "DEP";
|
|
|
|
}
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
# collect the depends for the config
|
|
|
|
} elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) {
|
|
|
|
$state = "DEP";
|
|
|
|
$depends{$config} = $1;
|
|
|
|
} elsif ($state eq "DEP" && /^\s*depends\s+on\s+(.*)$/) {
|
|
|
|
$depends{$config} .= " " . $1;
|
2013-12-18 10:35:20 -07:00
|
|
|
} elsif ($state eq "DEP" && /^\s*def(_(bool|tristate)|ault)\s+(\S.*)$/) {
|
|
|
|
my $dep = $3;
|
|
|
|
if ($dep !~ /^\s*(y|m|n)\s*$/) {
|
|
|
|
$dep =~ s/.*\sif\s+//;
|
|
|
|
$depends{$config} .= " " . $dep;
|
|
|
|
dprint "Added default depends $dep to $config\n";
|
|
|
|
}
|
2009-04-29 20:52:21 -06:00
|
|
|
|
|
|
|
# Get the configs that select this config
|
|
|
|
} elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) {
|
2012-06-18 12:09:22 -06:00
|
|
|
my $conf = $1;
|
|
|
|
if (defined($selects{$conf})) {
|
|
|
|
$selects{$conf} .= " " . $config;
|
2009-04-29 20:52:21 -06:00
|
|
|
} else {
|
2012-06-18 12:09:22 -06:00
|
|
|
$selects{$conf} = $config;
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
# configs without prompts must be selected
|
|
|
|
} elsif ($state ne "NONE" && /^\s*tristate\s\S/) {
|
|
|
|
# note if the config has a prompt
|
2010-08-14 22:13:17 -06:00
|
|
|
$prompts{$config} = 1;
|
2009-04-29 20:52:21 -06:00
|
|
|
|
2010-01-06 15:56:12 -07:00
|
|
|
# Check for if statements
|
|
|
|
} elsif (/^if\s+(.*\S)\s*$/) {
|
|
|
|
my $deps = $1;
|
|
|
|
# remove beginning and ending non text
|
|
|
|
$deps =~ s/^[^a-zA-Z0-9_]*//;
|
|
|
|
$deps =~ s/[^a-zA-Z0-9_]*$//;
|
|
|
|
|
|
|
|
my @deps = split /[^a-zA-Z0-9_]+/, $deps;
|
|
|
|
|
|
|
|
$ifdeps[$iflevel++] = join ':', @deps;
|
|
|
|
|
|
|
|
} elsif (/^endif/) {
|
|
|
|
|
|
|
|
$iflevel-- if ($iflevel);
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
# stop on "help"
|
|
|
|
} elsif (/^\s*help\s*$/) {
|
|
|
|
$state = "NONE";
|
|
|
|
}
|
|
|
|
}
|
2012-08-09 07:23:22 -06:00
|
|
|
close($kinfile);
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($kconfig) {
|
|
|
|
read_kconfig($kconfig);
|
|
|
|
}
|
|
|
|
|
2012-06-18 12:09:22 -06:00
|
|
|
# Makefiles can use variables to define their dependencies
|
2012-01-13 15:53:40 -07:00
|
|
|
sub convert_vars {
|
|
|
|
my ($line, %vars) = @_;
|
|
|
|
|
|
|
|
my $process = "";
|
|
|
|
|
|
|
|
while ($line =~ s/^(.*?)(\$\((.*?)\))//) {
|
|
|
|
my $start = $1;
|
|
|
|
my $variable = $2;
|
|
|
|
my $var = $3;
|
|
|
|
|
|
|
|
if (defined($vars{$var})) {
|
|
|
|
$process .= $start . $vars{$var};
|
|
|
|
} else {
|
|
|
|
$process .= $start . $variable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$process .= $line;
|
|
|
|
|
|
|
|
return $process;
|
|
|
|
}
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
# Read all Makefiles to map the configs to the objects
|
|
|
|
foreach my $makefile (@makefiles) {
|
|
|
|
|
2012-01-13 15:50:39 -07:00
|
|
|
my $line = "";
|
2012-01-13 15:53:40 -07:00
|
|
|
my %make_vars;
|
2010-10-28 20:13:51 -06:00
|
|
|
|
2012-08-09 07:23:22 -06:00
|
|
|
open(my $infile, '<', $makefile) || die "Can't open $makefile";
|
|
|
|
while (<$infile>) {
|
2012-01-13 15:50:39 -07:00
|
|
|
# if this line ends with a backslash, continue
|
|
|
|
chomp;
|
|
|
|
if (/^(.*)\\$/) {
|
|
|
|
$line .= $1;
|
|
|
|
next;
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
2012-01-13 15:50:39 -07:00
|
|
|
|
|
|
|
$line .= $_;
|
|
|
|
$_ = $line;
|
|
|
|
$line = "";
|
|
|
|
|
|
|
|
my $objs;
|
2009-04-29 20:52:21 -06:00
|
|
|
|
2012-06-18 12:09:22 -06:00
|
|
|
# Convert variables in a line (could define configs)
|
2012-01-13 15:53:40 -07:00
|
|
|
$_ = convert_vars($_, %make_vars);
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
# collect objects after obj-$(CONFIG_FOO_BAR)
|
|
|
|
if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
|
|
|
|
$var = $1;
|
|
|
|
$objs = $2;
|
2012-01-13 15:53:40 -07:00
|
|
|
|
|
|
|
# check if variables are set
|
|
|
|
} elsif (/^\s*(\S+)\s*[:]?=\s*(.*\S)/) {
|
|
|
|
$make_vars{$1} = $2;
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
|
|
|
if (defined($objs)) {
|
|
|
|
foreach my $obj (split /\s+/,$objs) {
|
|
|
|
$obj =~ s/-/_/g;
|
|
|
|
if ($obj =~ /(.*)\.o$/) {
|
2010-05-28 02:25:52 -06:00
|
|
|
# Objects may be enabled by more than one config.
|
2009-04-29 20:52:21 -06:00
|
|
|
# Store configs in an array.
|
|
|
|
my @arr;
|
|
|
|
|
|
|
|
if (defined($objects{$1})) {
|
|
|
|
@arr = @{$objects{$1}};
|
|
|
|
}
|
|
|
|
|
|
|
|
$arr[$#arr+1] = $var;
|
|
|
|
|
|
|
|
# The objects have a hash mapping to a reference
|
|
|
|
# of an array of configs.
|
|
|
|
$objects{$1} = \@arr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-08-09 07:23:22 -06:00
|
|
|
close($infile);
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
my %modules;
|
2012-08-09 07:23:22 -06:00
|
|
|
my $linfile;
|
2009-04-29 20:52:21 -06:00
|
|
|
|
2010-02-02 19:51:27 -07:00
|
|
|
if (defined($lsmod_file)) {
|
|
|
|
if ( ! -f $lsmod_file) {
|
2011-07-01 15:45:31 -06:00
|
|
|
if ( -f $ENV{'objtree'}."/".$lsmod_file) {
|
|
|
|
$lsmod_file = $ENV{'objtree'}."/".$lsmod_file;
|
|
|
|
} else {
|
|
|
|
die "$lsmod_file not found";
|
|
|
|
}
|
2010-02-02 19:51:27 -07:00
|
|
|
}
|
2012-08-09 07:23:22 -06:00
|
|
|
|
|
|
|
my $otype = ( -x $lsmod_file) ? '-|' : '<';
|
|
|
|
open($linfile, $otype, $lsmod_file);
|
|
|
|
|
2010-02-02 19:51:27 -07:00
|
|
|
} else {
|
|
|
|
|
|
|
|
# see what modules are loaded on this system
|
|
|
|
my $lsmod;
|
|
|
|
|
2010-08-17 04:49:18 -06:00
|
|
|
foreach my $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
|
2010-02-02 19:51:27 -07:00
|
|
|
if ( -x "$dir/lsmod" ) {
|
|
|
|
$lsmod = "$dir/lsmod";
|
|
|
|
last;
|
|
|
|
}
|
2010-01-06 16:49:44 -07:00
|
|
|
}
|
2010-02-02 19:51:27 -07:00
|
|
|
if (!defined($lsmod)) {
|
|
|
|
# try just the path
|
|
|
|
$lsmod = "lsmod";
|
|
|
|
}
|
|
|
|
|
2012-08-09 07:23:22 -06:00
|
|
|
open($linfile, '-|', $lsmod) || die "Can not call lsmod with $lsmod";
|
2010-01-06 16:49:44 -07:00
|
|
|
}
|
|
|
|
|
2012-08-09 07:23:22 -06:00
|
|
|
while (<$linfile>) {
|
2009-04-29 20:52:21 -06:00
|
|
|
next if (/^Module/); # Skip the first line.
|
|
|
|
if (/^(\S+)/) {
|
|
|
|
$modules{$1} = 1;
|
|
|
|
}
|
|
|
|
}
|
2012-08-09 07:23:22 -06:00
|
|
|
close ($linfile);
|
2009-04-29 20:52:21 -06:00
|
|
|
|
|
|
|
# add to the configs hash all configs that are needed to enable
|
2012-06-18 12:09:22 -06:00
|
|
|
# a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o
|
|
|
|
# where we know we need bar.o so we add FOO to the list.
|
2009-04-29 20:52:21 -06:00
|
|
|
my %configs;
|
|
|
|
foreach my $module (keys(%modules)) {
|
|
|
|
if (defined($objects{$module})) {
|
2010-05-28 02:24:59 -06:00
|
|
|
my @arr = @{$objects{$module}};
|
2009-04-29 20:52:21 -06:00
|
|
|
foreach my $conf (@arr) {
|
|
|
|
$configs{$conf} = $module;
|
2012-06-18 20:41:15 -06:00
|
|
|
dprint "$conf added by direct ($module)\n";
|
2013-04-29 13:17:40 -06:00
|
|
|
if ($debugprint) {
|
|
|
|
my $c=$conf;
|
|
|
|
$c =~ s/^CONFIG_//;
|
|
|
|
if (defined($depends{$c})) {
|
|
|
|
dprint " deps = $depends{$c}\n";
|
|
|
|
} else {
|
|
|
|
dprint " no deps\n";
|
|
|
|
}
|
|
|
|
}
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# Most likely, someone has a custom (binary?) module loaded.
|
|
|
|
print STDERR "$module config not found!!\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-18 19:43:53 -06:00
|
|
|
# Read the current config, and see what is enabled. We want to
|
|
|
|
# ignore configs that we would not enable anyway.
|
|
|
|
|
|
|
|
my %orig_configs;
|
2009-04-29 20:52:21 -06:00
|
|
|
my $valid = "A-Za-z_0-9";
|
2012-06-18 19:43:53 -06:00
|
|
|
|
|
|
|
foreach my $line (@config_file) {
|
|
|
|
$_ = $line;
|
|
|
|
|
|
|
|
if (/(CONFIG_[$valid]*)=(m|y)/) {
|
|
|
|
$orig_configs{$1} = $2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
my $repeat = 1;
|
|
|
|
|
2012-06-18 20:41:15 -06:00
|
|
|
my $depconfig;
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
#
|
|
|
|
# Note, we do not care about operands (like: &&, ||, !) we want to add any
|
|
|
|
# config that is in the depend list of another config. This script does
|
|
|
|
# not enable configs that are not already enabled. If we come across a
|
|
|
|
# config A that depends on !B, we can still add B to the list of depends
|
|
|
|
# to keep on. If A was on in the original config, B would not have been
|
|
|
|
# and B would not be turned on by this script.
|
|
|
|
#
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
sub parse_config_depends
|
2009-04-29 20:52:21 -06:00
|
|
|
{
|
|
|
|
my ($p) = @_;
|
|
|
|
|
|
|
|
while ($p =~ /[$valid]/) {
|
|
|
|
|
|
|
|
if ($p =~ /^[^$valid]*([$valid]+)/) {
|
|
|
|
my $conf = "CONFIG_" . $1;
|
|
|
|
|
|
|
|
$p =~ s/^[^$valid]*[$valid]+//;
|
|
|
|
|
2012-06-18 19:43:53 -06:00
|
|
|
# We only need to process if the depend config is a module
|
|
|
|
if (!defined($orig_configs{$conf}) || !$orig_configs{conf} eq "m") {
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
if (!defined($configs{$conf})) {
|
|
|
|
# We must make sure that this config has its
|
|
|
|
# dependencies met.
|
|
|
|
$repeat = 1; # do again
|
2012-06-18 20:41:15 -06:00
|
|
|
dprint "$conf selected by depend $depconfig\n";
|
2009-04-29 20:52:21 -06:00
|
|
|
$configs{$conf} = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
die "this should never happen";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
# Select is treated a bit differently than depends. We call this
|
|
|
|
# when a config has no prompt and requires another config to be
|
|
|
|
# selected. We use to just select all configs that selected this
|
|
|
|
# config, but found that that can balloon into enabling hundreds
|
|
|
|
# of configs that we do not care about.
|
|
|
|
#
|
|
|
|
# The idea is we look at all the configs that select it. If one
|
|
|
|
# is already in our list of configs to enable, then there's nothing
|
|
|
|
# else to do. If there isn't, we pick the first config that was
|
|
|
|
# enabled in the orignal config and use that.
|
|
|
|
sub parse_config_selects
|
|
|
|
{
|
|
|
|
my ($config, $p) = @_;
|
2009-04-29 20:52:21 -06:00
|
|
|
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
my $next_config;
|
|
|
|
|
|
|
|
while ($p =~ /[$valid]/) {
|
|
|
|
|
|
|
|
if ($p =~ /^[^$valid]*([$valid]+)/) {
|
|
|
|
my $conf = "CONFIG_" . $1;
|
|
|
|
|
|
|
|
$p =~ s/^[^$valid]*[$valid]+//;
|
2009-04-29 20:52:21 -06:00
|
|
|
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
# Make sure that this config exists in the current .config file
|
|
|
|
if (!defined($orig_configs{$conf})) {
|
2012-06-18 20:41:15 -06:00
|
|
|
dprint "$conf not set for $config select\n";
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check if something other than a module selects this config
|
|
|
|
if (defined($orig_configs{$conf}) && $orig_configs{$conf} ne "m") {
|
2012-06-18 20:41:15 -06:00
|
|
|
dprint "$conf (non module) selects config, we are good\n";
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
# we are good with this
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (defined($configs{$conf})) {
|
2012-06-18 20:41:15 -06:00
|
|
|
dprint "$conf selects $config so we are good\n";
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
# A set config selects this config, we are good
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
# Set this config to be selected
|
|
|
|
if (!defined($next_config)) {
|
|
|
|
$next_config = $conf;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
die "this should never happen";
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
}
|
2009-04-29 20:52:21 -06:00
|
|
|
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
# If no possible config selected this, then something happened.
|
|
|
|
if (!defined($next_config)) {
|
|
|
|
print STDERR "WARNING: $config is required, but nothing in the\n";
|
|
|
|
print STDERR " current config selects it.\n";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
# If we are here, then we found no config that is set and
|
|
|
|
# selects this config. Repeat.
|
|
|
|
$repeat = 1;
|
|
|
|
# Make this config need to be selected
|
|
|
|
$configs{$next_config} = 1;
|
2012-06-18 20:41:15 -06:00
|
|
|
dprint "$next_config selected by select $config\n";
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
my %process_selects;
|
|
|
|
|
|
|
|
# loop through all configs, select their dependencies.
|
|
|
|
sub loop_depend {
|
|
|
|
$repeat = 1;
|
|
|
|
|
|
|
|
while ($repeat) {
|
|
|
|
$repeat = 0;
|
|
|
|
|
|
|
|
forloop:
|
|
|
|
foreach my $config (keys %configs) {
|
|
|
|
|
|
|
|
# If this config is not a module, we do not need to process it
|
|
|
|
if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m") {
|
|
|
|
next forloop;
|
|
|
|
}
|
|
|
|
|
|
|
|
$config =~ s/^CONFIG_//;
|
2012-06-18 20:41:15 -06:00
|
|
|
$depconfig = $config;
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
|
|
|
|
if (defined($depends{$config})) {
|
|
|
|
# This config has dependencies. Make sure they are also included
|
|
|
|
parse_config_depends $depends{$config};
|
|
|
|
}
|
|
|
|
|
|
|
|
# If the config has no prompt, then we need to check if a config
|
|
|
|
# that is enabled selected it. Or if we need to enable one.
|
|
|
|
if (!defined($prompts{$config}) && defined($selects{$config})) {
|
|
|
|
$process_selects{$config} = 1;
|
|
|
|
}
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub loop_select {
|
|
|
|
|
|
|
|
foreach my $config (keys %process_selects) {
|
|
|
|
$config =~ s/^CONFIG_//;
|
2009-04-29 20:52:21 -06:00
|
|
|
|
2012-06-18 20:41:15 -06:00
|
|
|
dprint "Process select $config\n";
|
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
# config has no prompt and must be selected.
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
parse_config_selects $config, $selects{$config};
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
while ($repeat) {
|
|
|
|
# Get the first set of configs and their dependencies.
|
|
|
|
loop_depend;
|
|
|
|
|
|
|
|
$repeat = 0;
|
|
|
|
|
|
|
|
# Now we need to see if we have to check selects;
|
|
|
|
loop_select;
|
2014-04-28 01:26:18 -06:00
|
|
|
}
|
localmodconfig: Check if configs are already set for selects
There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.
If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.
The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.
If no config that selects the config is set, then just pick one and
try again.
This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.
Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-06-18 20:22:33 -06:00
|
|
|
|
2009-04-29 20:52:21 -06:00
|
|
|
my %setconfigs;
|
|
|
|
|
|
|
|
# Finally, read the .config file and turn off any module enabled that
|
|
|
|
# we could not find a reason to keep enabled.
|
2012-06-18 19:43:53 -06:00
|
|
|
foreach my $line (@config_file) {
|
|
|
|
$_ = $line;
|
2009-04-30 10:15:10 -06:00
|
|
|
|
|
|
|
if (/CONFIG_IKCONFIG/) {
|
|
|
|
if (/# CONFIG_IKCONFIG is not set/) {
|
|
|
|
# enable IKCONFIG at least as a module
|
|
|
|
print "CONFIG_IKCONFIG=m\n";
|
|
|
|
# don't ask about PROC
|
2009-04-30 17:24:00 -06:00
|
|
|
print "# CONFIG_IKCONFIG_PROC is not set\n";
|
2009-04-30 10:15:10 -06:00
|
|
|
} else {
|
|
|
|
print;
|
|
|
|
}
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (/^(CONFIG.*)=(m|y)/) {
|
|
|
|
if (defined($configs{$1})) {
|
2011-07-19 22:40:09 -06:00
|
|
|
if ($localyesconfig) {
|
|
|
|
$setconfigs{$1} = 'y';
|
2012-10-01 08:24:30 -06:00
|
|
|
print "$1=y\n";
|
|
|
|
next;
|
2011-07-19 22:40:09 -06:00
|
|
|
} else {
|
|
|
|
$setconfigs{$1} = $2;
|
|
|
|
}
|
2009-04-30 10:15:10 -06:00
|
|
|
} elsif ($2 eq "m") {
|
|
|
|
print "# $1 is not set\n";
|
2009-04-30 17:24:00 -06:00
|
|
|
next;
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
2009-04-30 10:15:10 -06:00
|
|
|
}
|
2009-04-30 17:24:00 -06:00
|
|
|
print;
|
2009-04-29 20:52:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
# Integrity check, make sure all modules that we want enabled do
|
|
|
|
# indeed have their configs set.
|
|
|
|
loop:
|
|
|
|
foreach my $module (keys(%modules)) {
|
|
|
|
if (defined($objects{$module})) {
|
|
|
|
my @arr = @{$objects{$module}};
|
|
|
|
foreach my $conf (@arr) {
|
|
|
|
if (defined($setconfigs{$conf})) {
|
|
|
|
next loop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print STDERR "module $module did not have configs";
|
|
|
|
foreach my $conf (@arr) {
|
|
|
|
print STDERR " " , $conf;
|
|
|
|
}
|
|
|
|
print STDERR "\n";
|
|
|
|
}
|
|
|
|
}
|