summaryrefslogtreecommitdiff
path: root/v4l
diff options
context:
space:
mode:
Diffstat (limited to 'v4l')
-rw-r--r--v4l/.cvsignore7
-rw-r--r--v4l/Makefile20
-rw-r--r--v4l/compat.h1
-rwxr-xr-xv4l/scripts/gentree.pl77
-rwxr-xr-xv4l/scripts/makelinks.sh2
5 files changed, 71 insertions, 36 deletions
diff --git a/v4l/.cvsignore b/v4l/.cvsignore
deleted file mode 100644
index 88be5bcbc..000000000
--- a/v4l/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-*.ko
-*.o.flags
-*.mod.c
-.*.cmd
-.version
-.snapshot
-.tmp_versions
diff --git a/v4l/Makefile b/v4l/Makefile
index 58b160397..3ba4603f3 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -25,7 +25,7 @@ endif
#################################################
# default compilation rule
-default:: Makefile.media links .version
+default:: config-compat.h Makefile.media links .version
echo srcdir $(SRCDIR)
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules
@@ -188,6 +188,22 @@ links::
@find ../linux/drivers/media -name '*.[ch]' -type f -exec ln -sf '{}' . \;
@find ../linux/sound -name '*.[ch]' -type f -exec ln -sf '{}' . \;
+config-compat.h:: .myconfig
+ @echo \#ifndef __CONFIG_COMPAT_H__ > config-compat.h
+ @echo \#define __CONFIG_COMPAT_H__ >> config-compat.h
+ @echo >> config-compat.h
+ @echo \#include \<linux\/config\.h\> >> config-compat.h
+ @echo >> config-compat.h
+ @grep "CONFIG\_" .myconfig | grep -v "\:\= n" | \
+ sed s/"CONFIG\_"/"\#undef CONFIG\_"/1 | \
+ sed s/"\:\= ."/""/1 >> config-compat.h >> config-compat.h
+ @echo >> config-compat.h
+ @grep "CONFIG\_" .myconfig | grep -v "\:\= n" | \
+ sed s/"CONFIG\_"/"\#define CONFIG\_"/1 | \
+ sed s/"\:\="/""/1 >> config-compat.h >> config-compat.h
+ @echo >> config-compat.h
+ @echo \#endif >> config-compat.h
+
kernel-links makelinks::
cd ..; v4l/scripts/makelinks.sh $(KDIR)
@@ -204,7 +220,7 @@ clean::
@find . -name '*.c' -type l -exec rm '{}' \;
@find . -name '*.h' -type l -exec rm '{}' \;
-rm -f *~ *.o *.ko .*.o.cmd .*.ko.cmd *.mod.c av7110_firm.h fdump \
- ivtv-svnversion.h
+ ivtv-svnversion.h config-compat.h
distclean:: clean
-rm -f .version .*.o.flags .*.o.d Makefile.media \
diff --git a/v4l/compat.h b/v4l/compat.h
index 0bcb238fb..b9138c7be 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -10,6 +10,7 @@
#include <linux/version.h>
#include <linux/utsname.h>
#include <linux/sched.h>
+#include "config-compat.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
# define minor(x) MINOR(x)
diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl
index 0ae296b93..de91722a7 100755
--- a/v4l/scripts/gentree.pl
+++ b/v4l/scripts/gentree.pl
@@ -2,12 +2,10 @@
use strict;
use File::Find;
use Fcntl ':mode';
-use Cwd;
my $VER = shift;
my $SRC = shift;
my $DESTDIR = shift;
-my $cwd;
my $extra;
@@ -70,9 +68,9 @@ sub filter_source ($$) {
if ($line =~ m/^#include \"compat.h\"/) {
next;
}
- if ($line =~ m/[\$]Id:/) {
- next;
- }
+# if ($line =~ m/[\$]Id:/) {
+# next;
+# }
if ($line =~ /^#ifdef MM_KERNEL/) {
chomp($line);
$state{$level} = "if";
@@ -81,8 +79,12 @@ sub filter_source ($$) {
$level++;
next;
}
- if ($line =~ /^\s*#if 0\s.*[Kk][Ee][Ee][Pp].*/) {
- print OUT "#if 0\n";
+ if ($line =~ m|^\s*\#if\s+0\s*\/[\*]\s*[Kk][Ee].[Pp]\s*[\*]\/(.*)|) {
+ if ($1 eq ";") {
+ print OUT "#if 0\n";
+ } else {
+ print OUT "#if 0$1\n";
+ }
chomp($line);
$state{$level} = "ifother";
$if{$level} = 0;
@@ -90,6 +92,30 @@ sub filter_source ($$) {
$level++;
next;
}
+ if ($line =~ /^#ifdef\sSTV0297_CS2/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 0;
+ print STDERR "/* BP #if 0 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
+ if ($line =~ /^#ifndef\sBROKEN_XAWTV/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 1;
+ print STDERR "/* BP #if 0 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
+ if ($line =~ /^#ifndef\sSTV0297_CS2/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 1;
+ print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
if ($line =~ /^#if 0/) {
chomp($line);
$state{$level} = "if";
@@ -98,8 +124,8 @@ sub filter_source ($$) {
$level++;
next;
}
- if ($line =~ /^#if 1\s.*[Kk][Ee][Ee][Pp].*/) {
- print OUT "#if 1\n";
+ if ($line =~ m|^\s*\#if\s+1\s*\/[\*]\s*[Kk][Ee].[Pp]\s*[\*]\/(.*)|) {
+ print OUT "#if 1$1\n";
$state{$level} = "ifother";
$if{$level} = 1;
print STDERR "/* BP #if 1 (keep) state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
@@ -122,15 +148,15 @@ sub filter_source ($$) {
$level++;
next;
}
- if ($line =~ /^#if.*I2C_CLASS_TV_ANALOG/) {
+ if ($line =~ /^#if.*CONFIG_XC3028/) {
chomp($line);
$state{$level} = "if";
- $if{$level} = 1;
+ $if{$level} = 0;
print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
$level++;
next;
}
- if ($line =~ /^#ifndef.\s*I2C_DF_DUMMY/) {
+ if ($line =~ /^#if.*I2C_CLASS_TV_ANALOG/) {
chomp($line);
$state{$level} = "if";
$if{$level} = 1;
@@ -138,22 +164,22 @@ sub filter_source ($$) {
$level++;
next;
}
- if ($line =~ /^#if.*I2C_CLASS_TV_DIGITAL/) {
+ if ($line =~ /^#ifndef.\s*I2C_PEC/) {
chomp($line);
$state{$level} = "if";
- $if{$level} = 1;
+ $if{$level} = 0;
print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
$level++;
next;
}
- if ($line =~ /^#if.*CONFIG_XC3028/) {
+ if ($line =~ /^#if.*I2C_CLASS_TV_DIGITAL/) {
chomp($line);
$state{$level} = "if";
- $if{$level} = 0;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level$
+ $if{$level} = 1;
+ print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
$level++;
next;
- }
+ }
if ($line =~ /^#if.*BTTV_VERSION_CODE/) {
chomp($line);
$line =~ s@^#if\s*@@;
@@ -280,9 +306,7 @@ sub parse_dir {
return;
}
- my $mode = (lstat("$cwd/$file"))[2];
-
-# printf "Permissions of %s/%s are %04o (dir=%s\n", $cwd,$file, $mode, cwd;
+ my $mode = (lstat("$file"))[2];
if ($mode & S_IFDIR) {
return;
@@ -291,14 +315,14 @@ sub parse_dir {
$srcdir =~ s/(.)/\[$1\]/g;
my $f2 = $file;
- $f2 =~ s,^$srcdir,$cwd/$DESTDIR/,;
+ $f2 =~ s,^$srcdir,$DESTDIR/,;
print "from $file to $f2\n";
my $tmp = "/tmp/src.$$";
if ($file =~ m/.*\.[ch]$/) {
- filter_source("$cwd/$file","$tmp");
+ filter_source("$file","$tmp");
} else {
- system("cp $cwd/$file $tmp");
+ system("cp $file $tmp");
}
my $dir = $f2;
@@ -315,12 +339,11 @@ sub parse_dir {
my $patchtmploc = "/tmp/temp.patch";
-printf STDERR <<EOF,$VER,$CODE;
+printf <<EOF,$VER,$CODE;
kernel is %s (0x%x)
EOF
-print STDERR "finding files at $SRC\n";
+print "finding files at $SRC\n";
-$cwd=cwd;
find(\&parse_dir, $SRC);
diff --git a/v4l/scripts/makelinks.sh b/v4l/scripts/makelinks.sh
index a66989771..03fd48849 100755
--- a/v4l/scripts/makelinks.sh
+++ b/v4l/scripts/makelinks.sh
@@ -39,10 +39,12 @@ done
for x in `find include -type d | grep -v CVS` ; do
ln -f -s $PWD/../v4l/compat.h $1/$x/compat.h
+ touch $1/$x/config-compat.h
done
for x in `find drivers/media -type d | grep -v CVS` ; do
ln -f -s $PWD/../v4l/compat.h $1/$x/compat.h
+ touch $1/$x/config-compat.h
done
cd ..