[source] image: allow specifying additional packages for device-specific rootfs

LEDE Commits lede-commits at lists.infradead.org
Sat Sep 24 09:46:11 PDT 2016


neoraider pushed a commit to source.git, branch master:
https://git.lede-project.org/e9165793409ceccaeef6674c691b875a83fcb97f

commit e9165793409ceccaeef6674c691b875a83fcb97f
Author: Matthias Schiffer <mschiffer at universe-factory.net>
AuthorDate: Sat Sep 24 18:25:25 2016 +0200

    image: allow specifying additional packages for device-specific rootfs
    
    Add a new option to each device in multi-profile mode, allowing to provide
    a list of packages to add or remove. In case of added packages, the user
    must take care that these are selected to be built.
    
    Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 include/image.mk           | 14 ++++++++++++--
 scripts/target-metadata.pl | 13 ++++++++++++-
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 63cefff..3085400 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -387,11 +387,21 @@ else
   DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_$(1))
 endif
 
+DEVICE_EXTRA_PACKAGES = $(call qstrip,$(CONFIG_TARGET_DEVICE_PACKAGES_$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_DEVICE_$(1)))
+
+define merge_packages
+  $(1) :=
+  $(foreach pkg,$(2),
+    $(1) := $$(strip $$(filter-out -$$(patsubst -%,%,$(pkg)) $$(patsubst -%,%,$(pkg)),$$($(1))) $(pkg))
+  )
+endef
+
 define Device/Check/Common
   _PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile))))
   ifdef TARGET_PER_DEVICE_ROOTFS
-    ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(DEVICE_PACKAGES)))
-    PACKAGES_$$(ROOTFS_ID/$(1)) := $$(DEVICE_PACKAGES)
+    $$(eval $$(call merge_packages,_PACKAGES,$$(DEVICE_PACKAGES) $$(call DEVICE_EXTRA_PACKAGES,$(1))))
+    ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(_PACKAGES)))
+    PACKAGES_$$(ROOTFS_ID/$(1)) := $$(_PACKAGES)
   endif
 endef
 
diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index a723916..07160dc 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -263,7 +263,7 @@ EOF
 		foreach my $profile (@{$target->{profiles}}) {
 			next unless $profile->{id} =~ /^DEVICE_/;
 			print <<EOF;
-config TARGET_DEVICE_$target->{conf}_$profile->{id}
+menuconfig TARGET_DEVICE_$target->{conf}_$profile->{id}
 	bool "$profile->{name}"
 	depends on TARGET_$target->{conf}
 	default y if TARGET_ALL_PROFILES
@@ -274,6 +274,17 @@ EOF
 				print "\tselect MODULE_DEFAULT_$pkg if TARGET_PER_DEVICE_ROOTFS\n";
 				$defaults{$pkg} = 1;
 			}
+
+			print <<EOF;
+
+
+	config TARGET_DEVICE_PACKAGES_$target->{conf}_$profile->{id}
+		string "$profile->{name} additional packages"
+		default ""
+		depends on TARGET_PER_DEVICE_ROOTFS
+		depends on TARGET_DEVICE_$target->{conf}_$profile->{id}
+
+EOF
 		}
 	}
 



More information about the lede-commits mailing list