ath79: add support for D-Link DCH-G020 Rev. A1
[openwrt/staging/dedeckeh.git] / target / linux / ath79 / image / generic.mk
index 800e1c7a7df9a0f10aa2c9f3ffec96c400b133fa..14e72140dc55da934ecb86de20278198699650d8 100644 (file)
@@ -6,6 +6,7 @@ include ./common-yuncore.mk
 DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION
 DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
 DEVICE_VARS += KERNEL_INITRAMFS_PREFIX
+DEVICE_VARS += DAP_SIGNATURE
 
 define Build/add-elecom-factory-initramfs
   $(eval edimax_model=$(word 1,$(1)))
@@ -35,6 +36,11 @@ define Build/addpattern
        -mv "$@.new" "$@"
 endef
 
+define Build/append-md5sum-bin
+       $(STAGING_DIR_HOST)/bin/mkhash md5 $@ | sed 's/../\\\\x&/g' |\
+               xargs echo -ne >> $@
+endef
+
 define Build/cybertan-trx
        @echo -n '' > $@-empty.bin
        -$(STAGING_DIR_HOST)/bin/trx -o $@.new \
@@ -44,6 +50,48 @@ define Build/cybertan-trx
        -rm $@-empty.bin
 endef
 
+define Build/mkdapimg2
+       $(STAGING_DIR_HOST)/bin/mkdapimg2 \
+               -i $@ -o $@.new \
+               -s $(DAP_SIGNATURE) \
+               -v $(VERSION_DIST)-$(firstword $(subst +, , \
+                       $(firstword $(subst -, ,$(REVISION))))) \
+               -r Default \
+               $(if $(1),-k $(1))
+       mv $@.new $@
+endef
+
+define Build/mkmylofw_16m
+       $(eval device_id=$(word 1,$(1)))
+       $(eval revision=$(word 2,$(1)))
+
+       # On WPJ344, WPJ531, and WPJ563, the default boot command tries 0x9f680000
+       # first and fails if the remains of the stock image are sill there
+       # - resulting in an infinite boot loop.
+       # The size parameter is grown to have that block deleted if the firmware
+       # isn't big enough by itself.
+
+       let \
+               size="$$(stat -c%s $@)" \
+               pad="$(subst k,* 1024,$(BLOCKSIZE))" \
+               pad="(pad - (size % pad)) % pad" \
+               newsize='size + pad' ; \
+               [ $$newsize -lt $$((0x660000)) ] && newsize=0x660000 ; \
+               $(STAGING_DIR_HOST)/bin/mkmylofw \
+                       -B WPE72 -i 0x11f6:$(device_id):0x11f6:$(device_id) -r $(revision) \
+                       -s 0x1000000 -p0x30000:$$newsize:al:0x80060000:"OpenWRT":$@ \
+                       $@.new
+               @mv $@.new $@
+endef
+
+define Build/mkwrggimg
+       $(STAGING_DIR_HOST)/bin/mkwrggimg -b \
+               -i $@ -o $@.imghdr -d /dev/mtdblock/1 \
+               -m $(DEVICE_MODEL)-$(DEVICE_VARIANT) -s $(DAP_SIGNATURE) \
+               -v $(VERSION_DIST) -B $(REVISION)
+       mv $@.imghdr $@
+endef
+
 define Build/nec-enc
   $(STAGING_DIR_HOST)/bin/nec-enc \
     -i $@ -o $@.new -k $(1)
@@ -72,6 +120,21 @@ define Build/pisen_wmb001n-factory
   rm -rf "$@.tmp"
 endef
 
+define Build/teltonika-fw-fake-checksum
+       # Teltonika U-Boot web based firmware upgrade/recovery routine compares
+       # 16 bytes from md5sum1[16] field in TP-Link v1 header (offset: 76 bytes
+       # from begin of the firmware file) with 16 bytes stored just before
+       # 0xdeadc0de marker. Values are only compared, MD5 sum is not verified.
+       let \
+               offs="$$(stat -c%s $@) - 20"; \
+               dd if=$@ bs=1 count=16 skip=76 |\
+               dd of=$@ bs=1 count=16 seek=$$offs conv=notrunc
+endef
+
+define Build/wrgg-pad-rootfs
+       $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@
+endef
+
 define Device/seama
   KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma
   KERNEL_INITRAMFS := $$(KERNEL) | seama
@@ -83,9 +146,9 @@ define Device/seama
   # - 36 bytes of META data (4-bytes aligned)
   IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs
   IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
+       append-metadata | check-size
   IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \
-       seama-seal | check-size $$$$(IMAGE_SIZE)
+       seama-seal | check-size
   SEAMA_SIGNATURE :=
 endef
 
@@ -100,6 +163,16 @@ define Device/8dev_carambola2
 endef
 TARGET_DEVICES += 8dev_carambola2
 
+define Device/8dev_lima
+  SOC := qca9531
+  DEVICE_VENDOR := 8devices
+  DEVICE_MODEL := Lima
+  DEVICE_PACKAGES := kmod-usb2
+  IMAGE_SIZE := 15616k
+  SUPPORTED_DEVICES += lima
+endef
+TARGET_DEVICES += 8dev_lima
+
 define Device/adtran_bsap1880
   SOC := ar7161
   DEVICE_VENDOR := Adtran/Bluesocket
@@ -111,7 +184,7 @@ define Device/adtran_bsap1880
   IMAGE/kernel.bin := append-kernel
   IMAGE/rootfs.bin := append-rootfs | pad-rootfs
   IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | \
-       check-size $$$$(IMAGE_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata
+       check-size | sysupgrade-tar rootfs=$$$$@ | append-metadata
 endef
 
 define Device/adtran_bsap1800-v2
@@ -142,39 +215,68 @@ define Device/aruba_ap-105
   DEVICE_VENDOR := Aruba
   DEVICE_MODEL := AP-105
   IMAGE_SIZE := 16000k
-  DEVICE_PACKAGES := kmod-i2c-core kmod-i2c-gpio kmod-tpm-i2c-atmel
+  DEVICE_PACKAGES := kmod-i2c-gpio kmod-tpm-i2c-atmel
 endef
 TARGET_DEVICES += aruba_ap-105
 
-define Device/avm_fritz300e
-  SOC := ar7242
+define Device/avm
   DEVICE_VENDOR := AVM
-  DEVICE_MODEL := FRITZ!WLAN Repeater 300E
   KERNEL := kernel-bin | append-dtb | lzma | eva-image
   KERNEL_INITRAMFS := $$(KERNEL)
-  IMAGE_SIZE := 15232k
   IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \
        append-squashfs-fakeroot-be | pad-to 256 | append-rootfs | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
-  DEVICE_PACKAGES := fritz-tffs rssileds -swconfig
+       append-metadata | check-size
+  DEVICE_PACKAGES := fritz-tffs
+endef
+
+define Device/avm_fritz1750e
+  $(Device/avm)
+  SOC := qca9556
+  IMAGE_SIZE := 15232k
+  DEVICE_MODEL := FRITZ!WLAN Repeater 1750E
+  DEVICE_PACKAGES += rssileds kmod-ath10k-ct-smallbuffers \
+       ath10k-firmware-qca988x-ct -swconfig
+endef
+TARGET_DEVICES += avm_fritz1750e
+
+define Device/avm_fritz300e
+  $(Device/avm)
+  SOC := ar7242
+  IMAGE_SIZE := 15232k
+  DEVICE_MODEL := FRITZ!WLAN Repeater 300E
+  DEVICE_PACKAGES += rssileds -swconfig
+  SUPPORTED_DEVICES += fritz300e
 endef
 TARGET_DEVICES += avm_fritz300e
 
 define Device/avm_fritz4020
+  $(Device/avm)
   SOC := qca9561
-  DEVICE_VENDOR := AVM
-  DEVICE_MODEL := FRITZ!Box 4020
   IMAGE_SIZE := 15232k
-  KERNEL := kernel-bin | append-dtb | lzma | eva-image
-  KERNEL_INITRAMFS := $$(KERNEL)
-  IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \
-       append-squashfs-fakeroot-be | pad-to 256 | append-rootfs | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
-  DEVICE_PACKAGES := fritz-tffs
+  DEVICE_MODEL := FRITZ!Box 4020
   SUPPORTED_DEVICES += fritz4020
 endef
 TARGET_DEVICES += avm_fritz4020
 
+define Device/avm_fritz450e
+  $(Device/avm)
+  SOC := qca9556
+  IMAGE_SIZE := 15232k
+  DEVICE_MODEL := FRITZ!WLAN Repeater 450E
+  SUPPORTED_DEVICES += fritz450e
+endef
+TARGET_DEVICES += avm_fritz450e
+
+define Device/avm_fritzdvbc
+  $(Device/avm)
+  SOC := qca9556
+  IMAGE_SIZE := 15232k
+  DEVICE_MODEL := FRITZ!WLAN Repeater DVB-C
+  DEVICE_PACKAGES += rssileds kmod-ath10k-ct-smallbuffers \
+       ath10k-firmware-qca988x-ct -swconfig
+endef
+TARGET_DEVICES += avm_fritzdvbc
+
 define Device/buffalo_bhr-4grv
   SOC := ar7242
   DEVICE_VENDOR := Buffalo
@@ -183,7 +285,7 @@ define Device/buffalo_bhr-4grv
   IMAGE_SIZE := 32256k
   IMAGES += factory.bin tftp.bin
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-       pad-rootfs | check-size $$$$(IMAGE_SIZE)
+       pad-rootfs | check-size
   IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc BHR-4GRV 1.99 | \
        buffalo-tag BHR-4GRV 3
   IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
@@ -206,7 +308,7 @@ define Device/buffalo_wzr-hp-ag300h
   IMAGE_SIZE := 32320k
   IMAGES += factory.bin tftp.bin
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-       pad-rootfs | check-size $$$$(IMAGE_SIZE)
+       pad-rootfs | check-size
   IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-AG300H 1.99 | \
        buffalo-tag WZR-HP-AG300H 3
   IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
@@ -225,7 +327,7 @@ define Device/buffalo_wzr-hp-g302h-a1a0
   IMAGE_SIZE := 32128k
   IMAGES += factory.bin tftp.bin
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-       pad-rootfs | check-size $$$$(IMAGE_SIZE)
+       pad-rootfs | check-size
   IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-G302H 1.99 | \
        buffalo-tag WZR-HP-G302H 4
   IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
@@ -241,7 +343,7 @@ define Device/buffalo_wzr-hp-g450h
   IMAGE_SIZE := 32256k
   IMAGES += factory.bin tftp.bin
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-       pad-rootfs | check-size $$$$(IMAGE_SIZE)
+       pad-rootfs | check-size
   IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-G450H 1.99 | \
        buffalo-tag WZR-HP-G450H 3
   IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header
@@ -269,6 +371,16 @@ define Device/comfast_cf-e120a-v3
 endef
 TARGET_DEVICES += comfast_cf-e120a-v3
 
+define Device/comfast_cf-e130n-v2
+  SOC := qca9531
+  DEVICE_VENDOR := COMFAST
+  DEVICE_MODEL := CF-E130N
+  DEVICE_VARIANT := v2
+  DEVICE_PACKAGES := rssileds kmod-leds-gpio -swconfig -uboot-envtools
+  IMAGE_SIZE := 7936k
+endef
+TARGET_DEVICES += comfast_cf-e130n-v2
+
 define Device/comfast_cf-e313ac
   SOC := qca9531
   DEVICE_VENDOR := COMFAST
@@ -299,6 +411,26 @@ define Device/comfast_cf-e5
 endef
 TARGET_DEVICES += comfast_cf-e5
 
+define Device/comfast_cf-e560ac
+  SOC := qca9531
+  DEVICE_VENDOR := COMFAST
+  DEVICE_MODEL := CF-E560AC
+  DEVICE_PACKAGES := kmod-leds-gpio kmod-usb2 kmod-ath10k-ct \
+       ath10k-firmware-qca9888-ct
+  IMAGE_SIZE := 16128k
+endef
+TARGET_DEVICES += comfast_cf-e560ac
+
+define Device/comfast_cf-ew72
+  SOC := qca9531
+  DEVICE_VENDOR := COMFAST
+  DEVICE_MODEL := CF-EW72
+  DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca9888-ct \
+       -uboot-envtools -swconfig
+  IMAGE_SIZE := 16192k
+endef
+TARGET_DEVICES += comfast_cf-ew72
+
 define Device/comfast_cf-wr650ac-v1
   SOC := qca9558
   DEVICE_VENDOR := COMFAST
@@ -319,6 +451,46 @@ define Device/comfast_cf-wr650ac-v2
 endef
 TARGET_DEVICES += comfast_cf-wr650ac-v2
 
+define Device/comfast_cf-wr752ac-v1
+  SOC := qca9531
+  DEVICE_VENDOR := COMFAST
+  DEVICE_MODEL := CF-WR752AC
+  DEVICE_VARIANT := v1
+  DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca9888-ct \
+       -uboot-envtools
+  IMAGE_SIZE := 16192k
+endef
+TARGET_DEVICES += comfast_cf-wr752ac-v1
+
+define Device/compex_wpj344-16m
+  SOC := ar9344
+  DEVICE_PACKAGES := kmod-usb2
+  IMAGE_SIZE := 16128k
+  DEVICE_VENDOR := Compex
+  DEVICE_MODEL := WPJ344
+  DEVICE_VARIANT := 16M
+  SUPPORTED_DEVICES += wpj344
+  IMAGES += cpximg-6a08.bin
+  IMAGE/cpximg-6a08.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | mkmylofw_16m 0x690 3
+endef
+TARGET_DEVICES += compex_wpj344-16m
+
+define Device/compex_wpj531-16m
+  SOC := qca9531
+  DEVICE_PACKAGES := kmod-usb2
+  IMAGE_SIZE := 16128k
+  DEVICE_VENDOR := Compex
+  DEVICE_MODEL := WPJ531
+  DEVICE_VARIANT := 16M
+  SUPPORTED_DEVICES += wpj531
+  IMAGES += cpximg-7a03.bin cpximg-7a04.bin cpximg-7a06.bin cpximg-7a07.bin
+  IMAGE/cpximg-7a03.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | mkmylofw_16m 0x68a 2
+  IMAGE/cpximg-7a04.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | mkmylofw_16m 0x693 3
+  IMAGE/cpximg-7a06.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | mkmylofw_16m 0x693 3
+  IMAGE/cpximg-7a07.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | mkmylofw_16m 0x693 3
+endef
+TARGET_DEVICES += compex_wpj531-16m
+
 define Device/devolo_dvl1200e
   SOC := qca9558
   DEVICE_VENDOR := devolo
@@ -373,6 +545,49 @@ define Device/devolo_dvl1750x
 endef
 TARGET_DEVICES += devolo_dvl1750x
 
+define Device/devolo_magic-2-wifi
+  SOC := ar9344
+  DEVICE_VENDOR := Devolo
+  DEVICE_MODEL := Magic 2 WiFi
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
+  IMAGE_SIZE := 15872k
+endef
+TARGET_DEVICES += devolo_magic-2-wifi
+
+define Device/dlink_dap-2695-a1
+  SOC := qca9558
+  DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct
+  DEVICE_VENDOR := D-Link
+  DEVICE_MODEL := DAP-2965
+  DEVICE_VARIANT := A1
+  IMAGES := factory.img sysupgrade.bin
+  IMAGE_SIZE := 15360k
+  IMAGE/default := append-kernel | pad-offset 65536 160
+  IMAGE/factory.img := $$(IMAGE/default) | append-rootfs | wrgg-pad-rootfs | \
+       mkwrggimg | check-size
+  IMAGE/sysupgrade.bin := $$(IMAGE/default) | mkwrggimg | append-rootfs | \
+       wrgg-pad-rootfs | append-metadata |  check-size
+  KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma
+  KERNEL_INITRAMFS := $$(KERNEL) | mkwrggimg
+  DAP_SIGNATURE := wapac02_dkbs_dap2695
+  SUPPORTED_DEVICES += dap-2695-a1
+endef
+TARGET_DEVICES += dlink_dap-2695-a1
+
+define Device/dlink_dch-g020-a1
+  SOC := qca9531
+  DEVICE_VENDOR := D-Link
+  DEVICE_MODEL := DCH-G020
+  DEVICE_VARIANT := A1
+  DEVICE_PACKAGES := kmod-gpio-pca953x kmod-i2c-gpio kmod-usb2 kmod-usb-acm
+  IMAGES += factory.bin
+  IMAGE_SIZE := 14784k
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+       append-rootfs | pad-rootfs | check-size | mkdapimg2 0x20000
+  DAP_SIGNATURE := HONEYBEE-FIRMWARE-DCH-G020
+endef
+TARGET_DEVICES += dlink_dch-g020-a1
+
 define Device/dlink_dir-505
   SOC := ar9330
   DEVICE_VENDOR := D-Link
@@ -390,7 +605,7 @@ define Device/dlink_dir-825-b1
   DEVICE_VARIANT := B1
   IMAGE_SIZE := 6208k
   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
+       append-metadata | check-size
   DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \
        kmod-leds-reset kmod-owl-loader
   SUPPORTED_DEVICES += dir-825-b1
@@ -410,9 +625,9 @@ define Device/dlink_dir-825-c1
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
        pad-rootfs
   IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \
-       append-string 00DB120AR9344-RT-101214-00 | check-size $$$$(IMAGE_SIZE)
+       append-string 00DB120AR9344-RT-101214-00 | check-size
   IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \
-       check-size $$$$(IMAGE_SIZE)
+       check-size
 endef
 TARGET_DEVICES += dlink_dir-825-c1
 
@@ -428,9 +643,9 @@ define Device/dlink_dir-835-a1
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
        pad-rootfs
   IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \
-       append-string 00DB120AR9344-RT-101214-00 | check-size $$$$(IMAGE_SIZE)
+       append-string 00DB120AR9344-RT-101214-00 | check-size
   IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \
-       check-size $$$$(IMAGE_SIZE)
+       check-size
 endef
 TARGET_DEVICES += dlink_dir-835-a1
 
@@ -449,9 +664,9 @@ define Device/dlink_dir-842-c
   IMAGE/default := append-kernel | uImage lzma | \
        pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs
   IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
+       append-metadata | check-size
   IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \
-       seama-seal | check-size $$$$(IMAGE_SIZE)
+       seama-seal | check-size
   IMAGE_SIZE := 15680k
 endef
 
@@ -485,7 +700,6 @@ define Device/dlink_dir-859-a1
   IMAGE_SIZE := 15872k
   DEVICE_PACKAGES :=  kmod-usb2 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
   SEAMA_SIGNATURE := wrgac37_dlink.2013gui_dir859
-  SUPPORTED_DEVICES += dir-859-a1
 endef
 TARGET_DEVICES += dlink_dir-859-a1
 
@@ -526,10 +740,10 @@ define Device/engenius_ecb1750
   DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
   IMAGE_SIZE := 15680k
   IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
-       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
        senao-header -r 0x101 -p 0x6d -t 2
   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
+       append-metadata | check-size
 endef
 TARGET_DEVICES += engenius_ecb1750
 
@@ -541,7 +755,7 @@ define Device/engenius_epg5000
   IMAGE_SIZE := 14656k
   IMAGES += factory.dlf
   IMAGE/factory.dlf := append-kernel | pad-to $$$$(BLOCKSIZE) | \
-       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
        senao-header -r 0x101 -p 0x71 -t 2
   SUPPORTED_DEVICES += epg5000
 endef
@@ -556,6 +770,14 @@ define Device/engenius_ews511ap
 endef
 TARGET_DEVICES += engenius_ews511ap
 
+define Device/enterasys_ws-ap3705i
+  SOC := ar9344
+  DEVICE_VENDOR := Enterasys
+  DEVICE_MODEL := WS-AP3705i
+  IMAGE_SIZE := 30528k
+endef
+TARGET_DEVICES += enterasys_ws-ap3705i
+
 define Device/etactica_eg200
   SOC := ar9331
   DEVICE_VENDOR := eTactica
@@ -567,6 +789,32 @@ define Device/etactica_eg200
 endef
 TARGET_DEVICES += etactica_eg200
 
+define Device/glinet_6408
+  $(Device/tplink-8mlzma)
+  SOC := ar9331
+  DEVICE_VENDOR := GL.iNet
+  DEVICE_MODEL := 6408
+  DEVICE_PACKAGES := kmod-usb2
+  IMAGE_SIZE := 8000k
+  TPLINK_HWID := 0x08000001
+  IMAGES := sysupgrade.bin
+  SUPPORTED_DEVICES += gl-inet
+endef
+TARGET_DEVICES += glinet_6408
+
+define Device/glinet_6416
+  $(Device/tplink-16mlzma)
+  SOC := ar9331
+  DEVICE_VENDOR := GL.iNet
+  DEVICE_MODEL := 6416
+  DEVICE_PACKAGES := kmod-usb2
+  IMAGE_SIZE := 16192k
+  TPLINK_HWID := 0x08000001
+  IMAGES := sysupgrade.bin
+  SUPPORTED_DEVICES += gl-inet
+endef
+TARGET_DEVICES += glinet_6416
+
 define Device/glinet_gl-ar150
   SOC := ar9330
   DEVICE_VENDOR := GL.iNet
@@ -608,6 +856,16 @@ define Device/glinet_gl-ar750
 endef
 TARGET_DEVICES += glinet_gl-ar750
 
+define Device/glinet_gl-mifi
+  SOC := ar9331
+  DEVICE_VENDOR := GL.iNET
+  DEVICE_MODEL := GL-MiFi
+  DEVICE_PACKAGES := kmod-usb-chipidea2
+  IMAGE_SIZE := 16000k
+  SUPPORTED_DEVICES += gl-mifi
+endef
+TARGET_DEVICES += glinet_gl-mifi
+
 define Device/glinet_gl-x750
   SOC := qca9531
   DEVICE_VENDOR := GL.iNet
@@ -633,7 +891,7 @@ define Device/iodata_wn-ac1167dgr
   IMAGE_SIZE := 14656k
   IMAGES += factory.bin
   IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
-       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
        senao-header -r 0x30a -p 0x61 -t 2
   DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
 endef
@@ -646,7 +904,7 @@ define Device/iodata_wn-ac1600dgr
   IMAGE_SIZE := 14656k
   IMAGES += factory.bin
   IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
-       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
        senao-header -r 0x30a -p 0x60 -t 2 -v 200
   DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
 endef
@@ -659,7 +917,7 @@ define Device/iodata_wn-ac1600dgr2
   IMAGE_SIZE := 14656k
   IMAGES += dgr2-dgr3-factory.bin
   IMAGE/dgr2-dgr3-factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
-       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
        senao-header -r 0x30a -p 0x60 -t 2 -v 200
   DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
 endef
@@ -672,7 +930,7 @@ define Device/iodata_wn-ag300dgr
   IMAGE_SIZE := 15424k
   IMAGES += factory.bin
   IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
-       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
        senao-header -r 0x30a -p 0x47 -t 2
   DEVICE_PACKAGES := kmod-usb2
 endef
@@ -713,9 +971,9 @@ define Device/nec_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)
+       append-metadata | check-size
   IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \
-       seama-seal | nec-enc 9gsiy9nzep452pad | check-size $$$$(IMAGE_SIZE)
+       seama-seal | nec-enc 9gsiy9nzep452pad | check-size
   DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
 endef
 TARGET_DEVICES += nec_wg1200cr
@@ -727,9 +985,9 @@ define Device/nec_wg800hp
   IMAGE_SIZE := 7104k
   IMAGES += factory.bin
   IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
-       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
        xor-image -p 6A57190601121E4C004C1E1201061957 -x | nec-fw LASER_ATERM
-  DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9887-ct-htt
+  DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9887-ct-full-htt
 endef
 TARGET_DEVICES += nec_wg800hp
 
@@ -775,12 +1033,12 @@ define Device/netgear_wndr3700
   IMAGE_SIZE := 7680k
   IMAGES += factory-NA.img
   IMAGE/factory-NA.img := $$(IMAGE/default) | netgear-dni NA | \
-       check-size $$$$(IMAGE_SIZE)
+       check-size
   SUPPORTED_DEVICES += wndr3700
 endef
 TARGET_DEVICES += netgear_wndr3700
 
-define Device/netgear_wndr3700v2
+define Device/netgear_wndr3700-v2
   $(Device/netgear_wndr3x00)
   DEVICE_MODEL := WNDR3700
   DEVICE_VARIANT := v2
@@ -788,9 +1046,9 @@ define Device/netgear_wndr3700v2
   NETGEAR_BOARD_ID := WNDR3700v2
   NETGEAR_HW_ID := 29763654+16+64
   IMAGE_SIZE := 15872k
-  SUPPORTED_DEVICES += wndr3700
+  SUPPORTED_DEVICES += wndr3700 netgear,wndr3700v2
 endef
-TARGET_DEVICES += netgear_wndr3700v2
+TARGET_DEVICES += netgear_wndr3700-v2
 
 define Device/netgear_wndr3800
   $(Device/netgear_wndr3x00)
@@ -814,6 +1072,30 @@ define Device/netgear_wndr3800ch
 endef
 TARGET_DEVICES += netgear_wndr3800ch
 
+define Device/netgear_wndrmac-v1
+  $(Device/netgear_wndr3x00)
+  DEVICE_MODEL := WNDRMAC
+  DEVICE_VARIANT := v1
+  NETGEAR_KERNEL_MAGIC := 0x33373031
+  NETGEAR_BOARD_ID := WNDRMAC
+  NETGEAR_HW_ID := 29763654+16+64
+  IMAGE_SIZE := 15872k
+  SUPPORTED_DEVICES += wndr3700
+endef
+TARGET_DEVICES += netgear_wndrmac-v1
+
+define Device/netgear_wndrmac-v2
+  $(Device/netgear_wndr3x00)
+  DEVICE_MODEL := WNDRMAC
+  DEVICE_VARIANT := v2
+  NETGEAR_KERNEL_MAGIC := 0x33373031
+  NETGEAR_BOARD_ID := WNDRMACv2
+  NETGEAR_HW_ID := 29763654+16+128
+  IMAGE_SIZE := 15872k
+  SUPPORTED_DEVICES += wndr3700
+endef
+TARGET_DEVICES += netgear_wndrmac-v2
+
 define Device/netgear_wnr2200_common
   SOC := ar7241
   DEVICE_MODEL := WNR2200
@@ -832,7 +1114,7 @@ define Device/netgear_wnr2200-8m
   IMAGE_SIZE := 7808k
   IMAGES += factory-NA.img
   IMAGE/factory-NA.img := $$(IMAGE/default) | netgear-dni NA | \
-       check-size $$$$(IMAGE_SIZE)
+       check-size
   SUPPORTED_DEVICES += wnr2200
 endef
 TARGET_DEVICES += netgear_wnr2200-8m
@@ -856,7 +1138,7 @@ define Device/ocedo_koala
   SUPPORTED_DEVICES += koala
   IMAGE_SIZE := 7424k
   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
+       append-metadata | check-size
 endef
 TARGET_DEVICES += ocedo_koala
 
@@ -866,7 +1148,7 @@ define Device/ocedo_raccoon
   DEVICE_MODEL := Raccoon
   IMAGE_SIZE := 7424k
   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
+       append-metadata | check-size
 endef
 TARGET_DEVICES += ocedo_raccoon
 
@@ -877,7 +1159,7 @@ define Device/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)
+       append-metadata | check-size
 endef
 TARGET_DEVICES += ocedo_ursus
 
@@ -926,7 +1208,7 @@ define Device/phicomm_k2t
   DEVICE_MODEL := K2T
   IMAGE_SIZE := 15744k
   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \
-       append-metadata | check-size $$$$(IMAGE_SIZE)
+       append-metadata | check-size
   DEVICE_PACKAGES := kmod-leds-reset kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9888-ct
 endef
 TARGET_DEVICES += phicomm_k2t
@@ -946,7 +1228,7 @@ define Device/pisen_wmb001n
   DEVICE_VENDOR := PISEN
   DEVICE_MODEL := WMB001N
   IMAGE_SIZE := 14080k
-  DEVICE_PACKAGES := kmod-i2c-core kmod-i2c-gpio kmod-usb2
+  DEVICE_PACKAGES := kmod-i2c-gpio kmod-usb2
   LOADER_TYPE := bin
   LOADER_FLASH_OFFS := 0x20000
   COMPILE := loader-$(1).bin loader-$(1).uImage
@@ -991,6 +1273,21 @@ define Device/rosinson_wr818
 endef
 TARGET_DEVICES += rosinson_wr818
 
+define Device/siemens_ws-ap3610
+  SOC := ar7161
+  DEVICE_VENDOR := Siemens
+  DEVICE_MODEL := WS-AP3610
+  IMAGE_SIZE := 14336k
+  BLOCKSIZE := 256k
+  LOADER_TYPE := bin
+  LOADER_FLASH_OFFS := 0x82000
+  COMPILE := loader-$(1).bin
+  COMPILE/loader-$(1).bin := loader-okli-compile
+  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) 8128 | uImage none
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
+endef
+TARGET_DEVICES += siemens_ws-ap3610
+
 define Device/sitecom_wlr-7100
   SOC := ar1022
   DEVICE_VENDOR := Sitecom
@@ -999,12 +1296,56 @@ define Device/sitecom_wlr-7100
   DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct-smallbuffers kmod-usb2
   IMAGES += factory.dlf
   IMAGE/factory.dlf := append-kernel | pad-to $$$$(BLOCKSIZE) | \
-       append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
        senao-header -r 0x222 -p 0x53 -t 2
   IMAGE_SIZE := 7488k
 endef
 TARGET_DEVICES += sitecom_wlr-7100
 
+define Device/sitecom_wlr-8100
+  SOC := qca9558
+  DEVICE_VENDOR := Sitecom
+  DEVICE_MODEL := WLR-8100
+  DEVICE_ALT0_VENDOR := Sitecom
+  DEVICE_ALT0_MODEL := X8 AC1750
+  DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct kmod-usb2 kmod-usb3
+  SUPPORTED_DEVICES += wlr8100
+  IMAGES += factory.dlf
+  IMAGE/factory.dlf := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+       append-rootfs | pad-rootfs | check-size | \
+       senao-header -r 0x222 -p 0x56 -t 2
+  IMAGE_SIZE := 15424k
+endef
+TARGET_DEVICES += sitecom_wlr-8100
+
+define Device/teltonika_rut955
+  SOC := ar9344
+  DEVICE_VENDOR := Teltonika
+  DEVICE_MODEL := RUT955
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-acm kmod-usb-net-qmi-wwan \
+       kmod-usb-serial-option kmod-hwmon-mcp3021 uqmi -uboot-envtools
+  IMAGE_SIZE := 15552k
+  TPLINK_HWID := 0x35000001
+  TPLINK_HWREV := 0x1
+  TPLINK_HEADER_VERSION := 1
+  KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
+  IMAGES += factory.bin
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs |\
+       pad-rootfs | teltonika-fw-fake-checksum | append-string master |\
+       append-md5sum-bin | check-size
+  IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\
+       append-rootfs | pad-rootfs | append-metadata |\
+       check-size
+endef
+TARGET_DEVICES += teltonika_rut955
+
+define Device/teltonika_rut955-h7v3c0
+  $(Device/teltonika_rut955)
+  DEVICE_VARIANT := H7V3C0
+endef
+TARGET_DEVICES += teltonika_rut955-h7v3c0
+
 define Device/trendnet_tew-823dru
   SOC := qca9558
   DEVICE_VENDOR := Trendnet
@@ -1017,9 +1358,9 @@ define Device/trendnet_tew-823dru
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
        pad-rootfs
   IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \
-       append-string 00AP135AR9558-RT-131129-00 | check-size $$$$(IMAGE_SIZE)
+       append-string 00AP135AR9558-RT-131129-00 | check-size
   IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \
-       check-size $$$$(IMAGE_SIZE)
+       check-size
 endef
 TARGET_DEVICES += trendnet_tew-823dru
 
@@ -1054,7 +1395,7 @@ define Device/winchannel_wb2000
   DEVICE_VENDOR := Winchannel
   DEVICE_MODEL := WB2000
   IMAGE_SIZE := 15872k
-  DEVICE_PACKAGES := kmod-i2c-core kmod-i2c-gpio kmod-rtc-ds1307 kmod-usb2 \
+  DEVICE_PACKAGES := kmod-i2c-gpio kmod-rtc-ds1307 kmod-usb2 \
        kmod-usb-ledtrig-usbport
 endef
 TARGET_DEVICES += winchannel_wb2000
@@ -1105,7 +1446,7 @@ define Device/zbtlink_zbt-wd323
   DEVICE_VENDOR := ZBT
   DEVICE_MODEL := WD323
   IMAGE_SIZE := 16000k
-  DEVICE_PACKAGES := kmod-usb2 kmod-i2c-core kmod-i2c-gpio kmod-rtc-pcf8563 \
+  DEVICE_PACKAGES := kmod-usb2 kmod-i2c-gpio kmod-rtc-pcf8563 \
        kmod-usb-serial kmod-usb-serial-cp210x uqmi
 endef
 TARGET_DEVICES += zbtlink_zbt-wd323