From d90bd3ff0cbd895065afc24bb83501e97c844cd0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Apr 2006 19:05:42 -0300 Subject: Big changes at v4l-dvb make internal working From: Mauro Carvalho Chehab 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 --- v4l/scripts/make_kconfig.pl | 73 +++++++++++++++++++++++++++-- v4l/scripts/make_makefile.pl | 109 +++++++++++++++++++++++++++++++++++++++++++ v4l/scripts/make_noconfig.pl | 60 ++++++++++++++++++++++++ 3 files changed, 239 insertions(+), 3 deletions(-) create mode 100644 v4l/scripts/make_makefile.pl create mode 100644 v4l/scripts/make_noconfig.pl (limited to 'v4l/scripts') 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 () { + 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 () { + if (m/\s*([\d\w_]+)[=](.*)\n/) { +#printf "%s=%s\n",$1,$2; + $config { $1 } = $2; + } +} +close IN; + +open IN,".version"; +while () { + if (m/KERNELRELEASE\s*[:]*[=]+\s*(\d+)\.(\d+)\.(\d+)/) { + $version=$1; + $level=$2; + $sublevel=$3; + } +} +close IN; + +open IN,"versions.txt"; +while () { + 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; -- cgit v1.2.3 From 8e830d2f4fd6b430ec05e6dd6ec98d32aa2d0fc6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Apr 2006 19:10:14 -0300 Subject: Now, make all will replicate old behavior From: Mauro Carvalho Chehab make all will do allmodconfig before compiling Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_makefile.pl | 0 v4l/scripts/make_noconfig.pl | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 v4l/scripts/make_makefile.pl mode change 100644 => 100755 v4l/scripts/make_noconfig.pl (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl old mode 100644 new mode 100755 diff --git a/v4l/scripts/make_noconfig.pl b/v4l/scripts/make_noconfig.pl old mode 100644 new mode 100755 -- cgit v1.2.3 From 05b97b078973c39870f58b53238dca456d2b43d7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 8 Apr 2006 11:01:58 -0300 Subject: Fix make install From: Mauro Carvalho Chehab Previous patch broke make install. This patch fix it. Also, serveral cleanups were made at core Makefile. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_makefile.pl | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index 135b8bdb1..48552c425 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -1,6 +1,8 @@ #!/usr/bin/perl use FileHandle; +my $instdir = (); + sub check_line($$$) { my $dir=shift; @@ -8,6 +10,10 @@ sub check_line($$$) my $arg=shift; my $arg2=""; + my $idir = $dir; + + $idir =~ s|^../linux/drivers/media/||; + $arg=$arg." "; while ($arg ne "") { @@ -18,7 +24,15 @@ sub check_line($$$) $arg =~ s/^[^ ]+ //; } else { $arg =~ s/^([^ ]+ )//; - $arg2 = $arg2.$1; + my $cur=$1; + $arg2 = $arg2.$cur; + $cur =~ s/\s+$//; + $cur =~ s/\\$//; + $cur =~ s/\s+$//; + $cur =~ s/\.o$/.ko/; + if ( ($cur ne "") && (! ($instdir { $idir } =~ m/($cur) /))) { + $instdir { $idir } = $instdir { $idir }.$cur." "; + } } } $arg2 =~ s/\s+$//; @@ -95,10 +109,32 @@ sub open_makefile($) { open OUT,">Makefile.media"; open_makefile ("../linux/drivers/media/Makefile"); + +# Creating Install rule +printf OUT "install::\n"; +printf OUT "\t@strip --strip-debug \$(inst-m)\n\n"; + +while ( my ($key, $value) = each(%instdir) ) { + printf OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$key files\\n\"\n"; + printf OUT "\t-install -d \$(KDIR26)/$key\n"; + printf OUT "\t-install -m 644 -c $value \$(KDIR26)/$key\n\n"; +} + +# Creating Remove rule +printf OUT "remove::\n"; +printf OUT "\t\@echo -e \"\\nRemoving old \$(DEST) files\\n\"\n"; +printf OUT "\t-rm -r \$(DEST)\n\n"; + +while ( my ($key, $value) = each(%instdir) ) { + printf OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$key files\\n\"\n"; + printf OUT "\tcd \$(KDIR26)/$key\n"; + printf OUT "\t-rm $value\n\n"; +} + close OUT; while ( my ($key, $value) = each(%config) ) { - delete $depend{$key}; + delete $depend{$key}; } open OUT,">Kconfig.kern"; @@ -106,4 +142,3 @@ while ( my ($key, $value) = each(%depend) ) { print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault m\n\n"; } close OUT; - -- cgit v1.2.3 From b664cece1c397677d509fa9a41874464f5a44214 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 8 Apr 2006 11:47:00 -0300 Subject: Some cleanups at make install From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_makefile.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index 48552c425..1063617a1 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -26,10 +26,12 @@ sub check_line($$$) $arg =~ s/^([^ ]+ )//; my $cur=$1; $arg2 = $arg2.$cur; + $cur =~ s/\s+$//; $cur =~ s/\\$//; $cur =~ s/\s+$//; $cur =~ s/\.o$/.ko/; + if ( ($cur ne "") && (! ($instdir { $idir } =~ m/($cur) /))) { $instdir { $idir } = $instdir { $idir }.$cur." "; } @@ -115,9 +117,11 @@ printf OUT "install::\n"; printf OUT "\t@strip --strip-debug \$(inst-m)\n\n"; while ( my ($key, $value) = each(%instdir) ) { - printf OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$key files\\n\"\n"; + printf OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$key files\"\n"; printf OUT "\t-install -d \$(KDIR26)/$key\n"; - printf OUT "\t-install -m 644 -c $value \$(KDIR26)/$key\n\n"; + + printf OUT "\t\@files='$value'; "; + printf OUT "for i in \$\$files; do install -m 644 -c \$\$i \$(KDIR26)/$key; done\n\n"; } # Creating Remove rule @@ -127,8 +131,8 @@ printf OUT "\t-rm -r \$(DEST)\n\n"; while ( my ($key, $value) = each(%instdir) ) { printf OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$key files\\n\"\n"; - printf OUT "\tcd \$(KDIR26)/$key\n"; - printf OUT "\t-rm $value\n\n"; + printf OUT "\t\@files='$value'; "; + printf OUT "for i in \$\$files; do rm \$(KDIR26)/$key/\$\$i; done\n\n"; } close OUT; -- cgit v1.2.3 From f5a63349b2b9e0daf5c7a993792af521e3dda46f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 8 Apr 2006 16:05:48 -0300 Subject: Some cleanups at make install/make remove From: Mauro Carvalho Chehab Now, it won't generate errors for non-compiled objects. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_makefile.pl | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index 1063617a1..17ef048e7 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -114,25 +114,32 @@ open_makefile ("../linux/drivers/media/Makefile"); # Creating Install rule printf OUT "install::\n"; -printf OUT "\t@strip --strip-debug \$(inst-m)\n\n"; +#printf OUT "\t@strip --strip-debug \$(inst-m)\n\n"; while ( my ($key, $value) = each(%instdir) ) { - printf OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$key files\"\n"; - printf OUT "\t-install -d \$(KDIR26)/$key\n"; + printf OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$key files:\"\n"; + printf OUT "\t\@install -d \$(KDIR26)/$key\n"; printf OUT "\t\@files='$value'; "; - printf OUT "for i in \$\$files; do install -m 644 -c \$\$i \$(KDIR26)/$key; done\n\n"; + printf OUT "for i in \$\$files;do if [ -e \$\$i ]; then echo -n \"\$\$i \";"; + printf OUT " install -m 644 -c \$\$i \$(KDIR26)/$key; fi; done; echo;\n\n"; } # Creating Remove rule -printf OUT "remove::\n"; +printf OUT "remove rminstall::\n"; printf OUT "\t\@echo -e \"\\nRemoving old \$(DEST) files\\n\"\n"; -printf OUT "\t-rm -r \$(DEST)\n\n"; while ( my ($key, $value) = each(%instdir) ) { - printf OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$key files\\n\"\n"; + printf OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$key files:\"\n"; printf OUT "\t\@files='$value'; "; - printf OUT "for i in \$\$files; do rm \$(KDIR26)/$key/\$\$i; done\n\n"; + + printf OUT "for i in \$\$files;do if [ -e \$(KDIR26)/$key/\$\$i ]; then "; + printf OUT "echo -n \"\$\$i \";"; + printf OUT " rm \$(KDIR26)/$key/\$\$i; fi; done; "; + + printf OUT "for i in \$\$files;do if [ -e \$(KDIR26)/$key/\$\$i.gz ]; then "; + printf OUT "echo -n \"\$\$i.gz \";"; + printf OUT " rm \$(KDIR26)/$key/\$\$i.gz; fi; done; echo;\n\n"; } close OUT; -- cgit v1.2.3 From 8e43b1719bccf0441257cd803e36d75e34e55d9f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 9 Apr 2006 13:02:02 -0300 Subject: If .myconfig is not found, make will do allmodconfig. From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_makefile.pl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index 17ef048e7..116df3394 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -153,3 +153,11 @@ while ( my ($key, $value) = each(%depend) ) { print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault m\n\n"; } close OUT; + +if (open OUT,".myconfig") { + close IN; +} else { + system "make allmodconfig"; +} + + -- cgit v1.2.3 From 6f35eb920300b903a0078d2ca191d1ea9cd7a15f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 9 Apr 2006 19:05:36 -0300 Subject: Newer drivers now compile fine with 2.6.14 kernel. From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_noconfig.pl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_noconfig.pl b/v4l/scripts/make_noconfig.pl index 503653a4f..a47ca4acf 100755 --- a/v4l/scripts/make_noconfig.pl +++ b/v4l/scripts/make_noconfig.pl @@ -55,6 +55,9 @@ close IN; open OUT,">.myconfig"; while ( my ($key, $value) = each(%config) ) { + if ($value eq "y") { + $value="m"; + } printf OUT "%-44s := %s\n",$key,$value; } close OUT; -- cgit v1.2.3 From 91263e7de241ee6403c43cd3a13206f749798ba6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 13 Apr 2006 18:50:22 -0300 Subject: Added missing depmod after the end of installation process From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_makefile.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index 116df3394..8371f6a4a 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -124,6 +124,7 @@ while ( my ($key, $value) = each(%instdir) ) { printf OUT "for i in \$\$files;do if [ -e \$\$i ]; then echo -n \"\$\$i \";"; printf OUT " install -m 644 -c \$\$i \$(KDIR26)/$key; fi; done; echo;\n\n"; } +printf OUT "\t/sbin/depmod -a \${KERNELRELEASE}\n\n"; # Creating Remove rule printf OUT "remove rminstall::\n"; -- cgit v1.2.3