diff options
Diffstat (limited to 'v4l/scripts/make_kconfig.pl')
-rwxr-xr-x | v4l/scripts/make_kconfig.pl | 73 |
1 files changed, 70 insertions, 3 deletions
diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index 91c37693f..b1d6f5d53 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -1,10 +1,10 @@ #!/usr/bin/perl use FileHandle; -my $ARCH=shift; - my %depend = (); +my %minver = (); my %config = (); +my $version, $level, $sublevel; sub add_config($) { @@ -33,6 +33,7 @@ sub check_deps($) sub open_kconfig($$) { my ($dir,$file)=@_; my $in = new FileHandle; + my $skip=0; #print "opening $file\n"; open $in,"$file"; @@ -51,15 +52,78 @@ sub open_kconfig($$) { check_deps ($1); } if (m|^\s*config (.*)\n|) { + my $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) ) { + $skip=1; + printf "$key requires version $minversion.$minlevel.$minsublevel\n"; + + print OUT "# $key disabled due to incorrect version\nconfig $key\n\ttristate\n\tdefault n\n\n"; + next; + } else { +# printf "OK: $key requires version $minversion.$minlevel.$minsublevel\n"; + $skip=0; + } } s/^main(menu\s\"[^\"]+)/\1 - DON'T CHANGE IT!/; - print OUT $_; + if (m/^[\w]/) { + $skip=0; + } + if (!$skip) { + print OUT $_; + } + } + close $in; +} + +sub parse_versions () +{ + my $in = new FileHandle; + my $ver; + + open $in,"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); + } } close $in; } +parse_versions; + +open IN,".version"; +while (<IN>) { + if (m/KERNELRELEASE\s*[:]*[=]+\s*(\d+)\.(\d+)\.(\d+)/) { + $version=$1; + $level=$2; + $sublevel=$3; + } +} +close IN; + +printf "Preparing to compile for kernel version %d.%d.%d\n",$version,$level,$sublevel; + open OUT,">Kconfig"; print OUT "mainmenu \"V4L/DVB menu\"\n"; @@ -73,6 +137,9 @@ while ( my ($key, $value) = each(%config) ) { } open OUT,">Kconfig.kern"; + +print OUT "config MODULES\n\tboolean\n\tdefault y\n\n"; + while ( my ($key, $value) = each(%depend) ) { print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault m\n\n"; } |