From f8ebbbc568c166e59f1302e0abb817060313fd9d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 22 May 2016 22:02:31 +0200 Subject: [PATCH] build: implement support for selecting multiple device profiles Signed-off-by: Felix Fietkau --- include/image.mk | 2 +- scripts/metadata.pm | 1 + scripts/target-metadata.pl | 46 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/include/image.mk b/include/image.mk index 365098d5c0..aeff95d093 100644 --- a/include/image.mk +++ b/include/image.mk @@ -482,7 +482,7 @@ endef ifdef IB DEVICE_CHECK_PROFILE = $(filter $(1),$(PROFILE)) else - DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_$(1)) + DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_$(1)) endif define Device/Check diff --git a/scripts/metadata.pm b/scripts/metadata.pm index b3f34f79e9..c7f8532b54 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -87,6 +87,7 @@ sub parse_target_metadata($) { priority => 999, packages => [] }; + $1 =~ /^DEVICE_/ and $target->{has_devices} = 1; push @{$target->{profiles}}, $profile; }; /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1; diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl index 16f8a9f356..34a7c22ce6 100755 --- a/scripts/target-metadata.pl +++ b/scripts/target-metadata.pl @@ -102,6 +102,9 @@ EOF if ($target->{arch} =~ /\w/) { $confstr .= "\tselect $target->{arch}\n"; } + if ($target->{has_devices}) { + $confstr .= "\tselect HAS_DEVICES\n"; + } } foreach my $dep (@{$target->{depends}}) { @@ -186,6 +189,21 @@ endchoice choice prompt "Target Profile" +EOF + foreach my $target (@target) { + my $profile = $target->{profiles}->[0]; + $profile or next; + print <{conf}_$profile->{id} if TARGET_$target->{conf} +EOF + } + + print <{profiles}; + foreach my $profile (@{$target->{profiles}}) { + next unless $profile->{id} =~ /^DEVICE_/; + print <{conf}_$profile->{id} + bool "$profile->{name}" + depends on TARGET_$target->{conf} +EOF + my @pkglist = merge_package_lists($target->{packages}, $profile->{packages}); + foreach my $pkg (@pkglist) { + print "\tselect DEFAULT_$pkg\n"; + $defaults{$pkg} = 1; + } + } + } + + print <