blob: 7323f419c8f2c6b03dcdd2cb05f1bcd325816012 (
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
|
#!/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 (<IN>) {
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 (<IN>) {
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;
|