Преглед изворни кода

build: use symlinks instead of copies when multiple devices use identical images

Matthias Schiffer пре 9 година
родитељ
комит
3b4f154445
2 измењених фајлова са 31 додато и 13 уклоњено
  1. 17 0
      Makefile
  2. 14 13
      targets/ar71xx-generic/profiles.mk

+ 17 - 0
Makefile

@@ -168,6 +168,11 @@ endef
 define GluonModel
 GLUON_$(1)_MODELS += $(3)
 GLUON_$(1)_MODEL_$(3) := $(2)
+GLUON_$(1)_MODEL_$(3)_ALIASES :=
+endef
+
+define GluonModelAlias
+GLUON_$(1)_MODEL_$(2)_ALIASES += $(3)
 endef
 
 
@@ -402,8 +407,20 @@ image: FORCE
 			rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(model)$(GLUON_$(PROFILE)_FACTORY_EXT) && \
 			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) && \
 		) \
+		\
+		$(foreach alias,$(GLUON_$(PROFILE)_MODEL_$(model)_ALIASES), \
+			$(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXT), \
+				rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(alias)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \
+				ln -s $(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) $(GLUON_IMAGEDIR)/sysupgrade/$(IMAGE_PREFIX)-$(alias)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \
+			) \
+			$(if $(GLUON_$(PROFILE)_FACTORY_EXT), \
+				rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(alias)$(GLUON_$(PROFILE)_FACTORY_EXT) && \
+				ln -s $(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXT) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(alias)$(GLUON_$(PROFILE)_FACTORY_EXT) && \
+			) \
+		) \
 	) :
 
+
 image/%: $(gluon_prepared_stamp)
 	+$(GLUONMAKE) image PROFILE="$(patsubst image/%,%,$@)" V=s$(OPENWRT_VERBOSE)
 

+ 14 - 13
targets/ar71xx-generic/profiles.mk

@@ -4,15 +4,16 @@
 
 # CPE210/220/510/520
 $(eval $(call GluonProfile,CPE510,rssileds))
-$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe210-v1.0))
-$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe220-v1.0))
 $(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe510-v1.0))
-$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe520-v1.0))
+
+$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe210-v1.0))
+$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe220-v1.0))
+$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe520-v1.0))
 ifeq ($(BROKEN),1)
-$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe210-v1.1))
-$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe220-v1.1))
-$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe510-v1.1))
-$(eval $(call GluonModel,CPE510,cpe210-220-510-520,tp-link-cpe520-v1.1))
+$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe210-v1.1))
+$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe220-v1.1))
+$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe510-v1.1))
+$(eval $(call GluonModelAlias,CPE510,tp-link-cpe510-v1.0,tp-link-cpe520-v1.1))
 endif
 
 # TL-WA701N/ND v1, v2
@@ -76,9 +77,9 @@ $(eval $(call GluonModel,TLWR941,tl-wr941nd-v5,tp-link-tl-wr941n-nd-v5))
 ifeq ($(BROKEN),1)
 # $(eval $(call GluonModel,TLWR941,tl-wr941nd-v6,tp-link-tl-wr941n-nd-v6)) # BROKEN: needs mac80211 update
 
-$(eval $(call GluonModel,TLWR941,tl-wr941nd-v4,tp-link-tl-wr940n-nd-v1)) # BROKEN: untested
-$(eval $(call GluonModel,TLWR941,tl-wr941nd-v5,tp-link-tl-wr940n-nd-v2)) # BROKEN: untested
-# $(eval $(call GluonModel,TLWR941,tl-wr941nd-v6,tp-link-tl-wr940n-nd-v3)) # BROKEN: needs mac80211 update
+$(eval $(call GluonModelAlias,TLWR941,tp-link-tl-wr941n-nd-v4,tp-link-tl-wr940n-nd-v1)) # BROKEN: untested
+$(eval $(call GluonModelAlias,TLWR941,tp-link-tl-wr941n-nd-v5,tp-link-tl-wr940n-nd-v2)) # BROKEN: untested
+# $(eval $(call GluonModelAlias,TLWR941,tp-link-tl-wr941n-nd-v6,tp-link-tl-wr940n-nd-v3)) # BROKEN: needs mac80211 update
 endif
 
 # TL-WR1043N/ND v1, v2
@@ -150,9 +151,9 @@ $(eval $(call GluonProfile,UBNT))
 $(eval $(call GluonModel,UBNT,ubnt-air-gateway,ubiquiti-airgateway))
 
 $(eval $(call GluonModel,UBNT,ubnt-bullet-m,ubiquiti-bullet-m))
-$(eval $(call GluonModel,UBNT,ubnt-bullet-m,ubiquiti-loco-m))
-$(eval $(call GluonModel,UBNT,ubnt-bullet-m,ubiquiti-picostation-m))
-$(eval $(call GluonModel,UBNT,ubnt-bullet-m,ubiquiti-rocket-m))
+$(eval $(call GluonModelAlias,UBNT,ubiquiti-bullet-m,ubiquiti-loco-m))
+$(eval $(call GluonModelAlias,UBNT,ubiquiti-bullet-m,ubiquiti-picostation-m))
+$(eval $(call GluonModelAlias,UBNT,ubiquiti-bullet-m,ubiquiti-rocket-m))
 
 $(eval $(call GluonModel,UBNT,ubnt-loco-m-xw,ubiquiti-loco-m-xw))
 $(eval $(call GluonModel,UBNT,ubnt-nano-m,ubiquiti-nanostation-m))