summaryrefslogtreecommitdiff
path: root/v4l/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/scripts')
-rw-r--r--v4l/scripts/changelog.tmpl5
-rwxr-xr-xv4l/scripts/check_config_defines.pl62
-rwxr-xr-xv4l/scripts/hghead.pl2
-rwxr-xr-xv4l/scripts/make_kconfig.pl95
-rwxr-xr-xv4l/scripts/make_myconfig.pl2
-rwxr-xr-xv4l/scripts/makelinks.sh20
-rw-r--r--v4l/scripts/map-changelog1
-rwxr-xr-xv4l/scripts/rmmod.pl62
8 files changed, 155 insertions, 94 deletions
diff --git a/v4l/scripts/changelog.tmpl b/v4l/scripts/changelog.tmpl
new file mode 100644
index 000000000..c1e5cb176
--- /dev/null
+++ b/v4l/scripts/changelog.tmpl
@@ -0,0 +1,5 @@
+User #author#
+Date #date|date#
+#desc#
+
+---
diff --git a/v4l/scripts/check_config_defines.pl b/v4l/scripts/check_config_defines.pl
new file mode 100755
index 000000000..91643d23c
--- /dev/null
+++ b/v4l/scripts/check_config_defines.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+# Copyright (C) 2006 Trent Piepho <xyzzy@speakeasy.org>
+#
+# Look for lines in C files like "#ifdef CONFIG_SOME_KCONF_VAR" and make
+# sure CONFIG_SOME_KCONF_VAR is something that exists.
+
+if($#ARGV < 0) {
+ print "Usage: $0 kernel_dir [files to check ...]\n\n";
+ print "If no files are listed, checks all files from hg manifest\n";
+ exit;
+}
+$kdir = shift;
+
+if($#ARGV < 0) {
+ @ARGV = `hg manifest | cut "-d " -f3 | grep '.[ch]\$'`;
+ $? == 0 and die "Error getting manifest: $!";
+ chomp @ARGV;
+}
+
+sub readkconfig($$)
+{
+ my $fn = "$_[0]/$_[1]";
+ # Don't read the same kconfig file more than once
+ return if exists $kconfigs{$fn};
+ $kconfigs{$fn} = 1;
+# print "Reading $fn\n";
+ my $fh;
+ open $fh, '<', "$fn" or die "Can't read Kconfig file $fn: $!";
+ while(<$fh>) {
+ if (/^\s*source\s+"([^"]+)"\s*$/ || /^\s*source\s+(\S+)\s*$/) {
+ readkconfig($_[0], $1);
+ } elsif(/^config\s+(\w+)$/) {
+ $vars{"CONFIG_$1"}=1;
+ }
+ }
+ close $fh;
+}
+
+readkconfig('linux', 'drivers/media/Kconfig');
+foreach(glob "$kdir/arch/*/Kconfig") {
+ s|^\Q$kdir/\E||;
+ next if(m|arch/um/Kconfig|);
+ readkconfig($kdir, $_);
+}
+
+while(<>) {
+ if(/^\s*#ifdef\s+(CONFIG_\w+)(_MODULE)?\W*$/) {
+# print "Found $1\n";
+ print "Unknown config $1 in $ARGV:$.\n" unless(exists $vars{$1});
+ next;
+ }
+ if(/^\s*#if/) {
+ $_ .= <> while(/\\$/); # Handle line continuations
+ while(/defined\(\s*(CONFIG_\w+?)(_MODULE)?\s*\)/) {
+ print "Unknown config $1 in $ARGV:$.\n" unless(exists $vars{$1});
+ $_ = $';
+ }
+ }
+
+} continue {
+ close ARGV if eof;
+}
diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl
index 3f8b4b0ba..fdc9720c6 100755
--- a/v4l/scripts/hghead.pl
+++ b/v4l/scripts/hghead.pl
@@ -110,7 +110,7 @@ while ($line = <IN>) {
next;
}
-
+
if ($line =~ m/^Acked-by:.*/) {
$signed="$signed$line";
next;
diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl
index d5b34b36c..b203a2ac0 100755
--- a/v4l/scripts/make_kconfig.pl
+++ b/v4l/scripts/make_kconfig.pl
@@ -9,11 +9,13 @@ my %hexopt = ();
my %tristate = ();
my %kernopts = ();
my %depmods = ();
-my $version, $level, $sublevel;
+my $version, $level, $sublevel, $kernver;
my $kernel=shift;
my $force_kconfig=shift;
+#my $debug=1;
+
#!/usr/bin/perl
use FileHandle;
@@ -26,14 +28,10 @@ sub process_config ($)
open $in,"$kernel/include/$filename" or die "File not found: $kernel/include/$filename";
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";
+ printf "defined $key as $value\n" if $debug;
if ( $value == 1 ) {
$value='y';
}
@@ -43,7 +41,7 @@ sub process_config ($)
if (m/\#define\s+CONFIG_([^ ]*)_MODULE\s+(.*)\n/) {
my $key=$1;
my $value=$2;
-# printf "defined $key as $value\n";
+ printf "defined $key as $value\n" if $debug;
if ( $value == 1 ) {
$value='m';
}
@@ -53,7 +51,7 @@ sub process_config ($)
if (m/\#define\s+CONFIG_([^ ]*)\s+(.*)\n/) {
my $key=$1;
my $value=$2;
-# printf "defined $key as $value\n";
+ printf "defined $key as $value\n" if $debug;
if ( $value == 1 ) {
$value='y';
}
@@ -61,7 +59,7 @@ sub process_config ($)
next;
}
if (m/\#undef\s+CONFIG_([^ ]*)\n/) {
-# printf "undefined $1\n";
+ printf "undefined $1\n" if $debug;
$kernopts{$1}='n';
next;
}
@@ -76,7 +74,7 @@ sub add_bool($)
exists $config{$arg} or die "Adding unknown boolean '$arg'";
$tristate{$arg}="bool";
-# printf "Boolean:%s\n",$arg;
+ printf "Boolean:%s\n",$arg if $debug;
$kernopts{$arg}='y';
}
@@ -183,7 +181,7 @@ sub deps_ok($)
$arg=$arg." ";
-# printf "$key: deps are '$arg'\n";
+ printf "$key: deps are '$arg'\n" if $debug;
while ($arg ne "") {
if ($arg =~ m/^([A-Z0-9_]+) /) {
@@ -210,13 +208,9 @@ sub open_kconfig($$) {
my $disabled=0;
my $key;
-#print "opening $file\n";
+print "opening $file\n" if $debug;
open $in,"$file" or die "File not found: $file";
while (<$in>) {
-# if (m;^\s*source[\s\"]+drivers/media/(video|dvb)/Kconfig;) {
-# next;
-# }
-
# start of a new stanza, reset
if (m/^\w/) {
$disabled = 0;
@@ -229,12 +223,12 @@ sub open_kconfig($$) {
open_kconfig($dir,"$dir/$1");
next;
}
- if (m|^\s+depends on\s+(.*)\n|) {
- check_deps ($key,$1);
- }
- if (m|^\s+select\s+(.*)\n|) {
+ if (m|^\s+depends on\s+(.+?)\s*$|) {
check_deps ($key,$1);
}
+# if (m|^\s+select\s+(.+?)\s*(if .*?)?\s*$|) {
+# check_deps ($key,$1);
+# }
if (m|^\s+bool(ean)?\s|) {
add_bool($key);
}
@@ -282,24 +276,14 @@ EOF
$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) ) {
+ if (exists $minver{$key} &&
+ cmp_ver($minver{$key}, $kernver) > 0) {
$disabled=1;
disable_config ($key);
- print "$key requires version $minversion.$minlevel.$minsublevel\n";
+ print "$key requires version $minver{$key}\n";
print OUT "# $key disabled for insufficient kernel version\n";
} else {
-# print "OK: $key requires version $minversion.$minlevel.$minsublevel\n";
+ printf "OK: $key requires version %s\n", exists $minver{$key}?$minver{$key}:"any" if $debug;
$disabled=0;
}
}
@@ -318,20 +302,32 @@ sub parse_versions ()
open $in,"versions.txt" or die "File not found: 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);
+ if (/\[(\d+\.\d+\.\d+)\]/) {
+ $ver = $1;
+ } elsif (/^\s*(\w+)/) {
+ $minver{$1} = $ver;
+ print "minimal version for $1 is $ver\n" if $debug;
}
}
close $in;
}
-process_config("linux/config.h");
+# Like ver1 <=> ver2, but understands X.Y.Z version strings
+sub cmp_ver($$)
+{
+ shift =~ /(\d+)\.(\d+)\.(\d+)/;
+ my ($v1_ver,$v1_level,$v1_sublevel) = ($1,$2,$3);
+ shift =~ /(\d+)\.(\d+)\.(\d+)/;
+ my ($v2_ver,$v2_level,$v2_sublevel) = ($1,$2,$3);
+
+ my $cmp = $v1_ver <=> $v2_ver;
+ return $cmp unless($cmp == 0);
+ $cmp = $v1_level <=> $v2_level;
+ return $cmp unless($cmp == 0);
+ return $v1_sublevel <=> $v2_sublevel;
+}
+
+process_config("linux/autoconf.h");
parse_versions;
@@ -341,11 +337,12 @@ while (<IN>) {
$version=$1;
$level=$2;
$sublevel=$3;
+ $kernver="$version.$level.$sublevel";
}
}
close IN;
-printf "Preparing to compile for kernel version %d.%d.%d\n",$version,$level,$sublevel;
+print "Preparing to compile for kernel version $kernver\n";
open OUT,">Kconfig" or die "Cannot write Kconfig file";
@@ -382,10 +379,6 @@ while ( my ($key, $value) = each(%config) ) {
open OUT,">Kconfig.kern" or die "Cannot write Kconfig.kern file";
-print OUT "config MODULES\n\tboolean\n\tdefault y\n\n";
-add_config('MODULES');
-add_bool('MODULES');
-
while ( my ($key, $value) = each(%depend) ) {
if ($kernopts{$key}) {
print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault ".
@@ -399,13 +392,14 @@ close OUT;
# These options should default to off
disable_config('DVB_AV7110_FIRMWARE');
disable_config('DVB_CINERGYT2_TUNING');
+disable_config('DVB_FE_CUSTOMISE');
# Hack for check sound/oss/aci.h header
my $mirodep="$kernel/sound/oss/aci.h";
-if (!open IN, $mirodep) {
+if (! -e $mirodep) {
my $key="RADIO_MIROPCM20";
-print <<"EOF2";
+ print <<"EOF2";
$key: $mirodep is missing.
***WARNING:*** You do not have the full kernel sources installed.
@@ -428,7 +422,6 @@ Please see your distro's web site for instructions to build a new kernel.
EOF2
$kernopts{$key}='n';
}
-close IN;
# Recursively check for broken dependencies
my $i;
diff --git a/v4l/scripts/make_myconfig.pl b/v4l/scripts/make_myconfig.pl
index 7323f419c..0bde6f6c0 100755
--- a/v4l/scripts/make_myconfig.pl
+++ b/v4l/scripts/make_myconfig.pl
@@ -15,7 +15,7 @@ open IN,".config";
while (<IN>) {
if (m/\s*(\w+)=\s*(\S*)/) {
#printf "%s=%s\n",$1,$2;
- $config { $1 } = $2;
+ $config { $1 } = $2;
}
}
close IN;
diff --git a/v4l/scripts/makelinks.sh b/v4l/scripts/makelinks.sh
index 03fd48849..9ee780aba 100755
--- a/v4l/scripts/makelinks.sh
+++ b/v4l/scripts/makelinks.sh
@@ -5,7 +5,7 @@ if test -z $1 || ! test -d $1 ; then
echo
echo " usage: $0 <path_to_kernel_to_patch>"
echo
- exit
+ exit
fi
echo "patching $1..."
@@ -14,15 +14,15 @@ cd linux
PWD=`pwd`
for x in `find drivers -type d | grep -v CVS` ; do
- mkdir -p -v $1/$x
+ mkdir -p -v $1/$x
done
for x in `find Documentation -type d | grep -v CVS` ; do
- mkdir -p -v $1/$x
+ mkdir -p -v $1/$x
done
for x in `find include -type d | grep -v CVS` ; do
- mkdir -p -v $1/$x
+ mkdir -p -v $1/$x
done
for x in `find Documentation -type f | grep -v CVS | grep -v .cvsignore` ; do
@@ -48,15 +48,3 @@ for x in `find drivers/media -type d | grep -v CVS` ; do
done
cd ..
-patch -p0 <<'DIFF'
-diff -u -p videodev.h
---- linux/include/linux/videodev.h
-+++ linux/include/linux/videodev.h
-@@ -1,6 +1,7 @@
- #ifndef __LINUX_VIDEODEV_H
- #define __LINUX_VIDEODEV_H
-
-+#include "compat.h"
- #include <linux/types.h>
-
- #define HAVE_V4L1 1
diff --git a/v4l/scripts/map-changelog b/v4l/scripts/map-changelog
new file mode 100644
index 000000000..cc5caeb1c
--- /dev/null
+++ b/v4l/scripts/map-changelog
@@ -0,0 +1 @@
+changeset = changelog.tmpl
diff --git a/v4l/scripts/rmmod.pl b/v4l/scripts/rmmod.pl
index 19a0a8c61..d190a9edf 100755
--- a/v4l/scripts/rmmod.pl
+++ b/v4l/scripts/rmmod.pl
@@ -28,8 +28,17 @@ my %debug = ( "tuner" => "tuner_debug=1",
);
+sub findprog($)
+{
+ foreach(split(/:/, $ENV{PATH}),qw(/sbin /usr/sbin /usr/local/sbin)) {
+ return "$_/$_[0]" if(-x "$_/$_[0]");
+ }
+ die "Can't find needed utility '$_[0]'";
+}
+
sub parse_dir {
my $file = $File::Find::name;
+ my $modinfo = findprog('modinfo');
if (!($file =~ /[.]ko$/)) {
return;
@@ -38,7 +47,7 @@ sub parse_dir {
my $module = $file;
$module =~ s|^[./]*(.*)[.]ko|\1|;
- open IN, "modinfo $file|grep depends|cut -b 17-|";
+ open IN, "$modinfo $file|grep depends|cut -b 17-|";
while (<IN>) {
my $deps = $_;
$deps =~ s/\n//;
@@ -123,33 +132,36 @@ sub orderdep ()
sub insmod ($)
{
my $debug=shift;
+ my $modprobe = findprog('modprobe');
+ my $insmod = findprog('insmod');
while ( my ($key, $value) = each(%reqmodules) ) {
- printf ("modprobe $key\n");
- system ("modprobe $key");
+ print ("$modprobe $key\n");
+ system ("$modprobe $key");
}
foreach my $key (@modlist) {
if ($debug) {
my $dbg=$debug{$key};
- printf "insmod ./$key.ko $dbg\n";
- system "insmod ./$key.ko $dbg\n";
+ print "$insmod ./$key.ko $dbg\n";
+ system "$insmod ./$key.ko $dbg\n";
} else {
- printf "insmod ./$key.ko\n";
- system "insmod ./$key.ko\n";
+ print "$insmod ./$key.ko\n";
+ system "$insmod ./$key.ko\n";
}
}
}
sub rmmod ()
{
+ my $rmmod = findprog('rmmod');
while (my $key=pop @modlist) {
my $dep=$key;
$dep=~s/[\-]/_/g;
if (exists ($loaded{$dep})) {
- printf "rmmod $dep\n";
- system "rmmod $dep\n";
+ print "$rmmod $dep\n";
+ system "$rmmod $dep\n";
}
}
}
@@ -173,22 +185,22 @@ if ($mode eq "load") {
prepare_cmd;
parse_loaded;
rmmod;
+ } elsif ($mode eq "reload") {
+ prepare_cmd;
+ parse_loaded;
+ my @modlist2=@modlist;
+ rmmod;
+ @modlist=@modlist2;
+ insmod(0);
+ } elsif ($mode eq "debug") {
+ prepare_cmd;
+ parse_loaded;
+ insmod(1);
+ } elsif ($mode eq "check") {
+ prepare_cmd;
+ parse_loaded;
} else {
- if ($mode eq "reload") {
- prepare_cmd;
- parse_loaded;
- my @modlist2=@modlist;
- rmmod;
- @modlist=@modlist2;
- insmod(0);
- } else {
- if ($mode eq "debug") {
- prepare_cmd;
- parse_loaded;
- insmod(1);
- } else {
- printf "Usage: $0 [load|unload|reload]\n";
- }
- }
+ printf "Usage: $0 [load|unload|reload|debug|check]\n";
}
}
+