X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=blobdiff_plain;f=scripts%2Fgen_target_config.pl;h=10c6c2c0b2d8dbf9a58039a3d99a8c5f1bc580fe;hp=c0b83963b64de44a2c10409f43570ef848eac932;hb=a8bf001f119e7853bbf50f79ada7dbe021d2c573;hpb=66f81f7f09e169bd0a9c99854a306a4cd4913196;ds=sidebyside diff --git a/scripts/gen_target_config.pl b/scripts/gen_target_config.pl index c0b83963b6..10c6c2c0b2 100755 --- a/scripts/gen_target_config.pl +++ b/scripts/gen_target_config.pl @@ -10,6 +10,8 @@ use strict; my @target; my $target; +my $profiles; +my $profile; sub features(@) { my $ret; @@ -30,11 +32,15 @@ sub features(@) { while (<>) { chomp; /^Target:\s*((.+)-(\d+\.\d+))\s*$/ and do { + my $conf = uc $3.'_'.$2; + $conf =~ tr/\.-/__/; $target = { id => $1, + conf => $conf, board => $2, kernel => $3 }; + $target->{kernel} =~ tr/\./_/; push @target, $target; }; /^Target-Name:\s*(.+)\s*$/ and $target->{name} = $1; @@ -56,6 +62,22 @@ while (<>) { /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1; /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1; /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1; + /^Default-Packages:\s*(.+)\s*$/ and do { + my @pkgs = split /\s+/, $1; + $target->{defaultpkgs} = \@pkgs; + }; + /^Target-Profile:\s*(.+)\s*$/ and do { + $profiles = $target->{profiles} or $target->{profiles} = $profiles = []; + $profile = { + id => $1 + }; + push @$profiles, $profile; + }; + /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1; + /^Target-Profile-Packages:\s*(.+)\s*$/ and do { + my @pkgs = split /\s+/, $1; + $profile->{pkgs} = \@pkgs; + }; } @target = sort { @@ -63,13 +85,18 @@ while (<>) { } @target; +print <{kernel}.'_'.$target->{board}; my $features = features(@{$target->{features}}); my $help = $target->{desc}; chomp $features; $features .= "\n"; - $conf =~ tr/\.-/__/; if ($help =~ /\w+/) { $help =~ s/^\s*/\t /mg; $help = "\thelp\n$help"; @@ -78,11 +105,96 @@ foreach $target (@target) { } print <{conf} bool "$target->{name}" select $target->{arch} + select LINUX_$target->{kernel} $features$help EOF } +print <{profiles} or $profiles = [ + { + id => 'Default', + name => 'Default', + pkgs => [] + } + ]; + foreach my $profile (@$profiles) { + print <{conf}_$profile->{id} + bool "$profile->{name}" + depends LINUX_$target->{conf} +EOF + foreach my $pkg (@{$target->{defaultpkgs}}, @{$profile->{pkgs}}) { + print "\tselect DEFAULT_$pkg\n"; + } + print "\n"; + } +} + +print "endchoice\n";