From 7b614fddb1b412f6ec17b91907a4473ed08e97de Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Fri, 9 Mar 2007 14:02:18 -0800 Subject: build: Add support for DESTDIR when installing/removing modules From: Ludwig Nussel If defined, use $(DESTDIR) as a prefix for installing and removing modules. depmod will also use $(DESTDIR) as a prefix when it is run as part of module installation. Signed-off-by: Ludwig Nussel Signed-off-by: Trent Piepho --- v4l/scripts/make_makefile.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl index e1e08b578..8711cc5a8 100755 --- a/v4l/scripts/make_makefile.pl +++ b/v4l/scripts/make_makefile.pl @@ -134,12 +134,12 @@ print OUT "\t\@strip --strip-debug \$(inst-m)\n\n"; while (my ($dir, $files) = each %instdir) { print OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$dir files:\"\n"; - print OUT "\t\@install -d \$(KDIR26)/$dir\n"; + print OUT "\t\@install -d \$(DESTDIR)\$(KDIR26)/$dir\n"; print OUT "\t\@for i in ", join(' ', keys %$files), ";do "; print OUT "if [ -e \"\$\$i\" ]; then echo -n \"\$\$i \";"; - print OUT " install -m 644 -c \$\$i \$(KDIR26)/$dir; fi; done; echo;\n\n"; + print OUT " install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; done; echo;\n\n"; } -print OUT "\t/sbin/depmod -a \${KERNELRELEASE}\n\n"; +print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))\n\n"; # Creating Remove rule print OUT "media-rminstall::\n"; @@ -149,13 +149,13 @@ while ( my ($dir, $files) = each(%instdir) ) { print OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$dir files:\"\n"; print OUT "\t\@files='", join(' ', keys %$files), "'; "; - print OUT "for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i ]; then "; + print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then "; print OUT "echo -n \"\$\$i \";"; - print OUT " rm \$(KDIR26)/$dir/\$\$i; fi; done; "; + print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i; fi; done; "; - print OUT "for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i.gz ]; then "; + print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz ]; then "; print OUT "echo -n \"\$\$i.gz \";"; - print OUT " rm \$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n"; + print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n"; } # Print dependencies of Makefile.media -- cgit v1.2.3 From 41956dcf341ea42e7990d39bfcebe860b1375538 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sun, 11 Mar 2007 16:26:56 -0700 Subject: scripts: Enhance analyze_build a bit From: Trent Piepho In one case a Kbuild file would do something like: foo-objs := a.o b.o foo-objs += c.o analyze_build didn't understand that the second lines _adds_ c.o to the objects that make up foo.ko. It would think that foo.ko was made up of only c.o. Should be fixed now. Signed-off-by: Trent Piepho --- v4l/scripts/analyze_build.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/analyze_build.pl b/v4l/scripts/analyze_build.pl index 945377fa4..9a291a2e3 100755 --- a/v4l/scripts/analyze_build.pl +++ b/v4l/scripts/analyze_build.pl @@ -97,9 +97,15 @@ sub open_makefile($) { next; } if (/(\S+)-objs\s*([:+]?)=\s*(\S.*?)\s*$/) { - print STDERR "Should use ':=' in $file:$.\n$_\n" if ($check && $2 ne ':'); my @files = split(/\s+/, $3); map { s|^(.*)\.o$|$dir/\1| } @files; + if ($2 eq '+') { + # Adding to files + print STDERR "Should use ':=' in $file:$.\n$_\n" if ($check && !exists $multi{"$dir/$1"}); + push @files, @{$multi{"$dir/$1"}}; + } else { + print STDERR "Setting objects twice in $file:$.\n$_\n" if ($check && exists $multi{"$dir/$1"}); + } $multi{"$dir/$1"} = \@files; next; } -- cgit v1.2.3 From 7bc2a9de3848c0ea06877adcb53c29b9155840ef Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Mon, 12 Mar 2007 16:08:21 -0700 Subject: build: add a qrefresh target, like commit for use with mq Adds a qrefresh target to the top-level Makefile. It's like commit, but for use with the Hg mq extension. It will execute hg qrefresh, so you should have a current mq patch created with hg qnew already! It will run the whitespace and cardlist scripts. If you do not have a commit message from the current mq patch, it will create a default one, as make commit does. If one already exists, then it will put a comment at the beginning of the existing message with the current diffstat and a note of any changes the whitespace script made. The diffstat is done with qdiff, which will show the total diffstat of the patch instead of just the diffstat of from the last version of the patch to the current version. Signed-off-by: Trent Piepho --- v4l/scripts/prep_commit_msg.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl index f4047c6ba..819009c57 100755 --- a/v4l/scripts/prep_commit_msg.pl +++ b/v4l/scripts/prep_commit_msg.pl @@ -1,5 +1,10 @@ #!/usr/bin/perl +my $diff = 'diff'; +if ($ARGV[0] eq '-q') { + $diff = 'qdiff'; + shift; +} my $autopatch = shift; # Get Hg username from environment @@ -45,13 +50,25 @@ if ($user eq "") { } print "# Added/removed/changed files:\n"; -system "hg diff | diffstat -p1 -c"; +system "hg $diff | diffstat -p1 -c"; if (-s $autopatch) { print "#\n# Note, a problem with your patch was detected! These changes were made\n"; print "# automatically: $autopatch\n"; system "diffstat -p0 -c $autopatch"; print "#\n# Please review these changes and see if they belong in your patch or not.\n"; } +if ($diff eq 'qdiff') { + # Use existing mq patch logfile? + open IN, "hg qheader |"; + my @header = ; + close IN; + if ($#header > 0) { + # Use existing header + print @header; + exit; + } + # No header, use pre-made log message below +} print <<"EOF"; # # For better log display, please keep a blank line after subject, after from, -- cgit v1.2.3 From d99177342d725d7fbbd024245697d33c63952ed9 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Fri, 30 Mar 2007 17:37:53 -0700 Subject: build: Fix bug with make qrefresh From: Trent Piepho Annoyingly, the Hg mq extension will strip lines starting with "From: " from the patch header. Since the v4l-dvb format commit message contains a line starting with "From: ", it will mess them up. This changes prep_commit_msg to create a decoy "from" line to keep mq from messing up commit messages. Signed-off-by: Trent Piepho --- v4l/scripts/prep_commit_msg.pl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'v4l/scripts') diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl index 819009c57..cb0740a5d 100755 --- a/v4l/scripts/prep_commit_msg.pl +++ b/v4l/scripts/prep_commit_msg.pl @@ -62,12 +62,18 @@ if ($diff eq 'qdiff') { open IN, "hg qheader |"; my @header = ; close IN; + if ($#header > 0) { # Use existing header print @header; exit; } # No header, use pre-made log message below + + # Hg will strip lines that start with "From: " from mq patch headers! + # In order to stop it, we insert this extra From line at the top, + # Hg will strip it and then leave the real from line alone. + print "From: $user\n\n"; } print <<"EOF"; # -- cgit v1.2.3 From 628ac96b077ca879a0bfca25f1db0dfd9a07f4ef Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 3 Apr 2007 18:05:56 -0300 Subject: Add script to generate CARDLIST.usbvision From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/cardlist | 3 +++ v4l/scripts/usbvision.pl | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 v4l/scripts/usbvision.pl (limited to 'v4l/scripts') diff --git a/v4l/scripts/cardlist b/v4l/scripts/cardlist index 901d3fb18..91c32c483 100755 --- a/v4l/scripts/cardlist +++ b/v4l/scripts/cardlist @@ -15,3 +15,6 @@ scripts/tuner.pl ../linux/include/media/tuner.h ../linux/drivers/media/video/tun scripts/saa7134.pl ../linux/drivers/media/video/saa7134/saa7134.h ../linux/drivers/media/video/saa7134/saa7134-cards.c \ | perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.saa7134 +scripts/usbvision.pl ../linux/drivers/media/video/usbvision/usbvision-cards.c \ + | perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.usbvision + diff --git a/v4l/scripts/usbvision.pl b/v4l/scripts/usbvision.pl new file mode 100755 index 000000000..5aae512c5 --- /dev/null +++ b/v4l/scripts/usbvision.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w +use strict; + +my $new_entry = -1; +my $nr = 0; +my ($id,$subvendor,$subdevice); +my %data; + +my $cap=0; + +while (<>) { + if (m/usbvision_device_data/) { + $cap=1; + next; + } + if (m/usbvision_table/) { + $cap=0; + next; + } + if ($cap==0) { + next; + } + + if (m/\{0x([0-9a-z]...)\s*\,\s*0x([0-9a-z]...).*\"(.*)\"/) { + $data{$nr}->{nr} = $nr; + $data{$nr}->{name} = $3; + push @{$data{$nr}->{subid}}, "$1:$2"; + $nr++; + } +} + +foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) { + printf("%3d -> %-56s", $data{$item}->{nr}, $data{$item}->{name}); + printf(" [%s]",join(",",@{$data{$item}->{subid}})) + if defined($data{$item}->{subid}); + print "\n"; +} -- cgit v1.2.3 From 8dc666d4b3b64814dc3a27e476350b94fcdfb232 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 14 Apr 2007 15:09:59 -0300 Subject: Use a better format to represent usbvision supported boards From: Mauro Carvalho Chehab Changed usbvision cards table to allow: 1) Not repeat USB ID on two structs; 2) Not need to specify both usb and card description tables at the same order, removing some magic; Some cards had duplicated names. Fixed. A test for an specific board were doing by using a string comparation. The comparation were wrong. Also, it is not a good practice to recognize a board based on his string name. Acked-by: Thierry MERLE Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/cardlist | 2 +- v4l/scripts/usbvision.pl | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/cardlist b/v4l/scripts/cardlist index 91c32c483..0225d6ebd 100755 --- a/v4l/scripts/cardlist +++ b/v4l/scripts/cardlist @@ -15,6 +15,6 @@ scripts/tuner.pl ../linux/include/media/tuner.h ../linux/drivers/media/video/tun scripts/saa7134.pl ../linux/drivers/media/video/saa7134/saa7134.h ../linux/drivers/media/video/saa7134/saa7134-cards.c \ | perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.saa7134 -scripts/usbvision.pl ../linux/drivers/media/video/usbvision/usbvision-cards.c \ +scripts/usbvision.pl ../linux/drivers/media/video/usbvision/usbvision-cards.h ../linux/drivers/media/video/usbvision/usbvision-cards.c \ | perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.usbvision diff --git a/v4l/scripts/usbvision.pl b/v4l/scripts/usbvision.pl index 5aae512c5..3976e8bd1 100755 --- a/v4l/scripts/usbvision.pl +++ b/v4l/scripts/usbvision.pl @@ -6,26 +6,29 @@ my $nr = 0; my ($id,$subvendor,$subdevice); my %data; -my $cap=0; - while (<>) { - if (m/usbvision_device_data/) { - $cap=1; - next; - } - if (m/usbvision_table/) { - $cap=0; + # defines in header file + if (/#define\s*(\w+)\s*(\d+)/) { + $data{$1}->{nr} = $2; next; } - if ($cap==0) { - next; + # boards + if (/^\s*\[([\w\d_]+)\]\s*=\s*{/) { + $id = $1; + $data{$id}->{id} = $id; + }; + + next unless defined($id); + + if (/USB_DEVICE.*0x([0-9a-fA-F]*).*0x([0-9a-fA-F]*).*driver_info\s*=\s*([\w\d_]+)/) +{ + $subvendor=$1; + $subdevice=$2; + push @{$data{$3}->{subid}}, "$subvendor:$subdevice"; } - if (m/\{0x([0-9a-z]...)\s*\,\s*0x([0-9a-z]...).*\"(.*)\"/) { - $data{$nr}->{nr} = $nr; - $data{$nr}->{name} = $3; - push @{$data{$nr}->{subid}}, "$1:$2"; - $nr++; + if (!defined($data{$id}) || !defined($data{$id}->{name})) { + $data{$id}->{name} = $1 if (/\.ModelString\s*=\s*\"([^\"]+)\"/); } } -- cgit v1.2.3 From c90f0ab41cbba94f1676f504997fd25c1e5f02b1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 1 May 2007 10:45:32 -0300 Subject: Relax some regex for processing saa7134-cards From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/saa7134.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/saa7134.pl b/v4l/scripts/saa7134.pl index 69648339a..2778bdccc 100755 --- a/v4l/scripts/saa7134.pl +++ b/v4l/scripts/saa7134.pl @@ -39,9 +39,9 @@ while (<>) { } # saa7134_pci_tbl - $subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/); - $subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/); - if (/.driver_data\s*=\s*(\w+),/) { + $subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+)\s*,*/); + $subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+)\s*,*/); + if (/.driver_data\s*=\s*(\w+)\s*,*/) { if (defined($data{$1}) && defined($subvendor) && $subvendor ne "0" && defined($subdevice) && $subdevice ne "0") { -- cgit v1.2.3 From 4408f03fed048fabc1d1cbbd2914924b31ed78b5 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Thu, 3 May 2007 11:06:09 -0700 Subject: build: Update build scripts to handle menuconfig/if/endif From: Trent Piepho Update make_myconfig.pl and make_kconfig.pl to handle menuconfig options the same way as config options. Update make_kconfig.pl to process if/endif directives. All config options inside an if/endif block gain a dependency on the 'if' expression. Make the script a little more efficient by not trying to match a line after it has already found a match for it. This helped to enhance debug mode, so that it will print lines which were not understood rather than silently skipping them. Signed-off-by: Trent Piepho --- v4l/scripts/make_kconfig.pl | 93 +++++++++++++++++++++++++++++--------------- v4l/scripts/make_myconfig.pl | 2 +- 2 files changed, 63 insertions(+), 32 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index 4fc39383f..8ed189aef 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -140,10 +140,8 @@ sub depends($$) my $key = shift; my $deps = shift; - if(!defined $key || $key eq '') { - print "Got bad key with $deps\n"; - return; - } + (!defined $key || $key eq '') and + die "Got bad key with $deps\n"; finddeps($key, $deps); push @{$depends{$key}}, $deps; } @@ -201,6 +199,7 @@ sub checkdeps() my $deps = $depends{$key}; foreach (@$deps) { if (!eval(toperl($_))) { + print "Disabling $key, dependency '$_' not met\n" if $debug; $allconfig{$key} = 0; return 0; } @@ -238,6 +237,9 @@ EOF # output combined Kconfig file. my @kconfigfiles = (); +# "if" statements found in Kconfig files. +my @kifs = (); + # Read and parse a Kconfig file. First argument is base of source # directory tree, the second is the file to open (with path). Recursivly # parses Kconfig files from 'source' directives. @@ -290,6 +292,7 @@ sub open_kconfig($$) { $default_seen = 0; $key = undef; } + next if (/^\s*#/ || /^\s*$/); # skip comments and blank lines if (m|^\s*source\s+"([^"]+)"\s*$| || m|^\s*source\s+(\S+)\s*$|) { @@ -298,8 +301,10 @@ sub open_kconfig($$) { next; } - if (m|^\s*config (\w+)\s*$|) { + my $nothandled = 0; + if (m|^\s*(?:menu)?config (\w+)\s*$|) { $key = $1; + print "Found config '$key' at $file:$.\n" if $debug; add_config($key); if (exists $minver{$key} && @@ -311,42 +316,68 @@ sub open_kconfig($$) { } else { $disabled=0; } + # Add dependencies from enclosing if/endif blocks + depends($key, $_) foreach (@kifs); } elsif (m|^\s*comment\s+"[^"]*"\s*$|) { $key = 'comment'; } elsif (m|^\s*menu\s+"[^"]*"\s*$|) { $key = 'menu'; + } elsif (m|^\s*if\s+(.+?)\s*$|) { + push @kifs, $1; + } elsif (m|^\s*endif\s*(?:#.*)?$|) { + $#kifs >= 0 or die "Unmatched endif at $file:$.\n"; + pop @kifs; + } else { + $nothandled = 1; } + next unless ($nothandled); # Remaining Kconfig directives only makse sense inside Kconfig blocks - next unless(defined $key); + unless(defined $key) { + print "Skipping $file:$. $_" if $debug; + next; + } # Don't process any directives in comment blocks (or menus) next if ($key eq 'comment' || $key eq 'menu'); - add_bool($key) if(/^\s*bool(ean)?\s/); - add_tristate($key) if (/^\s*tristate\s/); - add_int($key) if (/^\s*int\s/); - add_hex($key) if (/^\s*hex\s/); - - depends($key, $1) if (m|^\s*depends on\s+(.+?)\s*$|); - selects($key, $1, $3) if (m|^\s*select\s+(\w+)(\s+if\s+(.+?))?\s*$|); - - # Get default for int options - if (m|^\s*default "(\d+)"| && exists $intopt{$key}) { - set_int_value($key, $1); - next; - } - # Get default for hex options - if (m|^\s*default "(0x)?([[:xdigit:]]+)"| && exists $hexopt{$key}) { - set_hex_value($key, $2); - next; - } - # Override default for disabled tri/bool options - # We don't care about the default for tri/bool options otherwise - if (m/^\s*default (y|n|m|"yes"|"no")(\s+if .*)?\s*$/ && - exists $tristate{$key} && $disabled) { - $default_seen = 1; - $_ = "\tdefault n\n"; - next; + # config type + if(/^\s*bool(ean)?\s/) { + add_bool($key); + } elsif (/^\s*tristate\s/) { + add_tristate($key); + } elsif (/^\s*int\s/) { + add_int($key); + } elsif (/^\s*hex\s/) { + add_hex($key); + + # select and depend lines + } elsif (m|^\s*depends on\s+(.+?)\s*$|) { + depends($key, $1); + } elsif (m|^\s*select\s+(\w+)(\s+if\s+(.+?))?\s*$|) { + selects($key, $1, $3); + + # default lines + } elsif (m|^\s*default\s+(.+?)(?:\s+if .*)?\s*$|) { + my $o = $1; + # Get default for int options + if ($o =~ m|^"(\d+)"$| && exists $intopt{$key}) { + set_int_value($key, $1); + # Get default for hex options + } elsif ($o =~ m|^"(0x)?([[:xdigit:]]+)"$| && exists $hexopt{$key}) { + set_hex_value($key, $2); + + # Override default for disabled tri/bool options + # We don't care about the default for tri/bool options otherwise + } elsif ($o =~ /^(y|n|m|"yes"|"no")$/i && exists $tristate{$key}) { + if ($disabled) { + $default_seen = 1; + $_ = "\tdefault n\n"; + } + } else { + print "Unknown default at $file:$. $_\n" if $debug; + } + } else { + print "Skipping $file:$. $_" if $debug; } } continue { print OUT $_; diff --git a/v4l/scripts/make_myconfig.pl b/v4l/scripts/make_myconfig.pl index 0bde6f6c0..84651762d 100755 --- a/v4l/scripts/make_myconfig.pl +++ b/v4l/scripts/make_myconfig.pl @@ -24,7 +24,7 @@ close IN; my $key = 0; open IN,"Kconfig"; while () { - if (/^config\s+(\w+)\s*$/) { + if (/^(?:menu)?config\s+(\w+)\s*$/) { $key == 0 or die "Couldn't find type of config '$key'"; $key = "CONFIG_$1"; } elsif (/^\s+bool(ean)?\s/) { -- cgit v1.2.3 From 42bc9b89509b57c5c67c9588e7c37fea83989529 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Thu, 3 May 2007 11:06:10 -0700 Subject: build: Handle string options From: Trent Piepho Deal with string options and the default values. There is only one string option, and it's disabled, but someone could always add more. Signed-off-by: Trent Piepho --- v4l/scripts/make_kconfig.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'v4l/scripts') diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index 8ed189aef..5e9e416d1 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -5,6 +5,7 @@ use strict; my %depend = (); my %minver = (); my %config = (); +my %stringopt = (); my %intopt = (); my %hexopt = (); my %tristate = (); @@ -70,6 +71,7 @@ sub add_int($) { my $arg=shift; + print "Int: $arg\n" if $debug; exists $config{$arg} or die "Adding unknown int '$arg'"; $intopt{$arg} = 0; } @@ -78,10 +80,20 @@ sub add_hex($) { my $arg=shift; + print "Hex: $arg\n" if $debug; exists $config{$arg} or die "Adding unknown hex '$arg'"; $hexopt{$arg} = 0; } +sub add_string($) +{ + my $arg=shift; + + print "String: $arg\n" if $debug; + exists $config{$arg} or die "Adding unknown string '$arg'"; + $stringopt{$arg} = ""; +} + sub set_int_value($$) { my $key = shift; @@ -100,6 +112,15 @@ sub set_hex_value($$) $hexopt{$key} = "0x$val"; } +sub set_string_value($$) +{ + my $key = shift; + my $val = shift; + + exists $stringopt{$key} or die "Default for unknown string option '$key'"; + $stringopt{$key} = "\"$val\""; +} + sub add_config($) { my $arg = shift; @@ -349,6 +370,8 @@ sub open_kconfig($$) { add_int($key); } elsif (/^\s*hex\s/) { add_hex($key); + } elsif (/^\s*string\s/) { + add_string($key); # select and depend lines } elsif (m|^\s*depends on\s+(.+?)\s*$|) { @@ -365,6 +388,9 @@ sub open_kconfig($$) { # Get default for hex options } elsif ($o =~ m|^"(0x)?([[:xdigit:]]+)"$| && exists $hexopt{$key}) { set_hex_value($key, $2); + # Get default for string options + } elsif ($o =~ m|^"(.*)"$| && exists $stringopt{$key}) { + set_string_value($key, $1); # Override default for disabled tri/bool options # We don't care about the default for tri/bool options otherwise @@ -537,6 +563,9 @@ if ($force_kconfig==1 || !-e '.config') { while (my ($key,$value) = each %hexopt) { print OUT "CONFIG_$key=$value\n" if($config{$key}); } + while (my ($key,$value) = each %stringopt) { + print OUT "CONFIG_$key=$value\n" if($config{$key}); + } close OUT; print "Created default (all yes) .config file\n"; } -- cgit v1.2.3