1
0

convert-config.pl 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env perl
  2. use strict;
  3. while (<>) {
  4. my $match;
  5. my $var;
  6. my $val;
  7. my $type;
  8. chomp;
  9. next if /^CONFIG_SIGNED_PACKAGES/;
  10. if (/^CONFIG_([^=]+)=(.*)$/) {
  11. $var = $1;
  12. $val = $2;
  13. next if $var eq 'ALL';
  14. if ($val eq 'y') {
  15. $type = "bool";
  16. } elsif ($val eq 'm') {
  17. $type = "tristate";
  18. } elsif ($val =~ /^".*"$/) {
  19. $type = "string";
  20. } elsif ($val =~ /^\d+$/) {
  21. $type = "int";
  22. } else {
  23. warn "WARNING: no type found for symbol CONFIG_$var=$val\n";
  24. next;
  25. }
  26. } elsif (/^# CONFIG_BUSYBOX_(.*) is not set/) {
  27. $var = "BUSYBOX_$1";
  28. $val = 'n';
  29. $type = "bool";
  30. } else {
  31. # We don't want to preserve a record of deselecting
  32. # packages because we may want build them in the SDK.
  33. # non-package configs however may be important to preserve
  34. # the same compilation settings for packages that get
  35. # recompiled in the SDK.
  36. # Also we want avoid preserving image generation settings
  37. # because we set those while in ImageBuilder
  38. next if /^(# )?CONFIG_PACKAGE/;
  39. next if /^(# )?CONFIG_TARGET/;
  40. if (/^# CONFIG_(.*) is not set/) {
  41. $var = $1;
  42. $val = 'n';
  43. $type = "bool";
  44. }
  45. }
  46. if (($var ne '') && ($type ne '') && ($val ne '')) {
  47. print <<EOF;
  48. config $var
  49. $type
  50. default $val
  51. EOF
  52. }
  53. }