From acd5cc903ec70253dd3aa968f837104c5c0f3ef3 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 23 Jun 2016 00:24:00 +0200
Subject: [PATCH] build: allow profiles to supply an additional file to be
 copied to the image directory

---
 Makefile | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Makefile b/Makefile
index 90ea36f3d..5c02c7529 100644
--- a/Makefile
+++ b/Makefile
@@ -152,17 +152,21 @@ GLUON_$(1)_FACTORY_SUFFIX := -squashfs-factory
 GLUON_$(1)_SYSUPGRADE_SUFFIX := -squashfs-sysupgrade
 GLUON_$(1)_FACTORY_EXT := .bin
 GLUON_$(1)_SYSUPGRADE_EXT := .bin
+GLUON_$(1)_FACTORY_EXTRA :=
+GLUON_$(1)_SYSUPGRADE_EXTRA :=
 GLUON_$(1)_MODELS :=
 endef
 
 define GluonProfileFactorySuffix
 GLUON_$(1)_FACTORY_SUFFIX := $(2)
 GLUON_$(1)_FACTORY_EXT := $(3)
+GLUON_$(1)_FACTORY_EXTRA := $(4)
 endef
 
 define GluonProfileSysupgradeSuffix
 GLUON_$(1)_SYSUPGRADE_SUFFIX := $(2)
 GLUON_$(1)_SYSUPGRADE_EXT := $(3)
+GLUON_$(1)_SYSUPGRADE_EXTRA := $(4)
 endef
 
 define GluonModel
@@ -447,6 +451,15 @@ image: FORCE
 			cp $(BIN_DIR)/gluon-$(GLUON_$(PROFILE)_MODEL_$(model))$(GLUON_$(PROFILE)_FACTORY_SUFFIX)$(GLUON_$(PROFILE)_FACTORY_EXT) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXT) && \
 		) \
 		\
+		$(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA), \
+			rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) && \
+			cp $(BIN_DIR)/gluon$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) $(GLUON_IMAGEDIR)/sysupgrade/$(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) && \
+		) \
+		$(if $(GLUON_$(PROFILE)_FACTORY_EXTRA), \
+			rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(model)$(GLUON_$(PROFILE)_FACTORY_EXTRA) && \
+			cp $(BIN_DIR)/gluon$(GLUON_$(PROFILE)_FACTORY_EXTRA) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXTRA) && \
+		) \
+		\
 		$(foreach alias,$(GLUON_$(PROFILE)_MODEL_$(model)_ALIASES), \
 			$(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXT), \
 				rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(alias)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \
-- 
GitLab