build: allow overriding default selection state for devices
authorJonas Gorski <jonas.gorski@gmail.com>
Tue, 13 Aug 2019 10:33:47 +0000 (12:33 +0200)
committerRISCi_ATOM <bob@bobcall.me>
Fri, 13 Sep 2019 20:06:06 +0000 (16:06 -0400)
Allow overriding the default selection state for Devices, similar to
setting a default for packages.

E.g. by setting DEFAULT to n, they won't be selected by default anymore
when enabling all device in the multi device profile.

This allows preventing images being built by the default config for
known broken devices, devices without enough RAM/flash, or devices not
working with a certain kernel versions.

This does not prevent the devices from being manually selected or images
being built by the ImageBuilder. These devices often still have worth
with a reduced package-set, or as a device for regression testing, when
no better device is available.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
(cherry picked from commit 7546be60074e452751ba2a48eddbc13910bec708)

include/image.mk
scripts/metadata.pm
scripts/target-metadata.pl

index 530a2b1335a83bb31f8de0b796c37ca67a21f2cb..1538d83df341dc1467c9ab3de256cd44476bdfb6 100644 (file)
@@ -385,6 +385,8 @@ define Device/Init
   FILESYSTEMS := $(TARGET_FILESYSTEMS)
 
   UBOOT_PATH :=  $(STAGING_DIR_IMAGE)/uboot-$(1)
+
+  DEFAULT :=
 endef
 
 DEFAULT_DEVICE_VARS := \
@@ -561,6 +563,7 @@ Target-Profile-Name: $(DEVICE_TITLE)
 Target-Profile-Packages: $(DEVICE_PACKAGES)
 Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0)
 Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES)
+$(if $(DEFAULT),Target-Profile-Default: $(DEFAULT))
 Target-Profile-Description:
 $(DEVICE_DESCRIPTION)
 @@
index d088332152794ed05188ae74d32e785e305a3ec7..1826a040a1165032f49a64f10de40ed0d75f97fe 100644 (file)
@@ -143,7 +143,8 @@ sub parse_target_metadata($) {
                                has_image_metadata => 0,
                                supported_devices => [],
                                priority => 999,
-                               packages => []
+                               packages => [],
+                               default => "y if TARGET_ALL_PROFILES"
                        };
                        $1 =~ /^DEVICE_/ and $target->{has_devices} = 1;
                        push @{$target->{profiles}}, $profile;
@@ -157,6 +158,7 @@ sub parse_target_metadata($) {
                };
                /^Target-Profile-Packages:\s*(.*)\s*$/ and $profile->{packages} = [ split(/\s+/, $1) ];
                /^Target-Profile-Description:\s*(.*)\s*/ and $profile->{desc} = get_multiline(*FILE);
+               /^Target-Profile-Default:\s*(.+)\s*$/ and $profile->{default} = $1;
        }
        close FILE;
        foreach my $target (@target) {
index d183e943f6c03e42b7df9874de8059042c8a7d8e..ee0ab5a71811a900a1b79152a3acd924724bf4cf 100755 (executable)
@@ -296,7 +296,7 @@ EOF
 menuconfig TARGET_DEVICE_$target->{conf}_$profile->{id}
        bool "$profile->{name}"
        depends on TARGET_$target->{conf}
-       default y if TARGET_ALL_PROFILES
+       default $profile->{default}
 EOF
                        my @pkglist = merge_package_lists($target->{packages}, $profile->{packages});
                        foreach my $pkg (@pkglist) {