ath79: remove more duplicate image build variables
[openwrt/openwrt.git] / target / linux / ath79 / image / generic.mk
index aedd67d699872c3b2368eabb6d97830216097818..42a1b7259893c35700038e644f7748621afb0060 100644 (file)
@@ -3,6 +3,7 @@ include ./common-netgear.mk
 
 DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION
 DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
+DEVICE_VARS += KERNEL_INITRAMFS_PREFIX
 
 define Build/cybertan-trx
        @echo -n '' > $@-empty.bin
@@ -19,29 +20,32 @@ define Build/addpattern
        -mv "$@.new" "$@"
 endef
 
-define Build/elecom-header
-  $(eval fw_size=$(word 1,$(1)))
-  $(eval edimax_model=$(word 2,$(1)))
-  $(eval product=$(word 3,$(1)))
-  $(eval factory_bin=$(word 4,$(1)))
-  if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(fw_size)" ]; then \
-    $(CP) $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) $(factory_bin); \
-    $(STAGING_DIR_HOST)/bin/mkedimaximg \
-      -b -s CSYS -m $(edimax_model) \
-      -f 0x70000 -S 0x01100000 \
-      -i $(factory_bin) -o $(factory_bin).new; \
-    mv $(factory_bin).new $(factory_bin); \
-    ( \
-      echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
-      echo -n "0.00" | dd bs=16 count=1 conv=sync; \
-      dd if=$(factory_bin); \
-    ) > $(factory_bin).new; \
-    mv $(factory_bin).new $(factory_bin); \
-    $(CP) $(factory_bin) $(BIN_DIR)/; \
-       else \
-               echo "WARNING: initramfs kernel image too big, cannot generate factory image" >&2; \
-       fi
+define Build/add-elecom-factory-initramfs
+  $(eval edimax_model=$(word 1,$(1)))
+  $(eval product=$(word 2,$(1)))
 
+  $(STAGING_DIR_HOST)/bin/mkedimaximg \
+       -b -s CSYS -m $(edimax_model) \
+       -f 0x70000 -S 0x01100000 \
+       -i $@ -o $@.factory
+
+  ( \
+       echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
+       echo -n "0.00" | dd bs=16 count=1 conv=sync; \
+       dd if=$@.factory; \
+  ) > $@.factory.new
+
+  if [ "$$(stat -c%s $@.factory.new)" -le $$(($(subst k,* 1024,$(subst m, * 1024k,$(IMAGE_SIZE))))) ]; then \
+       mv $@.factory.new $(BIN_DIR)/$(KERNEL_INITRAMFS_PREFIX)-factory.bin; \
+  else \
+       echo "WARNING: initramfs kernel image too big, cannot generate factory image" >&2; \
+  fi
+endef
+
+define Build/nec-enc
+  $(STAGING_DIR_HOST)/bin/nec-enc \
+    -i $@ -o $@.new -k $(1)
+  mv $@.new $@
 endef
 
 define Build/nec-fw
@@ -94,6 +98,7 @@ define Device/avm_fritz4020
       append-squashfs-fakeroot-be | pad-to 256 | \
       append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
   DEVICE_PACKAGES := fritz-tffs
+  SUPPORTED_DEVICES += fritz4020
 endef
 TARGET_DEVICES += avm_fritz4020
 
@@ -156,6 +161,31 @@ define Device/buffalo_wzr-hp-g450h
 endef
 TARGET_DEVICES += buffalo_wzr-hp-g450h
 
+define Device/comfast_cf-e110n-v2
+  ATH_SOC := qca9533
+  DEVICE_TITLE := COMFAST CF-E110N v2
+  DEVICE_PACKAGES := rssileds kmod-leds-gpio -swconfig -uboot-envtools
+  IMAGE_SIZE := 16192k
+endef
+TARGET_DEVICES += comfast_cf-e110n-v2
+
+define Device/comfast_cf-e120a-v3
+  ATH_SOC := ar9344
+  DEVICE_TITLE := COMFAST CF-E120A v3
+  DEVICE_PACKAGES := rssileds kmod-leds-gpio -uboot-envtools
+  IMAGE_SIZE := 8000k
+endef
+TARGET_DEVICES += comfast_cf-e120a-v3
+
+define Device/comfast_cf-e5
+  ATH_SOC := qca9531
+  DEVICE_TITLE := COMFAST CF-E5/E7
+  DEVICE_PACKAGES := rssileds kmod-leds-gpio kmod-usb-core kmod-usb2 kmod-usb-net \
+       kmod-usb-net-qmi-wwan -swconfig -uboot-envtools
+  IMAGE_SIZE := 16192k
+endef
+TARGET_DEVICES += comfast_cf-e5
+
 define Device/devolo_dvl1200e
   ATH_SOC := qca9558
   DEVICE_TITLE := devolo WiFi pro 1200e
@@ -164,6 +194,14 @@ define Device/devolo_dvl1200e
 endef
 TARGET_DEVICES += devolo_dvl1200e
 
+define Device/devolo_dvl1200i
+  ATH_SOC := qca9558
+  DEVICE_TITLE := devolo WiFi pro 1200i
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
+  IMAGE_SIZE := 15936k
+endef
+TARGET_DEVICES += devolo_dvl1200i
+
 define Device/devolo_dvl1750c
   ATH_SOC := qca9558
   DEVICE_TITLE := devolo WiFi pro 1750c
@@ -172,6 +210,22 @@ define Device/devolo_dvl1750c
 endef
 TARGET_DEVICES += devolo_dvl1750c
 
+define Device/devolo_dvl1750e
+  ATH_SOC := qca9558
+  DEVICE_TITLE := devolo WiFi pro 1750e
+  DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
+  IMAGE_SIZE := 15936k
+endef
+TARGET_DEVICES += devolo_dvl1750e
+
+define Device/devolo_dvl1750i
+  ATH_SOC := qca9558
+  DEVICE_TITLE := devolo WiFi pro 1750i
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
+  IMAGE_SIZE := 15936k
+endef
+TARGET_DEVICES += devolo_dvl1750i
+
 define Device/dlink_dir-825-b1
   ATH_SOC := ar7161
   DEVICE_TITLE := D-LINK DIR-825 B1
@@ -226,8 +280,7 @@ define Device/elecom_wrc-1750ghbk2-i
   DEVICE_TITLE := ELECOM WRC-1750GHBK2-I/C
   IMAGE_SIZE := 15808k
   KERNEL_INITRAMFS := $$(KERNEL) | pad-to 2 | \
-    elecom-header 16187314 RN68 WRC-1750GHBK2 \
-      $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.bin
+       add-elecom-factory-initramfs RN68 WRC-1750GHBK2
   DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
 endef
 TARGET_DEVICES += elecom_wrc-1750ghbk2-i
@@ -237,8 +290,7 @@ define Device/elecom_wrc-300ghbk2-i
   DEVICE_TITLE := ELECOM WRC-300GHBK2-I
   IMAGE_SIZE := 7616k
   KERNEL_INITRAMFS := $$(KERNEL) | pad-to 2 | \
-    elecom-header 7798706 RN51 WRC-300GHBK2-I \
-      $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.bin
+       add-elecom-factory-initramfs RN51 WRC-300GHBK2-I
 endef
 TARGET_DEVICES += elecom_wrc-300ghbk2-i
 
@@ -250,6 +302,19 @@ define Device/embeddedwireless_dorin
 endef
 TARGET_DEVICES += embeddedwireless_dorin
 
+define Device/engenius_epg5000
+  ATH_SOC := qca9558
+  DEVICE_TITLE := EnGenius EPG5000
+  DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct kmod-usb2
+  IMAGE_SIZE := 14656k
+  IMAGES += factory.dlf
+  IMAGE/factory.dlf := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       senao-header -r 0x101 -p 0x71 -t 2
+  SUPPORTED_DEVICES += epg5000
+endef
+TARGET_DEVICES += engenius_epg5000
+
 define Device/engenius_ews511ap
   ATH_SOC := qca9531
   DEVICE_TITLE := EnGenius EWS511AP
@@ -276,23 +341,33 @@ define Device/glinet_gl-ar150
 endef
 TARGET_DEVICES += glinet_gl-ar150
 
-define Device/glinet_gl-ar300m-nor
+define Device/glinet_gl-ar300m-common-nor
   ATH_SOC := qca9531
-  DEVICE_TITLE := GL.iNet GL-AR300M
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2
   IMAGE_SIZE := 16000k
   SUPPORTED_DEVICES += gl-ar300m
 endef
+
+define Device/glinet_gl-ar300m-lite
+  $(Device/glinet_gl-ar300m-common-nor)
+  DEVICE_TITLE := GL.iNet GL-AR300M-Lite
+endef
+TARGET_DEVICES += glinet_gl-ar300m-lite
+
+define Device/glinet_gl-ar300m-nor
+  $(Device/glinet_gl-ar300m-common-nor)
+  DEVICE_TITLE := GL.iNet GL-AR300M
+endef
 TARGET_DEVICES += glinet_gl-ar300m-nor
 
-define Device/glinet_ar750s
+define Device/glinet_gl-ar750s
   ATH_SOC := qca9563
   DEVICE_TITLE := GL.iNet GL-AR750S
   DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
   IMAGE_SIZE := 16000k
   SUPPORTED_DEVICES += gl-ar750s
 endef
-TARGET_DEVICES += glinet_ar750s
+TARGET_DEVICES += glinet_gl-ar750s
 
 define Device/glinet_gl-x750
   ATH_SOC := qca9531
@@ -321,6 +396,18 @@ define Device/iodata_wn-ac1167dgr
 endef
 TARGET_DEVICES += iodata_wn-ac1167dgr
 
+define Device/iodata_wn-ac1600dgr
+  ATH_SOC := qca9557
+  DEVICE_TITLE := I-O DATA WN-AC1600DGR
+  IMAGE_SIZE := 14656k
+  IMAGES += factory.bin
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+    append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+    senao-header -r 0x30a -p 0x60 -t 2 -v 200
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
+endef
+TARGET_DEVICES += iodata_wn-ac1600dgr
+
 define Device/iodata_wn-ac1600dgr2
   ATH_SOC := qca9557
   DEVICE_TITLE := I-O DATA WN-AC1600DGR2
@@ -345,6 +432,44 @@ define Device/iodata_wn-ag300dgr
 endef
 TARGET_DEVICES += iodata_wn-ag300dgr
 
+define Device/jjplus_ja76pf2
+  ATH_SOC := ar7161
+  DEVICE_TITLE := jjPlus JA76PF2
+  DEVICE_PACKAGES += -kmod-ath9k -swconfig -wpad-mini -uboot-envtools fconfig
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE)
+#  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata
+  KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
+  KERNEL_INITRAMFS := kernel-bin | append-dtb
+  IMAGE_SIZE := 16000k
+endef
+TARGET_DEVICES += jjplus_ja76pf2
+
+define Device/librerouter_librerouter-v1
+  ATH_SOC := qca9558
+  DEVICE_TITLE := LibreRouter v1
+  IMAGE_SIZE := 7936k
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+endef
+TARGET_DEVICES += librerouter_librerouter-v1
+
+define Device/nec_wg1200cr
+  ATH_SOC := qca9563
+  DEVICE_TITLE := NEC Aterm WG1200CR
+  IMAGE_SIZE := 7616k
+  SEAMA_MTDBLOCK := 6
+  SEAMA_SIGNATURE := wrgac72_necpf.2016gui_wg1200cr
+  IMAGES += factory.bin
+  IMAGE/default := \
+    append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs
+  IMAGE/sysupgrade.bin := \
+    $$(IMAGE/default) | seama | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+  IMAGE/factory.bin := \
+    $$(IMAGE/default) | pad-rootfs -x 64 | seama | seama-seal | nec-enc 9gsiy9nzep452pad | \
+    check-size $$$$(IMAGE_SIZE)
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
+endef
+TARGET_DEVICES += nec_wg1200cr
+
 define Device/nec_wg800hp
   ATH_SOC := qca9563
   DEVICE_TITLE := NEC Aterm WG800HP
@@ -376,6 +501,15 @@ define Device/ocedo_raccoon
 endef
 TARGET_DEVICES += ocedo_raccoon
 
+define Device/ocedo_ursus
+  ATH_SOC := qca9558
+  DEVICE_TITLE := OCEDO Ursus
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
+  IMAGE_SIZE := 7424k
+  IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += ocedo_ursus
+
 define Device/openmesh_om5p-ac-v2
   ATH_SOC := qca9558
   DEVICE_TITLE := OpenMesh OM5P-AC v2
@@ -412,12 +546,9 @@ TARGET_DEVICES += pcs_cr5000
 
 define Device/netgear_wndr3x00
   ATH_SOC := ar7161
-  KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
-  IMAGES += factory.img
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs
-  IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)
-  IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE)
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-leds-reset kmod-owl-loader
+  $(Device/netgear_ath79)
 endef
 
 define Device/netgear_wndr3700
@@ -500,3 +631,18 @@ define Device/winchannel_wb2000
   DEVICE_PACKAGES := kmod-i2c-core kmod-i2c-gpio kmod-rtc-ds1307 kmod-usb2 kmod-usb-ledtrig-usbport
 endef
 TARGET_DEVICES += winchannel_wb2000
+
+define Device/xiaomi_mi-router-4q
+  ATH_SOC := qca9561
+  DEVICE_TITLE := Xiaomi Mi Router 4Q
+  IMAGE_SIZE := 14336k
+endef
+TARGET_DEVICES += xiaomi_mi-router-4q
+
+define Device/yuncore_a770
+  ATH_SOC := qca9531
+  DEVICE_TITLE := YunCore A770
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9887-ct
+  IMAGE_SIZE := 16000k
+endef
+TARGET_DEVICES += yuncore_a770