summaryrefslogtreecommitdiff
path: root/v4l/scripts/make_noconfig.pl
blob: a47ca4acfb0f30a8d9e8d5aa0faade1e5b493f66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/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) ) {
	if ($value eq "y") {
		$value="m";
	}
	printf OUT "%-44s := %s\n",$key,$value;
}
close OUT;