ath79: add support for Teltonika RUT955
[openwrt/staging/mkresin.git] / target / linux / ath79 / image / generic.mk
index 800e1c7a7df9a0f10aa2c9f3ffec96c400b133fa..3c0aa2ee4d6869ae8641654db1d905b6934da64a 100644 (file)
@@ -1,4 +1,5 @@
 include ./common-buffalo.mk
+include ./common-mikrotik.mk
 include ./common-netgear.mk
 include ./common-tp-link.mk
 include ./common-yuncore.mk
@@ -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 \
@@ -72,6 +78,17 @@ 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 Device/seama
   KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma
   KERNEL_INITRAMFS := $$(KERNEL) | seama
@@ -157,6 +174,7 @@ define Device/avm_fritz300e
        append-squashfs-fakeroot-be | pad-to 256 | append-rootfs | pad-rootfs | \
        append-metadata | check-size $$$$(IMAGE_SIZE)
   DEVICE_PACKAGES := fritz-tffs rssileds -swconfig
+  SUPPORTED_DEVICES += fritz300e
 endef
 TARGET_DEVICES += avm_fritz300e
 
@@ -299,6 +317,16 @@ 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-wr650ac-v1
   SOC := qca9558
   DEVICE_VENDOR := COMFAST
@@ -485,7 +513,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
 
@@ -567,6 +594,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
@@ -703,6 +756,19 @@ define Device/librerouter_librerouter-v1
 endef
 TARGET_DEVICES += librerouter_librerouter-v1
 
+define Device/mikrotik_routerboard-wap-g-5hact2hnd
+  $(Device/mikrotik)
+  SOC := qca9556
+  DEVICE_MODEL := RouterBOARD wAP G-5HacT2HnD (wAP AC)
+  IMAGE_SIZE := 16256k
+  IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 -e | \
+       pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
+       append-metadata | check-size $$$$(IMAGE_SIZE)
+  DEVICE_PACKAGES += kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
+  SUPPORTED_DEVICES += rb-wapg-5hact2hnd
+endef
+TARGET_DEVICES += mikrotik_routerboard-wap-g-5hact2hnd
+
 define Device/nec_wg1200cr
   SOC := qca9563
   DEVICE_VENDOR := NEC
@@ -780,7 +846,7 @@ define Device/netgear_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 +854,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)
@@ -991,6 +1057,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
@@ -1005,6 +1086,28 @@ define Device/sitecom_wlr-7100
 endef
 TARGET_DEVICES += sitecom_wlr-7100
 
+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_SIZE)
+  IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\
+       append-rootfs | pad-rootfs | append-metadata |\
+       check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += teltonika_rut955
+
 define Device/trendnet_tew-823dru
   SOC := qca9558
   DEVICE_VENDOR := Trendnet