summaryrefslogtreecommitdiff
path: root/v4l/scripts/make_kconfig.pl
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/scripts/make_kconfig.pl')
-rwxr-xr-xv4l/scripts/make_kconfig.pl95
1 files changed, 44 insertions, 51 deletions
diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl
index d5b34b36c..b203a2ac0 100755
--- a/v4l/scripts/make_kconfig.pl
+++ b/v4l/scripts/make_kconfig.pl
@@ -9,11 +9,13 @@ my %hexopt = ();
my %tristate = ();
my %kernopts = ();
my %depmods = ();
-my $version, $level, $sublevel;
+my $version, $level, $sublevel, $kernver;
my $kernel=shift;
my $force_kconfig=shift;
+#my $debug=1;
+
#!/usr/bin/perl
use FileHandle;
@@ -26,14 +28,10 @@ sub process_config ($)
open $in,"$kernel/include/$filename" or die "File not found: $kernel/include/$filename";
while (<$in>) {
- if (m|\#include\s+\<(.*)\>|) {
- process_config ($1);
- next;
- }
if (m/\#define\s+CONFIG_([^ ]*)_ON_SMP\s+(.*)\n/) {
my $key=$1;
my $value=$2;
-# printf "defined $key as $value\n";
+ printf "defined $key as $value\n" if $debug;
if ( $value == 1 ) {
$value='y';
}
@@ -43,7 +41,7 @@ sub process_config ($)
if (m/\#define\s+CONFIG_([^ ]*)_MODULE\s+(.*)\n/) {
my $key=$1;
my $value=$2;
-# printf "defined $key as $value\n";
+ printf "defined $key as $value\n" if $debug;
if ( $value == 1 ) {
$value='m';
}
@@ -53,7 +51,7 @@ sub process_config ($)
if (m/\#define\s+CONFIG_([^ ]*)\s+(.*)\n/) {
my $key=$1;
my $value=$2;
-# printf "defined $key as $value\n";
+ printf "defined $key as $value\n" if $debug;
if ( $value == 1 ) {
$value='y';
}
@@ -61,7 +59,7 @@ sub process_config ($)
next;
}
if (m/\#undef\s+CONFIG_([^ ]*)\n/) {
-# printf "undefined $1\n";
+ printf "undefined $1\n" if $debug;
$kernopts{$1}='n';
next;
}
@@ -76,7 +74,7 @@ sub add_bool($)
exists $config{$arg} or die "Adding unknown boolean '$arg'";
$tristate{$arg}="bool";
-# printf "Boolean:%s\n",$arg;
+ printf "Boolean:%s\n",$arg if $debug;
$kernopts{$arg}='y';
}
@@ -183,7 +181,7 @@ sub deps_ok($)
$arg=$arg." ";
-# printf "$key: deps are '$arg'\n";
+ printf "$key: deps are '$arg'\n" if $debug;
while ($arg ne "") {
if ($arg =~ m/^([A-Z0-9_]+) /) {
@@ -210,13 +208,9 @@ sub open_kconfig($$) {
my $disabled=0;
my $key;
-#print "opening $file\n";
+print "opening $file\n" if $debug;
open $in,"$file" or die "File not found: $file";
while (<$in>) {
-# if (m;^\s*source[\s\"]+drivers/media/(video|dvb)/Kconfig;) {
-# next;
-# }
-
# start of a new stanza, reset
if (m/^\w/) {
$disabled = 0;
@@ -229,12 +223,12 @@ sub open_kconfig($$) {
open_kconfig($dir,"$dir/$1");
next;
}
- if (m|^\s+depends on\s+(.*)\n|) {
- check_deps ($key,$1);
- }
- if (m|^\s+select\s+(.*)\n|) {
+ if (m|^\s+depends on\s+(.+?)\s*$|) {
check_deps ($key,$1);
}
+# if (m|^\s+select\s+(.+?)\s*(if .*?)?\s*$|) {
+# check_deps ($key,$1);
+# }
if (m|^\s+bool(ean)?\s|) {
add_bool($key);
}
@@ -282,24 +276,14 @@ EOF
$key=$1;
add_config ($1);
- my $min=$minver { $key };
- my $minversion, $minlevel, $minsublevel;
- if ($min =~ m/(\d+)\.(\d+)\.(\d+)/) {
- $minversion=$1;
- $minlevel=$2;
- $minsublevel=$3;
- } else {
- die "Minimum version for $key not found at versions.txt";
- }
- if ( ($version < $minversion) ||
- ($level < $minlevel) ||
- ($sublevel < $minsublevel) ) {
+ if (exists $minver{$key} &&
+ cmp_ver($minver{$key}, $kernver) > 0) {
$disabled=1;
disable_config ($key);
- print "$key requires version $minversion.$minlevel.$minsublevel\n";
+ print "$key requires version $minver{$key}\n";
print OUT "# $key disabled for insufficient kernel version\n";
} else {
-# print "OK: $key requires version $minversion.$minlevel.$minsublevel\n";
+ printf "OK: $key requires version %s\n", exists $minver{$key}?$minver{$key}:"any" if $debug;
$disabled=0;
}
}
@@ -318,20 +302,32 @@ sub parse_versions ()
open $in,"versions.txt" or die "File not found: versions.txt";
while (<$in>) {
- if (m/\[([\d.]*)\]/) {
- $ver=$1;
- next;
- }
- s/\n//;
- if (m/^\s*([\w\d_]+)/) {
- $minver { $1 } = $ver;
-# printf ("%s=%s\n",$1,$ver);
+ if (/\[(\d+\.\d+\.\d+)\]/) {
+ $ver = $1;
+ } elsif (/^\s*(\w+)/) {
+ $minver{$1} = $ver;
+ print "minimal version for $1 is $ver\n" if $debug;
}
}
close $in;
}
-process_config("linux/config.h");
+# Like ver1 <=> ver2, but understands X.Y.Z version strings
+sub cmp_ver($$)
+{
+ shift =~ /(\d+)\.(\d+)\.(\d+)/;
+ my ($v1_ver,$v1_level,$v1_sublevel) = ($1,$2,$3);
+ shift =~ /(\d+)\.(\d+)\.(\d+)/;
+ my ($v2_ver,$v2_level,$v2_sublevel) = ($1,$2,$3);
+
+ my $cmp = $v1_ver <=> $v2_ver;
+ return $cmp unless($cmp == 0);
+ $cmp = $v1_level <=> $v2_level;
+ return $cmp unless($cmp == 0);
+ return $v1_sublevel <=> $v2_sublevel;
+}
+
+process_config("linux/autoconf.h");
parse_versions;
@@ -341,11 +337,12 @@ while (<IN>) {
$version=$1;
$level=$2;
$sublevel=$3;
+ $kernver="$version.$level.$sublevel";
}
}
close IN;
-printf "Preparing to compile for kernel version %d.%d.%d\n",$version,$level,$sublevel;
+print "Preparing to compile for kernel version $kernver\n";
open OUT,">Kconfig" or die "Cannot write Kconfig file";
@@ -382,10 +379,6 @@ while ( my ($key, $value) = each(%config) ) {
open OUT,">Kconfig.kern" or die "Cannot write Kconfig.kern file";
-print OUT "config MODULES\n\tboolean\n\tdefault y\n\n";
-add_config('MODULES');
-add_bool('MODULES');
-
while ( my ($key, $value) = each(%depend) ) {
if ($kernopts{$key}) {
print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault ".
@@ -399,13 +392,14 @@ close OUT;
# These options should default to off
disable_config('DVB_AV7110_FIRMWARE');
disable_config('DVB_CINERGYT2_TUNING');
+disable_config('DVB_FE_CUSTOMISE');
# Hack for check sound/oss/aci.h header
my $mirodep="$kernel/sound/oss/aci.h";
-if (!open IN, $mirodep) {
+if (! -e $mirodep) {
my $key="RADIO_MIROPCM20";
-print <<"EOF2";
+ print <<"EOF2";
$key: $mirodep is missing.
***WARNING:*** You do not have the full kernel sources installed.
@@ -428,7 +422,6 @@ Please see your distro's web site for instructions to build a new kernel.
EOF2
$kernopts{$key}='n';
}
-close IN;
# Recursively check for broken dependencies
my $i;