Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[pandora-kernel.git] / scripts / kconfig / streamline_config.pl
index a4fe923..ec7afce 100644 (file)
@@ -43,6 +43,7 @@
 #    make oldconfig
 #
 use strict;
+use Getopt::Long;
 
 my $config = ".config";
 
@@ -112,10 +113,17 @@ sub find_config {
 
 find_config;
 
+# Parse options
+my $localmodconfig = 0;
+my $localyesconfig = 0;
+
+GetOptions("localmodconfig" => \$localmodconfig,
+          "localyesconfig" => \$localyesconfig);
+
 # Get the build source and top level Kconfig file (passed in)
 my $ksource = $ARGV[0];
 my $kconfig = $ARGV[1];
-my $lsmod_file = $ARGV[2];
+my $lsmod_file = $ENV{'LSMOD'};
 
 my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
 chomp @makefiles;
@@ -296,7 +304,11 @@ my %modules;
 
 if (defined($lsmod_file)) {
     if ( ! -f $lsmod_file) {
-       die "$lsmod_file not found";
+       if ( -f $ENV{'objtree'}."/".$lsmod_file) {
+           $lsmod_file = $ENV{'objtree'}."/".$lsmod_file;
+       } else {
+               die "$lsmod_file not found";
+       }
     }
     if ( -x $lsmod_file) {
        # the file is executable, run it
@@ -421,7 +433,11 @@ while(<CIN>) {
 
     if (/^(CONFIG.*)=(m|y)/) {
        if (defined($configs{$1})) {
-           $setconfigs{$1} = $2;
+           if ($localyesconfig) {
+               $setconfigs{$1} = 'y';
+           } else {
+               $setconfigs{$1} = $2;
+           }
        } elsif ($2 eq "m") {
            print "# $1 is not set\n";
            next;