1
0

convert-config.pl 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_((BINARY)|(DOWNLOAD))_FOLDER=(.*)$/) {
  11. # We don't want to preserve the build setting of
  12. # BINARY_FOLDER and DOWNLOAD_FOLDER.
  13. $var = "$1_FOLDER";
  14. $val = '""';
  15. $type = "string";
  16. } elsif (/^CONFIG_([^=]+)=(.*)$/) {
  17. $var = $1;
  18. $val = $2;
  19. next if $var eq 'ALL';
  20. if ($val eq 'y') {
  21. $type = "bool";
  22. } elsif ($val eq 'm') {
  23. $type = "tristate";
  24. } elsif ($val =~ /^".*"$/) {
  25. $type = "string";
  26. } elsif ($val =~ /^\d+$/) {
  27. $type = "int";
  28. } else {
  29. warn "WARNING: no type found for symbol CONFIG_$var=$val\n";
  30. next;
  31. }
  32. } elsif (/^# CONFIG_BUSYBOX_(.*) is not set/) {
  33. $var = "BUSYBOX_$1";
  34. $val = 'n';
  35. $type = "bool";
  36. } else {
  37. # We don't want to preserve a record of deselecting
  38. # packages because we may want build them in the SDK.
  39. # non-package configs however may be important to preserve
  40. # the same compilation settings for packages that get
  41. # recompiled in the SDK.
  42. # Also we want avoid preserving image generation settings
  43. # because we set those while in ImageBuilder
  44. next if /^(# )?CONFIG_PACKAGE/;
  45. next if /^(# )?CONFIG_TARGET/;
  46. if (/^# CONFIG_(.*) is not set/) {
  47. $var = $1;
  48. $val = 'n';
  49. $type = "bool";
  50. }
  51. }
  52. if (($var ne '') && ($type ne '') && ($val ne '')) {
  53. print <<EOF;
  54. config $var
  55. $type
  56. default $val
  57. EOF
  58. }
  59. }