From 0e5e865d415e3e6de0eb7a4199b22f954e591ea4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 19 Jun 2006 09:16:03 -0300 Subject: hex defaults in Kconfig sometimes have "0x", sometimes don't From: Trent Piepho A check of the current Linux 2.6 kernel reveals that the default values for hex options sometimes have the form "0x1f0" and sometimes "1f0", with the former being more common. Adjust the make_kconfig.pl script so it can understand both. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_kconfig.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'v4l') diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index 4511f0def..b499fefa1 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -146,8 +146,8 @@ sub open_kconfig($$) { set_int_value($key, $1); } # Get default for hex options - if (m|^\s+default "([[:xdigit:]]+)"| && exists $hexopt{$key}) { - set_hex_value($key, $1); + if (m|^\s+default "(0x)?([[:xdigit:]]+)"| && exists $hexopt{$key}) { + set_hex_value($key, $2); } # Override default for disabled tri/bool options if (m/^\s+default (y|n|m|"yes"|"no")\s+(if .*)?$/ && -- cgit v1.2.3 From d02b60987a9d04d3f7a58c04c1000797b8563b92 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 19 Jun 2006 19:49:57 -0300 Subject: Improved to accept also patches from akpm. From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/hghead.pl | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'v4l') diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 16e566ea9..3f8b4b0ba 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -12,6 +12,7 @@ my $sub_ok=0; my $init=0; my $num=0; my $hgimport=0; +my $mmimport=0; my $maint_ok=0; my $noblank=1; my $maintainer_name=$ENV{CHANGE_LOG_NAME}; @@ -33,6 +34,10 @@ while ($line = ) { if ($line =~ m/^\-\-\- .*/) { last; } + if ($line =~ m/^\-\-\-\-.*/) { + $body=""; + next; + } if ($line =~ m/^\-\-\-.*/) { last; } @@ -62,7 +67,11 @@ while ($line = ) { $from= "From: $fromname\n"; next; } - print "Bad: author line have a wrong syntax\n"; + if ($line =~ m/^From:\sakpm\@osdl.org/) { + $mmimport=1; + next; + } + print "Bad: author line have a wrong syntax: $line\n"; die; } @@ -87,11 +96,11 @@ while ($line = ) { $signed="$signed$line"; next; } - if ($line =~ m/^\# HG changeset patch/) { + if ( ($line =~ m/^\# HG changeset patch/) || + ($line =~ m/^has been added to the -mm tree. Its filename is/) ) { $sub_ok=0; $init=0; $num=0; - $hgimport=0; $maint_ok=0; $noblank=1; $from=""; @@ -100,6 +109,7 @@ while ($line = ) { $hgimport=1; next; } + if ($line =~ m/^Acked-by:.*/) { $signed="$signed$line"; @@ -164,8 +174,8 @@ if (!$signed =~ m/$from/) { die; } -$body=~s/\n+$//; -$body=~s/^\n+$//; +$body=~s/[\n\s]+$//; +$body=~s/^[\n\s]+//; # First from is used by hg to recognize commiter name print "#Committer: $maintainer_name <$maintainer_email>\n"; -- cgit v1.2.3 From 5da0337a0500257e93259472d26bca4ca9a6be9a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 20 Jun 2006 00:24:50 -0300 Subject: Faster strip whitespace cleaning script From: Trent Piepho Faster script that doesn't use any temporary files. The old one would also miss cleaning four spaces in a row in places where it would clean one to eight spaces. Has two options: fast Only clean whitespace in files Hg thinks are modified or added. Used by make whitespace and much (about 100x) faster. manifest Clean all files controlled by Hg, using "hg manifest" The default with no options is the old behaviour, clean all files under the linux directory, except CVS files. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/strip-trailing-whitespaces.sh | 56 +++++++++++++------------------ 1 file changed, 23 insertions(+), 33 deletions(-) (limited to 'v4l') diff --git a/v4l/scripts/strip-trailing-whitespaces.sh b/v4l/scripts/strip-trailing-whitespaces.sh index 1a23e436d..5bd7784e4 100755 --- a/v4l/scripts/strip-trailing-whitespaces.sh +++ b/v4l/scripts/strip-trailing-whitespaces.sh @@ -1,37 +1,27 @@ #!/bin/sh +# Strips trailing whitespace. Leading spaces and spaces after tabs are +# converted to the equivalent sequence of tabs only. -# tmp dir for my files -WORK="${TMPDIR-/tmp}/${0##*/}-$$" -mkdir "$WORK" || exit 1 -trap 'rm -rf "$WORK"' EXIT +# Use the option "fast" to only check files Hg thinks are new or modified. +# The option "manifest" will use Hg's manifest command to check all files +# under Hg revision control. +# Otherwise, all files under the linux tree are checked, except files in CVS +# directories and .cvsignore files. This is the historical behavior. -for file in `find linux -type d | grep -v CVS | grep -v .cvsignore` ; do - mkdir -p "$WORK/${file}" -done -for file in `find linux -type f | grep -v CVS | grep -v .cvsignore` ; do - tmpfile="$WORK/${file}.$$" - perl -ne 's/[ \t]+$//; - s/^\ \ \ \ \ \ \ \ /\t/; - s/^\ \ \ \ \ \ \ \t/\t/; - s/^\ \ \ \ \ \ \t/\t/; - s/^\ \ \ \ \ \t/\t/; - s/^\ \ \ \t/\t/; - s/^\ \ \t/\t/; - s/^\ \t/\t/; - $m=1; - while ($m>0) { - $m=0; - $m= s/\t\ \ \ \ \ \ \ \ /\t\t/g; - $m=$m+s/\t\ \ \ \ \ \ \ \t/\t\t/g; - $m=$m+s/\t\ \ \ \ \ \ \t/\t\t/g; - $m=$m+s/\t\ \ \ \ \ \t/\t\t/g; - $m=$m+s/\t\ \ \ \t/\t\t/g; - $m=$m+s/\t\ \ \t/\t\t/g; - $m=$m+s/\t\ \t/\t\t/g; - } - print' < "${file}" > "${tmpfile}" - diff -u "${file}" "${tmpfile}" | sed \ - -e "s|^--- ${file}|--- ${file}.orig|" \ - -e "s|^+++ ${tmpfile}|+++ ${file}|" - rm -f "$tmpfile" + +if [ "x$1" = "xfast" ]; then + files="hg status -man" +elif [ "x$1" = "xmanifest" ]; then + files="hg manifest | cut '-d ' -f3" +else + files="find linux -name CVS -prune -o -type f -not -name .cvsignore -print" +fi + +for file in `eval $files`; do + perl -ne ' + s/[ \t]+$//; + s<^ {8}> <\t>; + s<^ {1,7}\t> <\t>; + while( s<\t {8}> <\t\t>g || s<\t {1,7}\t> <\t\t>g ) {}; + print' < "${file}" | diff -u "${file}" - done -- cgit v1.2.3 From ecddc353539730fcf011b1e9d60ba3acca577e04 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 20 Jun 2006 13:17:11 -0300 Subject: Makefile.media were rewritten even when not required. From: Mauro Carvalho Chehab make 3.81 were suffering some endless loop that might be caused by Makefile.media rewrites. After this patch, make_makefile will only write Makefile.media if needed. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_makefile.pl | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'v4l') diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index 238c5082f..bcfb3764f 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -109,7 +109,7 @@ sub open_makefile($) { close $in; } -open OUT,">Makefile.media"; +open OUT,">Makefile.media.new"; open_makefile ("../linux/drivers/media/Makefile"); # Creating Install rule @@ -156,7 +156,29 @@ while ( my ($key, $value) = each(%depend) ) { } close OUT; -if (open OUT,".myconfig") { +if (open IN,"Makefile.media") { + close IN; + my $changed=0; + if (open IN,"diff Makefile.media Makefile.media.new|") { + while () { + if ($_ ne "") { + $changed=1; + } + } + close IN; + if ($changed) { + printf("One or more linux Makefiles had changed. Makefile.media rewrited.\n"); + system ("mv Makefile.media.new Makefile.media"); + } else { + system ("rm Makefile.media.new"); + } + } +} else { + printf("Creating Makefile.media.\n"); + system "mv Makefile.media.new Makefile.media"; +} + +if (open IN,".myconfig") { close IN; } else { system "make allmodconfig"; -- cgit v1.2.3 From a65cbc3b7aa2eaf072f20f362966f0b0055077b3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 20 Jun 2006 20:01:22 -0300 Subject: Adjust distclean target to clean a few more files From: Trent Piepho distclean was not cleaning the v4l/.myconfig file, or the symlinks made for the lxdialog program. This caused problems especially if you were switching between different kernel versions for testing. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- v4l/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'v4l') diff --git a/v4l/Makefile b/v4l/Makefile index d20e68d4e..5be5f40ba 100644 --- a/v4l/Makefile +++ b/v4l/Makefile @@ -216,8 +216,9 @@ clean:: distclean:: clean -rm -f .version .*.o.flags .*.o.d Makefile.media \ - Kconfig Kconfig.kern .config .config.cmd + Kconfig Kconfig.kern .config .config.cmd .myconfig -rm -rf .tmp_versions + -rm -f scripts/lxdialog scripts/kconfig @find .. -name '*.orig' -exec rm '{}' \; @find .. -name '*.rej' -exec rm '{}' \; -- cgit v1.2.3 From 74e1ed0781b35cfd53baba71c84dfbf6c59c5403 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 21 Jun 2006 10:04:08 -0300 Subject: Fixes circular dependencies at building system From: Mauro Carvalho Chehab There were a circular dependency at scripts/make_makefile.pl that were affecting mostly building with GNU make 3.81. Also, scripts/make_noconfig.pl is, in fact, building .myconfig file, so, better to name it as make_myconfig.pl. Signed-off-by: Mauro Carvalho Chehab --- v4l/Makefile | 14 ++++++----- v4l/scripts/make_makefile.pl | 2 +- v4l/scripts/make_myconfig.pl | 58 ++++++++++++++++++++++++++++++++++++++++++++ v4l/scripts/make_noconfig.pl | 58 -------------------------------------------- 4 files changed, 67 insertions(+), 65 deletions(-) create mode 100755 v4l/scripts/make_myconfig.pl delete mode 100755 v4l/scripts/make_noconfig.pl (limited to 'v4l') diff --git a/v4l/Makefile b/v4l/Makefile index d20e68d4e..27a79a181 100644 --- a/v4l/Makefile +++ b/v4l/Makefile @@ -180,7 +180,9 @@ 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 +config-compat.h:: + scripts/make_myconfig.pl + @echo \#ifndef __CONFIG_COMPAT_H__ > config-compat.h @echo \#define __CONFIG_COMPAT_H__ >> config-compat.h @echo >> config-compat.h @@ -253,26 +255,26 @@ LXDIALOG := $(KDIR)/scripts/$(LXDIALOG_DIR)lxdialog/lxdialog xconfig:: links .version $(QCONF) ./scripts/make_kconfig.pl $(QCONF) Kconfig - ./scripts/make_noconfig.pl + ./scripts/make_myconfig.pl gconfig:: links .version $(GCONF) ./scripts/make_kconfig.pl $(QCONF) Kconfig - ./scripts/make_noconfig.pl + ./scripts/make_myconfig.pl config:: links .version $(CONF) ./scripts/make_kconfig.pl $(CONF) Kconfig - ./scripts/make_noconfig.pl + ./scripts/make_myconfig.pl menuconfig:: links .version $(MCONF) lxdialog ./scripts/make_kconfig.pl $(MCONF) Kconfig - ./scripts/make_noconfig.pl + ./scripts/make_myconfig.pl allyesconfig allmodconfig:: links .version ./scripts/make_kconfig.pl 1 - ./scripts/make_noconfig.pl + ./scripts/make_myconfig.pl # rule to build kernel conf programs KMAKEVARS := config-targets=1 mixed-targets=0 dot-config=0 diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index bcfb3764f..f0d9aef7f 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -181,5 +181,5 @@ if (open IN,"Makefile.media") { if (open IN,".myconfig") { close IN; } else { - system "make allmodconfig"; + system "./scripts/make_kconfig.pl 1"; } diff --git a/v4l/scripts/make_myconfig.pl b/v4l/scripts/make_myconfig.pl new file mode 100755 index 000000000..7323f419c --- /dev/null +++ b/v4l/scripts/make_myconfig.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +# The purpose of this script is to produce a file named '.myconfig', in +# the same style as the '.config' file. Except .myconfig has disabled +# options explicitly set to 'n' rather than just omitted. This is to +# make sure they override any corresponding options that may be turned on +# in the Kernel's config files. +# The .myconfig file is what will be included in the v4l-dvb Makefile +# to control which drivers are built. + +my %config = (); +my %allconfig = (); + +open IN,".config"; +while () { + if (m/\s*(\w+)=\s*(\S*)/) { +#printf "%s=%s\n",$1,$2; + $config { $1 } = $2; + } +} +close IN; + +# Build table of _all_ bool and tristate config variables +my $key = 0; +open IN,"Kconfig"; +while () { + if (/^config\s+(\w+)\s*$/) { + $key == 0 or die "Couldn't find type of config '$key'"; + $key = "CONFIG_$1"; + } elsif (/^\s+bool(ean)?\s/) { + $allconfig{$key} = 'bool'; + $key = 0; + } elsif (/^\s+tristate\s/) { + $allconfig{$key} = 'tristate'; + $key = 0; + } elsif (/^\s+(int|hex|string)\s/) { + $allconfig{$key} = 'data'; + $key = 0; + } +} +close IN; + +exists $allconfig{0} and die "Unable to correctly parse Kconfig file"; + +# Produce output for including in a Makefile +# Explicitly set bool/tri options that didn't appear in .config to n +# 'data' options are only output if they appeared in .config +open OUT,">.myconfig"; +while ( my ($key, $value) = each(%allconfig) ) { + if ($value eq 'data') { + next unless (exists $config{$key}); + $value = $config{$key}; + } else { + $value = exists $config{$key} ? $config{$key} : 'n'; + } + printf OUT "%-44s := %s\n",$key,$value; +} +close OUT; diff --git a/v4l/scripts/make_noconfig.pl b/v4l/scripts/make_noconfig.pl deleted file mode 100755 index 7323f419c..000000000 --- a/v4l/scripts/make_noconfig.pl +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/perl - -# The purpose of this script is to produce a file named '.myconfig', in -# the same style as the '.config' file. Except .myconfig has disabled -# options explicitly set to 'n' rather than just omitted. This is to -# make sure they override any corresponding options that may be turned on -# in the Kernel's config files. -# The .myconfig file is what will be included in the v4l-dvb Makefile -# to control which drivers are built. - -my %config = (); -my %allconfig = (); - -open IN,".config"; -while () { - if (m/\s*(\w+)=\s*(\S*)/) { -#printf "%s=%s\n",$1,$2; - $config { $1 } = $2; - } -} -close IN; - -# Build table of _all_ bool and tristate config variables -my $key = 0; -open IN,"Kconfig"; -while () { - if (/^config\s+(\w+)\s*$/) { - $key == 0 or die "Couldn't find type of config '$key'"; - $key = "CONFIG_$1"; - } elsif (/^\s+bool(ean)?\s/) { - $allconfig{$key} = 'bool'; - $key = 0; - } elsif (/^\s+tristate\s/) { - $allconfig{$key} = 'tristate'; - $key = 0; - } elsif (/^\s+(int|hex|string)\s/) { - $allconfig{$key} = 'data'; - $key = 0; - } -} -close IN; - -exists $allconfig{0} and die "Unable to correctly parse Kconfig file"; - -# Produce output for including in a Makefile -# Explicitly set bool/tri options that didn't appear in .config to n -# 'data' options are only output if they appeared in .config -open OUT,">.myconfig"; -while ( my ($key, $value) = each(%allconfig) ) { - if ($value eq 'data') { - next unless (exists $config{$key}); - $value = $config{$key}; - } else { - $value = exists $config{$key} ? $config{$key} : 'n'; - } - printf OUT "%-44s := %s\n",$key,$value; -} -close OUT; -- cgit v1.2.3 From 6cfc8eeff6261fb1153a67e5bc3c71616f332044 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 21 Jun 2006 12:23:13 -0300 Subject: Some improvements at the building system From: Mauro Carvalho Chehab Building system now looks kernel config.h and autoconf.h files, seeking for the compiled options at kernel. If something is missing, it will disable compilation for that driver, printing a warning message. Signed-off-by: Mauro Carvalho Chehab --- v4l/Makefile | 33 +++++----- v4l/scripts/make_kconfig.pl | 152 +++++++++++++++++++++++++++++++++++++++---- v4l/scripts/make_makefile.pl | 3 +- v4l/versions.txt | 8 +-- 4 files changed, 162 insertions(+), 34 deletions(-) (limited to 'v4l') diff --git a/v4l/Makefile b/v4l/Makefile index 58354a035..881329d7d 100644 --- a/v4l/Makefile +++ b/v4l/Makefile @@ -17,7 +17,12 @@ else ifneq ($(SRCDIR),) KDIR := $(SRCDIR) else +ifneq ($(KERNELRELEASE),) KDIR := /lib/modules/$(KERNELRELEASE)/build +else +KDIR := /lib/modules/$(shell uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("%s.%s.%s%s\n",$$1,$$2,$$3,$$4); };')/build + +endif endif endif @@ -133,9 +138,6 @@ remove rminstall:: media-rminstall ivtv-rminstall ################################################# # Compiling preparation rules -Makefile.media:: .version - scripts/make_makefile.pl - .version:: ifneq ($(KERNELRELEASE),) @echo -e VERSION=$(VERSION)\\nPATCHLEVEL:=$(PATCHLEVEL)\\nSUBLEVEL:=$(SUBLEVEL)\\nKERNELRELEASE:=$(KERNELRELEASE) > $(obj)/.version @@ -147,6 +149,9 @@ else @uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version endif +Makefile.media:: .version + scripts/make_makefile.pl $(KDIR) + release:: ifneq ($(VER),) @echo "Forcing compiling to version $(VER)." @@ -180,9 +185,7 @@ 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:: - scripts/make_myconfig.pl - +config-compat.h:: .myconfig @echo \#ifndef __CONFIG_COMPAT_H__ > config-compat.h @echo \#define __CONFIG_COMPAT_H__ >> config-compat.h @echo >> config-compat.h @@ -253,29 +256,27 @@ LXDIALOG_DIR := $(shell if [ -d $(KDIR)/scripts/kconfig/lxdialog ]; then echo kc LXDIALOG_LNK := $(if $(LXDIALOG_DIR),scripts/kconfig,scripts/lxdialog) LXDIALOG := $(KDIR)/scripts/$(LXDIALOG_DIR)lxdialog/lxdialog +.myconfig : .config + ./scripts/make_myconfig.pl + xconfig:: links .version $(QCONF) - ./scripts/make_kconfig.pl + ./scripts/make_kconfig.pl $(KDIR) $(QCONF) Kconfig - ./scripts/make_myconfig.pl gconfig:: links .version $(GCONF) - ./scripts/make_kconfig.pl + ./scripts/make_kconfig.pl $(KDIR) $(QCONF) Kconfig - ./scripts/make_myconfig.pl config:: links .version $(CONF) - ./scripts/make_kconfig.pl + ./scripts/make_kconfig.pl $(KDIR) $(CONF) Kconfig - ./scripts/make_myconfig.pl menuconfig:: links .version $(MCONF) lxdialog - ./scripts/make_kconfig.pl + ./scripts/make_kconfig.pl $(KDIR) $(MCONF) Kconfig - ./scripts/make_myconfig.pl allyesconfig allmodconfig:: links .version - ./scripts/make_kconfig.pl 1 - ./scripts/make_myconfig.pl + ./scripts/make_kconfig.pl $(KDIR) 1 # rule to build kernel conf programs KMAKEVARS := config-targets=1 mixed-targets=0 dot-config=0 diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index b499fefa1..33a53d772 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -7,10 +7,69 @@ my %config = (); my %intopt = (); my %hexopt = (); my %tristate = (); +my %kernopts = (); +my %depmods = (); my $version, $level, $sublevel; +my $kernel=shift; my $force_kconfig=shift; +#!/usr/bin/perl +use FileHandle; + +########################################################### +# Checks config.h and autoconf.h for current kernel defines +sub process_config ($) +{ + my $filename = shift; + my $in = new FileHandle; + + open $in,"$kernel/include/$filename" or die; + while (<$in>) { + if (m|\#include\s+\<(.*)\>|) { + process_config ($1); + next; + } + if (m/\#define\s+CONFIG_([^ ]*)_ON_SMP\s+(.*)\n/) { + my $key=$1; + my $value=$2; +# printf "defined $key as $value\n"; + if ( $value == 1 ) { + $value='y'; + } + $kernopts{$key}=$value; + next; + } + if (m/\#define\s+CONFIG_([^ ]*)_MODULE\s+(.*)\n/) { + my $key=$1; + my $value=$2; +# printf "defined $key as $value\n"; + if ( $value == 1 ) { + $value='m'; + } + $kernopts{$key}=$value; + next; + } + if (m/\#define\s+CONFIG_([^ ]*)\s+(.*)\n/) { + my $key=$1; + my $value=$2; +# printf "defined $key as $value\n"; + if ( $value == 1 ) { + $value='y'; + } + $kernopts{$key}=$value; + next; + } + if (m/\#undef\s+CONFIG_([^ ]*)\n/) { +# printf "undefined $1\n"; + $kernopts{$1}='n'; + next; + } + } + + close $in; +} + sub add_bool($) { my $arg=shift; @@ -18,6 +77,8 @@ sub add_bool($) exists $config{$arg} or die "Adding unknown boolean '$arg'"; $tristate{$arg}="bool"; # printf "Boolean:%s\n",$arg; + + $kernopts{$arg}='y'; } sub add_tristate($) @@ -26,7 +87,8 @@ sub add_tristate($) exists $config{$arg} or die "Adding unknown tristate '$arg'"; $tristate{$arg}="tristate"; -# printf "Tristate:%s\n",$arg; + + $kernopts{$arg}='m'; } sub add_int($) @@ -75,6 +137,7 @@ sub add_config($) } } +######################################## # Turn option off, iff it already exists sub disable_config($) { @@ -83,9 +146,14 @@ sub disable_config($) $config{$key} = 0 if (exists $config{$key}); } -sub check_deps($) +################################################################# +# Make a list of dependencies and the number of references for it +sub check_deps($$) { + my $key=shift; my $arg=shift; + + $depmods{$key}=$arg; $arg=$arg." "; while ($arg ne "") { @@ -96,6 +164,44 @@ sub check_deps($) } $arg =~ s/^[^ ]+ //; } + + return $ok; +} + +###################################################### +# Checks if all dependencies for the key are satisfied +sub deps_ok($) +{ + my $key=shift; + my $arg=$depmods{$key}; + my $ok=1; + + if ($arg eq "") { + return $ok; + } + + $arg=$arg." "; + + +# printf "$key: deps are '$arg'\n"; + + while ($arg ne "") { + if ($arg =~ m/^([A-Z0-9_]+) /) { + if ((! exists $kernopts {$1}) || ($kernopts {$1} eq 'n')) { + printf "$key: Required kernel opt '$1' is not present\n"; + $ok=0; + } + } + if ($arg =~ m/^\!([A-Z0-9_]+) /) { + if ($kernopts {$1} eq 'y') { + printf "$key: Driver is incompatible with '$1'\n"; + $ok=0; + } + } + $arg =~ s/^[^ ]+ //; + } + + return $ok; } sub open_kconfig($$) { @@ -105,7 +211,7 @@ sub open_kconfig($$) { my $key; #print "opening $file\n"; - open $in,"$file"; + open $in,"$file" or die; while (<$in>) { # if (m;^\s*source[\s\"]+drivers/media/(video|dvb)/Kconfig;) { # next; @@ -124,10 +230,10 @@ sub open_kconfig($$) { next; } if (m|^\s+depends on\s+(.*)\n|) { - check_deps ($1); + check_deps ($key,$1); } if (m|^\s+select\s+(.*)\n|) { - check_deps ($1); + check_deps ($key,$1); } if (m|^\s+bool(ean)?\s|) { add_bool($key); @@ -155,7 +261,6 @@ sub open_kconfig($$) { $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 @@ -211,7 +316,7 @@ sub parse_versions () my $in = new FileHandle; my $ver; - open $in,"versions.txt"; + open $in,"versions.txt" or die; while (<$in>) { if (m/\[([\d.]*)\]/) { $ver=$1; @@ -226,9 +331,11 @@ sub parse_versions () close $in; } +process_config("linux/config.h"); + parse_versions; -open IN,".version"; +open IN,".version" or die; while () { if (m/KERNELRELEASE\s*[:]*[=]+\s*(\d+)\.(\d+)\.(\d+)/) { $version=$1; @@ -240,7 +347,7 @@ close IN; printf "Preparing to compile for kernel version %d.%d.%d\n",$version,$level,$sublevel; -open OUT,">Kconfig"; +open OUT,">Kconfig" or die; print OUT <<"EOF"; mainmenu "V4L/DVB menu" @@ -273,14 +380,19 @@ while ( my ($key, $value) = each(%config) ) { delete $depend{$key}; } -open OUT,">Kconfig.kern"; +open OUT,">Kconfig.kern" or die; print OUT "config MODULES\n\tboolean\n\tdefault y\n\n"; 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"; + if ($kernopts{$key}) { + print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault ". + $kernopts{$key}."\n\n"; + } else { + print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault n #not found\n\n"; + } } close OUT; @@ -290,10 +402,24 @@ 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"; + open OUT,">.config" or die; while ( my ($key,$value) = each(%tristate) ) { if (!$config{$key}) { - print OUT "CONFIG_$key=n\n"; + print OUT "# CONFIG_$key is not set\n"; + } elsif ($kernopts{$key}) { + my $ok=deps_ok($key); + + # If deps are not ok, mark default as n + if (!$ok) { +# print "$key disabled due to missing kernel required prereq\n"; + $kernopts{$key}='n'; + } + + if ($kernopts{$key} eq 'n') { + print OUT "# CONFIG_$key is not set\n"; + } else { + print OUT "CONFIG_$key=".$kernopts{$key}."\n"; + } } elsif ($value eq 'tristate') { print OUT "CONFIG_$key=m\n"; } else { # must be 'bool' diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index f0d9aef7f..e0a099e9b 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl use FileHandle; +my $kernel=shift; my $instdir = (); sub check_line($$$) @@ -181,5 +182,5 @@ if (open IN,"Makefile.media") { if (open IN,".myconfig") { close IN; } else { - system "./scripts/make_kconfig.pl 1"; + system "./scripts/make_kconfig.pl $kernel 1"; } diff --git a/v4l/versions.txt b/v4l/versions.txt index 35cb44fc6..6da410612 100644 --- a/v4l/versions.txt +++ b/v4l/versions.txt @@ -6,10 +6,6 @@ VIDEO_ZR36120 # This is also marked as broken VIDEO_PLANB -# Those are architecture-dependent -VIDEO_VINO -VIDEO_M32R_AR_M64278 - [2.6.16] VIDEO_USBVIDEO USB_VICAM @@ -23,6 +19,10 @@ USB_ZC0301 VIDEO_ZORAN_AVS6EYES VIDEO_TLV320AIC23B +# Those are architecture-dependent +VIDEO_VINO +VIDEO_M32R_AR_M64278 + [2.6.14] VIDEO_ZORAN VIDEO_ZORAN_BUZ -- cgit v1.2.3