This mainly changes the way make_kconfig.pl handles config options that require a newer kernel, as defined by versions.txt. Currently it outputs a blank config stanza defining the variable and setting it to 'n'. These show up as mysterious un-named grayed out options in xconfig, or just don't appear at all in menuconfig. The new method outputs an extra config stanza to the top of v4l/Kconfig, VIDEO_KERNEL_VERSION. This boolean variable defaults to 'n', and if enabled, allows selecting drivers that are listed as needing a newer kernel. Config options that need a newer kernel still apear in v4l/Kconfig with their names and help text, but they now have an additional dependency on VIDEO_KERNEL_VERSION, and an extra bit in the help text warning that they need a newer kernel. They will appear greyed out in xconfig, but will still have their proper names and help text. If the user turns VIDEO_KERNEL_VERSION on, then they can be enabled. The kernel version in versions.txt tends to be somewhat conservative. The default v4l/.config file generated by make_kconfig.pl will have these options set to no, instead of yes/module as it did before. make_noconfig.pl will no longer look at versions.txt, or deal with kernel version detection. It will get a list of all config options by reading v4l/Kconfig, and produce .myconfig by setting all bool/tristate options to their value from v4l/.config, or 'n' if not listed. A few bugs have been fixed, and the regexs adjusted. They were making a few mistakes before, or were otherwise flawed. The scripts do more error checking that the files they parse conform to the expected syntax.
# HG changeset patch # User Trent Piepho <xyzzy@xxxxxxxxxxxxx> # Node ID 57cd731b3bee056d91e3b6d2320a96cc85e19360 # Parent f13ca4ca086e0a8d3e95785d3884614062aa4c73 Improve v4l configuration scripts, handle versions.txt differently From: Trent Piepho <xyzzy@xxxxxxxxxxxxx> This mainly changes the way make_kconfig.pl handles config options that require a newer kernel, as defined by versions.txt. Currently it outputs a blank config stanza defining the variable and setting it to 'n'. These show up as mysterious un-named grayed out options in xconfig, or just don't appear at all in menuconfig. The new method outputs an extra config stanza to the top of v4l/Kconfig, VIDEO_KERNEL_VERSION. This boolean variable defaults to 'n', and if enabled, allows selecting drivers that are listed as needing a newer kernel. Config options that need a newer kernel still apear in v4l/Kconfig with their names and help text, but they now have an additional dependency on VIDEO_KERNEL_VERSION, and an extra bit in the help text warning that they need a newer kernel. They will appear greyed out in xconfig, but will still have their proper names and help text. If the user turns VIDEO_KERNEL_VERSION on, then they can be enabled. The kernel version in versions.txt tends to be somewhat conservative. The default v4l/.config file generated by make_kconfig.pl will have these options set to no, instead of yes/module as it did before. make_noconfig.pl will no longer look at versions.txt, or deal with kernel version detection. It will get a list of all config options by reading v4l/Kconfig, and produce .myconfig by setting all bool/tristate options to their value from v4l/.config, or 'n' if not listed. A few bugs have been fixed, and the regexs adjusted. They were making a few mistakes before, or were otherwise flawed. The scripts do more error checking that the files they parse conform to the expected syntax. Signed-off-by: Trent Piepho <xyzzy@xxxxxxxxxxxxx> diff -r f13ca4ca086e -r 57cd731b3bee v4l/scripts/make_kconfig.pl --- a/v4l/scripts/make_kconfig.pl Thu Jun 1 17:24:50 2006 -0700 +++ b/v4l/scripts/make_kconfig.pl Mon Jun 5 00:52:36 2006 -0700 @@ -14,6 +14,7 @@ sub add_bool($) { my $arg=shift; + exists $config{$arg} or die "Adding unknown boolean '$arg'"; $tristate{$arg}="bool"; # printf "Boolean:%s\n",$arg; } @@ -22,13 +23,17 @@ sub add_tristate($) { my $arg=shift; + exists $config{$arg} or die "Adding unknown tristate '$arg'"; $tristate{$arg}="tristate"; # printf "Tristate:%s\n",$arg; } sub add_int($) { - $intopt{$_[0]} = '0'; + my $arg=shift; + + exists $config{$arg} or die "Adding unknown int '$arg'"; + $intopt{$arg} = 0; } sub set_int_value($$) @@ -36,6 +41,7 @@ sub set_int_value($$) my $key = shift; my $val = shift; + exists $intopt{$key} or die "Default for unknown int option '$key'"; $intopt{$key} = $val; } @@ -43,9 +49,20 @@ sub add_config($) { my $arg=shift; - if ($arg =~ m/^([A-Z0-9_]+)/) { + if ($arg =~ m/^(\w+)/) { + # Have option default to 'on' $config{$1} = 1; - } + } else { + die "Do not understand config variable '$arg'"; + } +} + +# Turn option off, iff it already exists +sub disable_config($) +{ + my $key = shift; + + $config{$key} = 0 if (exists $config{$key}); } sub check_deps($) @@ -66,7 +83,7 @@ sub open_kconfig($$) { sub open_kconfig($$) { my ($dir,$file)=@_; my $in = new FileHandle; - my $skip=0; + my $disabled=0; my $key; #print "opening $file\n"; @@ -75,29 +92,61 @@ sub open_kconfig($$) { # if (m;^\s*source[\s\"]+drivers/media/(video|dvb)/Kconfig;) { # next; # } - if (m|^\s*source[\s\"]+([^\n\s\"]+)[\n\s\"]|) { + + # start of a new stanza, reset + if (m/^\w/) { + $disabled = 0; + $default_seen = 0; + $key = undef; + } + + if (m|^\s*source\s+"([^"]+)"\s*$| || + m|^\s*source\s+(\S+)\s*$|) { open_kconfig($dir,"$dir/$1"); next; } - if (m|^\s+depends on (.*)\n|) { + if (m|^\s+depends on\s+(.*)\n|) { check_deps ($1); } - if (m|^\s+select (.*)\n|) { + if (m|^\s+select\s+(.*)\n|) { check_deps ($1); } - if (m|^\s*bool\s+|) { + if (m|^\s+bool(ean)?\s|) { add_bool($key); } - if (m|^\s*tristate\s+|) { + if (m|^\s+tristate\s|) { add_tristate($key); } - if (m|^\s*int\s|) { + if (m|^\s+int\s|) { add_int($key); } - if (m|^\s*default "(\d+)"| && exists $intopt{$key}) { + # Get default for int options + if (m|^\s+default "(\d+)"| && exists $intopt{$key}) { set_int_value($key, $1); } - if (m|^\s*config (.*)\n|) { + # Override default for disabled tri/bool options + if (m/^\s+default (y|n|m|"yes"|"no")\s+(if .*)?$/ && + exists $tristate{$key} && $disabled) { + $default_seen = 1; + $_ = "\tdefault n\n"; + } + + # check for end of config definition for disabled drivers + # we need to make sure we've disabled it, and add a bit + # to the help text + if (m|^\s*(---)?help(---)?\s*$| && $disabled) { + print OUT "\tdefault n\n" unless($default_seen); + print OUT <<"EOF"; + depends on VIDEO_KERNEL_VERSION + help + WARNING! This driver needs at least kernel $minver{$key}! It may not + compile or work correctly on your kernel, which is too old. + +EOF + next; + } + + if (m|^\s*config (\w+)\s*$|) { $key=$1; add_config ($1); @@ -110,27 +159,22 @@ sub open_kconfig($$) { } else { die "Minimum version for $key not found at versions.txt"; } - if ( ($version < $minversion) | - ($level < $minlevel) | + 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; + $disabled=1; + disable_config ($key); + print "$key requires version $minversion.$minlevel.$minsublevel\n"; + print OUT "# $key disabled for insufficient kernel version\n"; } else { -# printf "OK: $key requires version $minversion.$minlevel.$minsublevel\n"; - $skip=0; +# print "OK: $key requires version $minversion.$minlevel.$minsublevel\n"; + $disabled=0; } } s/^main(menu\s\"[^\"]+)/\1 - DON'T CHANGE IT!/; - if (m/^[\w]/) { - $skip=0; - } - if (!$skip) { - print OUT $_; - } + + print OUT $_; } close $in; } @@ -170,9 +214,28 @@ printf "Preparing to compile for kernel printf "Preparing to compile for kernel version %d.%d.%d\n",$version,$level,$sublevel; open OUT,">Kconfig"; -print OUT "mainmenu \"V4L/DVB menu\"\n"; - -print OUT "source Kconfig.kern\n"; + +print OUT <<"EOF"; +mainmenu "V4L/DVB menu" +source Kconfig.kern +config VIDEO_KERNEL_VERSION + bool "Enable drivers not supported by this kernel" + default n + ---help--- + Normally drivers that require a kernel newer $version.$level.$sublevel, + the kernel you are compiling for now, will be disabled. + + Turning this switch on will let you enabled them, but be warned + they may not work properly or even compile. + + They may also work fine, and the only reason they are listed as + requiring a newer kernel is that no one has tested them with an + older one yet. + + Unless you know what you are doing, you should answer N. + +EOF + open_kconfig ("../linux","../linux/drivers/media/Kconfig"); close OUT; @@ -183,26 +246,28 @@ open OUT,">Kconfig.kern"; open OUT,">Kconfig.kern"; print OUT "config MODULES\n\tboolean\n\tdefault y\n\n"; -$tristate{"MODULES"}="bool"; +add_config('MODULES'); +add_bool('MODULES'); while ( my ($key, $value) = each(%depend) ) { print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault m\n\n"; } close OUT; +# These options should default to off +disable_config('DVB_AV7110_FIRMWARE'); +disable_config('DVB_CINERGYT2_TUNING'); + +# Produce a .config file if it's forced or one doesn't already exist if (($force_kconfig eq 1) || !open IN,".config") { open OUT,">.config"; while ( my ($key,$value) = each(%tristate) ) { - - if ( ($key eq "DVB_AV7110_FIRMWARE") || - ($key eq "DVB_CINERGYT2_TUNING") ) { - printf OUT "CONFIG_%s=n\n",$key; - } else { - if ($value eq "tristate") { - printf OUT "CONFIG_%s=m\n",$key; - } else { - printf OUT "CONFIG_%s=y\n",$key; - } + if (!$config{$key}) { + print OUT "CONFIG_$key=n\n"; + } elsif ($value eq 'tristate') { + print OUT "CONFIG_$key=m\n"; + } else { # must be 'bool' + print OUT "CONFIG_$key=y\n"; } } while ( my ($key,$value) = each(%intopt) ) { diff -r f13ca4ca086e -r 57cd731b3bee v4l/scripts/make_noconfig.pl --- a/v4l/scripts/make_noconfig.pl Thu Jun 1 17:24:50 2006 -0700 +++ b/v4l/scripts/make_noconfig.pl Mon Jun 5 00:52:36 2006 -0700 @@ -1,57 +1,40 @@ #!/usr/bin/perl -my $config = (); +my %config = (); +my %allconfig = (); open IN,".config"; while (<IN>) { - if (m/\s*([\d\w_]+)[=](.*)\n/) { + if (m/\s*(\w+)=\s*(\S*)/) { #printf "%s=%s\n",$1,$2; $config { $1 } = $2; } } close IN; -open IN,".version"; +# Build table of _all_ bool and tristate config variables +open IN,"Kconfig"; while (<IN>) { - if (m/KERNELRELEASE\s*[:]*[=]+\s*(\d+)\.(\d+)\.(\d+)/) { - $version=$1; - $level=$2; - $sublevel=$3; - } + if (/^config\s+(\w+)\s*$/) { + $key = "CONFIG_$1"; + } elsif (/^\s+bool(ean)?\s/) { + $allconfig{$key} = 'bool'; + $key = 0; + } elsif (/^\s+tristate\s/) { + $allconfig{$key} = 'tristate'; + $key = 0; + } + # else, must be int or string, ignore } close IN; -open IN,"versions.txt"; -while (<IN>) { - if (m/\[(\d+)\.(\d+)\.(\d+)\]/) { - $minversion=$1; - $minlevel=$2; - $minsublevel=$3; - next; - } - s/\n//; +exists $allconfig{0} and die "Unable to correctly parse Kconfig file"; - if (m/DVB_AV7110_FIRMWARE_FILE/) { - next; - } - if (m/^\s*([\w\d_]+)/) { - if ( ($version < $minversion) | - ($level < $minlevel) | - ($sublevel < $minsublevel) ) { - $config { "CONFIG_$1" } = 'n'; -#print "CONFIG_$1 version is not supported\n"; - next; - } - if (!($config { "CONFIG_$1" } ) ) { -print "CONFIG_$1 is unset\n"; - $config { "CONFIG_$1" } = 'n'; - } - } -} -close IN; - +# Produce output for including in a Makefile +# Explicitly set options that didn't appear in .config to n open OUT,">.myconfig"; -while ( my ($key, $value) = each(%config) ) { +while ( my ($key, $value) = each(%allconfig) ) { + $value = exists $config{$key} ? $config{$key} : 'n'; printf OUT "%-44s := %s\n",$key,$value; } close OUT;
_______________________________________________ linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb