diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-04-07 19:05:42 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-04-07 19:05:42 -0300 |
commit | d90bd3ff0cbd895065afc24bb83501e97c844cd0 (patch) | |
tree | 2862c9b8cbb9ee8d2722f99c5bf4d538ede45287 /v4l/scripts | |
parent | f8d3d508803c4ce572d52d5a5aa24163f60275ab (diff) | |
download | mediapointer-dvb-s2-d90bd3ff0cbd895065afc24bb83501e97c844cd0.tar.gz mediapointer-dvb-s2-d90bd3ff0cbd895065afc24bb83501e97c844cd0.tar.bz2 |
Big changes at v4l-dvb make internal working
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Previously, tree building were based on Make.config. This file contained all
compiling stuff. Also, v4l/Makefile contained all drivers that should be
copiled, replicating the rules of all other Makefiles under linux.
Now, make will rely on linux/*/Makefile to compile the modules. This approach
allows usage of Kconfig files, allowing partial compilations.
Newer makefile commands introduced:
make allmodconfig - Selects all stuff to be compiled as module;
make config - Selects packages via text interface;
make xconfig - Selects packages via qt interface;
make gconfig - selects packages via gtk interface.
for config, xconfig and gconfig to be used, those scripts needs to be previously
compiled at kernel. So, user needs to use those commands previously at kernel tree.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l/scripts')
-rwxr-xr-x | v4l/scripts/make_kconfig.pl | 73 | ||||
-rw-r--r-- | v4l/scripts/make_makefile.pl | 109 | ||||
-rw-r--r-- | v4l/scripts/make_noconfig.pl | 60 |
3 files changed, 239 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"; } diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl new file mode 100644 index 000000000..135b8bdb1 --- /dev/null +++ b/v4l/scripts/make_makefile.pl @@ -0,0 +1,109 @@ +#!/usr/bin/perl +use FileHandle; + +sub check_line($$$) +{ + my $dir=shift; + my $obj=shift; + my $arg=shift; + my $arg2=""; + + $arg=$arg." "; + + while ($arg ne "") { + if ($arg =~ m|^([^ /]+)/ |) { + my $newdir=$1; +# print "include $dir/$newdir/Makefile\n"; + open_makefile("$dir/$newdir/Makefile"); + $arg =~ s/^[^ ]+ //; + } else { + $arg =~ s/^([^ ]+ )//; + $arg2 = $arg2.$1; + } + } + $arg2 =~ s/\s+$//; + if ($arg2 ne "") { +# print "arg=$arg2\n"; + print OUT "$obj$arg2\n"; + } +} + +sub remove_includes($$) +{ + my $obj=shift; + my $arg=shift; + my $arg2=""; + + $arg=$arg." "; + + while ($arg ne "") { + if (!$arg =~ m|^(-I\s*[^ ]+) |) { + $arg2 = $arg2.$1; + $arg =~ s|^[^ ] ||; + } else { + $arg =~ s|^(-I\s*[^ ]+) ||; + } + } + if ($arg2 ne "") { + print OUT "$obj$arg2\n"; + } +} + +sub open_makefile($) { + my $file= shift; + my $in = new FileHandle; + my $dir= ""; + my $count=0; + + $file=~ m|^(.*)/[^/]*$|; + $dir=$1; + +#print "opening $file (dir=$dir)\n"; + open $in,"$file"; + + while (<$in>) { + if (m|\s*#|) { + print OUT $_; + next; + } + if (m|^\s*include|) { + next; + } + if (count==1 || m|(^\s*EXTRA_CFLAGS.*=\s*)(.*/.*)\n|) { + remove_includes($1,$2); + if (m|[\\]\n|) { + $count=1; + } else { + $count=0; + } + next; + } +# if (m|(^\s*obj.*=\s*)(.*/.*)\n|) { + if (count==2 || m|(^\s*obj.*=\s*)(.*)\n|) { + check_line($dir,$1,$2); + if (m|\\\n|) { + $count=1; + } else { + $count=0; + } + next; + } + print OUT $_; + } + close $in; +} + +open OUT,">Makefile.media"; +open_makefile ("../linux/drivers/media/Makefile"); +close OUT; + +while ( my ($key, $value) = each(%config) ) { + delete $depend{$key}; +} + +open OUT,">Kconfig.kern"; +while ( my ($key, $value) = each(%depend) ) { + print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault m\n\n"; +} +close OUT; + diff --git a/v4l/scripts/make_noconfig.pl b/v4l/scripts/make_noconfig.pl new file mode 100644 index 000000000..503653a4f --- /dev/null +++ b/v4l/scripts/make_noconfig.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl + +my $config = (); + +open IN,".config"; +while (<IN>) { + if (m/\s*([\d\w_]+)[=](.*)\n/) { +#printf "%s=%s\n",$1,$2; + $config { $1 } = $2; + } +} +close IN; + +open IN,".version"; +while (<IN>) { + if (m/KERNELRELEASE\s*[:]*[=]+\s*(\d+)\.(\d+)\.(\d+)/) { + $version=$1; + $level=$2; + $sublevel=$3; + } +} +close IN; + +open IN,"versions.txt"; +while (<IN>) { + if (m/\[(\d+)\.(\d+)\.(\d+)\]/) { + $minversion=$1; + $minlevel=$2; + $minsublevel=$3; + next; + } + s/\n//; + + if (m/DVB_AV7110_FIRMWARE/) { + next; + } + 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; + +open OUT,">.myconfig"; +while ( my ($key, $value) = each(%config) ) { + printf OUT "%-44s := %s\n",$key,$value; +} +close OUT; |