diff --git a/Makefile b/Makefile index 90bd0d5d..bc5ae63a 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,9 @@ image/$(1): FORCE +@$$(GLUONMAKE) $$@ endef +define GluonModel +endef + include $(GLUONDIR)/include/profiles.mk CheckExternal := test -d $(GLUON_OPENWRTDIR) || (echo 'You don'"'"'t seem to have optained the external repositories needed by Gluon; please call `make update` first!'; false) @@ -114,6 +117,12 @@ CheckSite := (perl $(GLUON_SITEDIR)/site.conf 2>&1) > /dev/null || (echo 'Your s PROFILES += $(1) PROFILE_PACKAGES += $(filter-out -%,$($(1)_PACKAGES) $(2) $(GLUON_$(1)_SITE_PACKAGES)) GLUON_$(1)_DEFAULT_PACKAGES := $(2) +GLUON_$(1)_MODELS := +endef + +define GluonModel +GLUON_$(1)_MODELS += $(2) +GLUON_$(1)_MODEL_$(2) := $(3) endef include $(INCLUDE_DIR)/target.mk @@ -207,14 +216,16 @@ include $(INCLUDE_DIR)/package-ipkg.mk # override variables from rules.mk PACKAGE_DIR = $(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages -BIN_DIR = $(GLUON_IMAGEDIR)/$(BOARD)/$(PROFILE) PROFILE_BUILDDIR = $(BOARD_BUILDDIR)/$(PROFILE) PROFILE_KDIR = $(PROFILE_BUILDDIR)/kernel +BIN_DIR = $(PROFILE_BUILDDIR)/images TMP_DIR = $(PROFILE_BUILDDIR)/tmp TARGET_DIR = $(PROFILE_BUILDDIR)/root +IMAGE_PREFIX = gluon-$(GLUON_SITE_CODE)-$$(cat $(gluon_prepared_stamp))-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) + OPKG:= \ IPKG_TMP="$(TMP_DIR)/ipkgtmp" \ IPKG_INSTROOT="$(TARGET_DIR)" \ @@ -257,15 +268,22 @@ package_install: FORCE image: FORCE rm -rf $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(PROFILE_KDIR) - mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(TARGET_DIR)/tmp + mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(TARGET_DIR)/tmp $(GLUON_IMAGEDIR)/factory $(GLUON_IMAGEDIR)/sysupgrade cp -r $(BOARD_KDIR) $(PROFILE_KDIR) +$(GLUONMAKE) package_install $(call Image/mkfs/prepare) - $(_SINGLE)$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 IMG_PREFIX="gluon-$(GLUON_SITE_CODE)-$$(cat $(gluon_prepared_stamp))-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))" \ + $(_SINGLE)$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 IMG_PREFIX="$(IMAGE_PREFIX)" \ PROFILE="$(PROFILE)" KDIR="$(PROFILE_KDIR)" TARGET_DIR="$(TARGET_DIR)" BIN_DIR="$(BIN_DIR)" TMP_DIR="$(TMP_DIR)" + $(foreach model,$(GLUON_$(PROFILE)_MODELS), \ + rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(model)-*.bin && \ + rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(model)-*.bin && \ + \ + cp $(BIN_DIR)/$(IMAGE_PREFIX)-$(model)-*-factory.bin $(GLUON_IMAGEDIR)/factory/ && \ + cp $(BIN_DIR)/$(IMAGE_PREFIX)-$(model)-*-sysupgrade.bin $(GLUON_IMAGEDIR)/sysupgrade/ && \ + ) : call_image/%: FORCE +$(GLUONMAKE) $(patsubst call_image/%,image/%,$@) diff --git a/include/profiles.mk b/include/profiles.mk index b85e86dc..d61ce1b0 100644 --- a/include/profiles.mk +++ b/include/profiles.mk @@ -9,37 +9,59 @@ USB_PACKAGES := block-mount kmod-fs-ext4 kmod-fs-vfat kmod-usb-storage kmod-usb- # TL-WR740N v1, v3, v4 $(eval $(call GluonProfile,TLWR740)) +$(eval $(call GluonModel,TLWR740,tl-wr740n-v1,tp-link-tl-wr740n-nd-v1)) +$(eval $(call GluonModel,TLWR740,tl-wr740n-v3,tp-link-tl-wr740n-nd-v3)) +$(eval $(call GluonModel,TLWR740,tl-wr740n-v4,tp-link-tl-wr740n-nd-v4)) # TL-WR741N/ND v1, v2, v4 $(eval $(call GluonProfile,TLWR741)) +$(eval $(call GluonModel,TLWR741,tl-wr741nd-v1,tp-link-tl-wr741n-nd-v1)) +$(eval $(call GluonModel,TLWR741,tl-wr741nd-v2,tp-link-tl-wr741n-nd-v2)) +$(eval $(call GluonModel,TLWR741,tl-wr741nd-v4,tp-link-tl-wr741n-nd-v4)) -# TL-WR841N/ND v1.5, v3, v5, v7, v8 +# TL-WR841N/ND v3, v5, v7, v8 $(eval $(call GluonProfile,TLWR841)) +$(eval $(call GluonModel,TLWR841,tl-wr841nd-v3,tp-link-tl-wr841n-nd-v3)) +$(eval $(call GluonModel,TLWR841,tl-wr841nd-v5,tp-link-tl-wr841n-nd-v5)) +$(eval $(call GluonModel,TLWR841,tl-wr841nd-v7,tp-link-tl-wr841n-nd-v7)) +$(eval $(call GluonModel,TLWR841,tl-wr841n-v8,tp-link-tl-wr841n-nd-v8)) # TL-WR842N/ND v1 $(eval $(call GluonProfile,TLWR842,$(USB_PACKAGES))) +$(eval $(call GluonModel,TLWR842,tl-wr842n-v1,tp-link-tl-wr842n-nd-v1)) # TL-WR941N/ND v2, v3, v4 $(eval $(call GluonProfile,TLWR941)) +$(eval $(call GluonModel,TLWR941,tl-wr941nd-v2,tp-link-tl-wr941n-nd-v2)) +$(eval $(call GluonModel,TLWR941,tl-wr941nd-v3,tp-link-tl-wr941n-nd-v3)) +$(eval $(call GluonModel,TLWR941,tl-wr941nd-v4,tp-link-tl-wr941n-nd-v4)) # TL-WR1043N/ND v1 $(eval $(call GluonProfile,TLWR1043,$(USB_PACKAGES))) +$(eval $(call GluonModel,TLWR1043,tl-wr1043nd-v1,tp-link-tl-wr1043n-nd-v1)) # TL-WDR3600/4300 v1 $(eval $(call GluonProfile,TLWDR4300,$(USB_PACKAGES))) +$(eval $(call GluonModel,TLWDR4300,tl-wdr3600-v1,tp-link-tl-wdr3600-v1)) +$(eval $(call GluonModel,TLWDR4300,tl-wdr4300-v1,tp-link-tl-wdr4300-v1)) # TL-MR3020 v1 $(eval $(call GluonProfile,TLMR3020,$(USB_PACKAGES))) +$(eval $(call GluonModel,TLMR3020,tl-mr3020-v1,tp-link-tl-mr3020)) # TL-MR3040 v1 $(eval $(call GluonProfile,TLMR3040,$(USB_PACKAGES))) +$(eval $(call GluonModel,TLMR3040,tl-mr3040-v1,tp-link-tl-mr3040)) # TL-MR3220 v1 $(eval $(call GluonProfile,TLMR3220,$(USB_PACKAGES))) +$(eval $(call GluonModel,TLMR3220,tl-mr3220-v1,tp-link-tl-mr3220)) # TL-MR3420 v1 $(eval $(call GluonProfile,TLMR3420,$(USB_PACKAGES))) - +$(eval $(call GluonModel,TLMR3420,tl-mr3420-v1,tp-link-tl-mr3420)) ## Ubiquiti (everything) $(eval $(call GluonProfile,UBNT,$(USB_PACKAGES))) +$(eval $(call GluonModel,UBNT,ubnt-bullet-m,ubiquity-bullet-m)) +$(eval $(call GluonModel,UBNT,ubnt-nano-m,ubiquity-nanostation-m))