ramips: collect and harmonize TP-Link image variants in common file

This moves the various variants of common device definitions for
TP-Link devices to a common Makefile common-tp-link.mk. This
provides the opportunity to reorganize and move parameters between
individual device definitions and the common ones.

While at it, also use the common definitions for previously
independent definitions where appropriate.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2020-01-29 18:21:53 +01:00
parent ffbb8ed5a2
commit 3227afbbab
4 changed files with 100 additions and 114 deletions

View File

@ -0,0 +1,44 @@
DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD
DEVICE_VARS += TPLINK_HVERSION TPLINK_BOARD_ID TPLINK_HEADER_VERSION
define Device/tplink-v1
DEVICE_VENDOR := TP-Link
TPLINK_FLASHLAYOUT :=
TPLINK_HWID :=
TPLINK_HWREV := 0x1
TPLINK_HEADER_VERSION := 1
KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v1-header -e -O
IMAGES += factory.bin
IMAGE/factory.bin := tplink-v1-image factory -e -O
IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade -e -O | append-metadata | \
check-size $$$$(IMAGE_SIZE)
endef
define Device/tplink-v2
DEVICE_VENDOR := TP-Link
TPLINK_FLASHLAYOUT :=
TPLINK_HWID :=
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x0
TPLINK_HVERSION := 3
KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header -e
IMAGES += factory.bin
IMAGE/factory.bin := tplink-v2-image -e
IMAGE/sysupgrade.bin := tplink-v2-image -s -e | append-metadata | \
check-size $$$$(IMAGE_SIZE)
endef
define Device/tplink-safeloader
DEVICE_VENDOR := TP-Link
TPLINK_BOARD_ID :=
TPLINK_HWID := 0x0
TPLINK_HWREV := 0x0
TPLINK_HEADER_VERSION := 1
KERNEL := $(KERNEL_DTB) | tplink-v1-header -e -O
IMAGES += factory.bin
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
endef

View File

@ -2,8 +2,9 @@
# MT7620A Profiles
#
DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD TPLINK_HVERSION \
DLINK_ROM_ID DLINK_FAMILY_MEMBER DLINK_FIRMWARE_SIZE DLINK_IMAGE_OFFSET
include ./common-tp-link.mk
DEVICE_VARS += DLINK_ROM_ID DLINK_FAMILY_MEMBER DLINK_FIRMWARE_SIZE DLINK_IMAGE_OFFSET
define Build/elecom-header
cp $@ $(KDIR)/v_0.0.0.bin
@ -64,17 +65,6 @@ define Device/amit_jboot
DEVICE_PACKAGES := jboot-tools kmod-usb2 kmod-usb-ohci
endef
define Device/Archer
SOC := mt7620a
DEVICE_VENDOR := TP-Link
TPLINK_HWREVADD := 0
TPLINK_HVERSION := 3
KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header -e
IMAGE/factory.bin := tplink-v2-image -e
IMAGE/sysupgrade.bin := tplink-v2-image -s -e | append-metadata
endef
define Device/asus_rp-n53
SOC := mt7620a
IMAGE_SIZE := 7872k
@ -865,12 +855,12 @@ endef
TARGET_DEVICES += sercomm_na930
define Device/tplink_archer-c20i
$(Device/Archer)
$(Device/tplink-v2)
SOC := mt7620a
IMAGE_SIZE := 7808k
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc2000001
TPLINK_HWREV := 58
IMAGES += factory.bin
DEVICE_MODEL := Archer C20i
DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci
SUPPORTED_DEVICES += c20i
@ -878,14 +868,14 @@ endef
TARGET_DEVICES += tplink_archer-c20i
define Device/tplink_archer-c20-v1
$(Device/Archer)
$(Device/tplink-v2)
SOC := mt7620a
IMAGE_SIZE := 7808k
SUPPORTED_DEVICES += tplink,c20-v1
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc2000001
TPLINK_HWREV := 0x44
TPLINK_HWREVADD := 0x1
IMAGES += factory.bin
DEVICE_MODEL := Archer C20
DEVICE_VARIANT := v1
DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci \
@ -894,13 +884,13 @@ endef
TARGET_DEVICES += tplink_archer-c20-v1
define Device/tplink_archer-c2-v1
$(Device/Archer)
$(Device/tplink-v2)
SOC := mt7620a
IMAGE_SIZE := 7808k
SUPPORTED_DEVICES += tplink,c2-v1
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc7500001
TPLINK_HWREV := 50
IMAGES += factory.bin
DEVICE_MODEL := Archer C2
DEVICE_VARIANT := v1
DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci \
@ -909,12 +899,13 @@ endef
TARGET_DEVICES += tplink_archer-c2-v1
define Device/tplink_archer-c50-v1
$(Device/Archer)
$(Device/tplink-v2)
SOC := mt7620a
IMAGE_SIZE := 7808k
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc7500001
TPLINK_HWREV := 69
IMAGES += factory-us.bin factory-eu.bin
IMAGES := sysupgrade.bin factory-us.bin factory-eu.bin
IMAGE/factory-us.bin := tplink-v2-image -e -w 0
IMAGE/factory-eu.bin := tplink-v2-image -e -w 2
DEVICE_MODEL := Archer C50
@ -925,11 +916,13 @@ endef
TARGET_DEVICES += tplink_archer-c50-v1
define Device/tplink_archer-mr200
$(Device/Archer)
$(Device/tplink-v2)
SOC := mt7620a
IMAGE_SIZE := 7872k
TPLINK_FLASHLAYOUT := 8MLmtk
TPLINK_HWID := 0xd7500001
TPLINK_HWREV := 0x4a
IMAGES := sysupgrade.bin
DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-net kmod-usb-net-rndis \
kmod-usb-serial kmod-usb-serial-option adb-enablemodem
DEVICE_MODEL := Archer MR200
@ -938,20 +931,13 @@ endef
TARGET_DEVICES += tplink_archer-mr200
define Device/tplink_re200-v1
$(Device/tplink-v1)
SOC := mt7620a
DEVICE_VENDOR := TP-Link
DEVICE_MODEL := RE200
DEVICE_VARIANT := v1
DEVICE_PACKAGES := kmod-mt76x0e
IMAGES += factory.bin
IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade -e -O | append-metadata
IMAGE/factory.bin := tplink-v1-image factory -e -O
IMAGE_SIZE := 7936k
KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v1-header -e -O
TPLINK_HWID := 0x02000001
TPLINK_HWREV := 0x1
TPLINK_HEADER_VERSION := 1
TPLINK_FLASHLAYOUT := 8Mmtk
endef
TARGET_DEVICES += tplink_re200-v1

View File

@ -2,10 +2,11 @@
# MT7621 Profiles
#
include ./common-tp-link.mk
DEFAULT_SOC := mt7621
KERNEL_DTB += -d21
DEVICE_VARS += TPLINK_BOARD_ID TPLINK_HEADER_VERSION TPLINK_HWID TPLINK_HWREV
define Build/elecom-gst-factory
$(eval product=$(word 1,$(1)))
@ -662,19 +663,6 @@ define Device/adslr_g7
endef
TARGET_DEVICES += adslr_g7
define Device/tplink-safeloader
DEVICE_VENDOR := TP-Link
TPLINK_BOARD_ID :=
TPLINK_HWID := 0x0
TPLINK_HWREV := 0
TPLINK_HEADER_VERSION := 1
KERNEL := $(KERNEL_DTB) | tplink-v1-header -e -O
IMAGES += factory.bin
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
endef
define Device/tplink_re350-v1
$(Device/tplink-safeloader)
DEVICE_MODEL := RE350

View File

@ -2,6 +2,8 @@
# MT76x8 Profiles
#
include ./common-tp-link.mk
DEFAULT_SOC := mt7628an
define Device/alfa-network_awusfree1
@ -235,69 +237,36 @@ define Device/totolink_lr1200
endef
TARGET_DEVICES += totolink_lr1200
define Device/tplink
DEVICE_VENDOR := TP-Link
TPLINK_FLASHLAYOUT :=
TPLINK_HWID :=
TPLINK_HWREV :=
TPLINK_HWREVADD :=
TPLINK_HVERSION :=
KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header -e
IMAGES += tftp-recovery.bin
IMAGE/factory.bin := tplink-v2-image -e
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
IMAGE/sysupgrade.bin := tplink-v2-image -s -e | append-metadata | \
check-size $$$$(IMAGE_SIZE)
endef
DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD
DEVICE_VARS += TPLINK_HVERSION
define Device/tplink-safeloader
DEVICE_VENDOR := TP-Link
TPLINK_BOARD_ID :=
TPLINK_HWID := 0x0
TPLINK_HWREV := 0
TPLINK_HEADER_VERSION := 1
KERNEL := $(KERNEL_DTB) | tplink-v1-header -e -O
IMAGES += factory.bin
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
endef
define Device/tplink_archer-c20-v4
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := Archer C20
DEVICE_VARIANT := v4
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc200004
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x4
TPLINK_HVERSION := 3
DEVICE_PACKAGES := kmod-mt76x0e
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
SUPPORTED_DEVICES += tplink,c20-v4
endef
TARGET_DEVICES += tplink_archer-c20-v4
define Device/tplink_archer-c20-v5
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7616k
DEVICE_MODEL := Archer C20
DEVICE_VARIANT := v5
TPLINK_FLASHLAYOUT := 8MSUmtk
TPLINK_HWID := 0xc200005
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x5
TPLINK_HVERSION := 3
DEVICE_PACKAGES := kmod-mt76x0e
IMAGES := sysupgrade.bin
endef
TARGET_DEVICES += tplink_archer-c20-v5
define Device/tplink_archer-c50-v3
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := Archer C50
DEVICE_VARIANT := v3
@ -305,14 +274,15 @@ define Device/tplink_archer-c50-v3
TPLINK_HWID := 0x001D9BA4
TPLINK_HWREV := 0x79
TPLINK_HWREVADD := 0x1
TPLINK_HVERSION := 3
DEVICE_PACKAGES := kmod-mt76x2
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
SUPPORTED_DEVICES += tplink,c50-v3
endef
TARGET_DEVICES += tplink_archer-c50-v3
define Device/tplink_archer-c50-v4
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7616k
DEVICE_MODEL := Archer C50
DEVICE_VARIANT := v4
@ -320,7 +290,6 @@ define Device/tplink_archer-c50-v4
TPLINK_HWID := 0x001D589B
TPLINK_HWREV := 0x93
TPLINK_HWREVADD := 0x2
TPLINK_HVERSION := 3
DEVICE_PACKAGES := kmod-mt76x2
IMAGES := sysupgrade.bin
SUPPORTED_DEVICES += tplink,c50-v4
@ -338,7 +307,7 @@ endef
TARGET_DEVICES += tplink_re305-v1
define Device/tplink_tl-mr3020-v3
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := TL-MR3020
DEVICE_VARIANT := v3
@ -346,13 +315,14 @@ define Device/tplink_tl-mr3020-v3
TPLINK_HWID := 0x30200003
TPLINK_HWREV := 0x3
TPLINK_HWREVADD := 0x3
TPLINK_HVERSION := 3
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
endef
TARGET_DEVICES += tplink_tl-mr3020-v3
define Device/tplink_tl-mr3420-v5
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := TL-MR3420
DEVICE_VARIANT := v5
@ -360,71 +330,67 @@ define Device/tplink_tl-mr3420-v5
TPLINK_HWID := 0x34200005
TPLINK_HWREV := 0x5
TPLINK_HWREVADD := 0x5
TPLINK_HVERSION := 3
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
endef
TARGET_DEVICES += tplink_tl-mr3420-v5
define Device/tplink_tl-wa801nd-v5
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := TL-WA801ND
DEVICE_VARIANT := v5
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0x08010005
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x5
TPLINK_HVERSION := 3
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
endef
TARGET_DEVICES += tplink_tl-wa801nd-v5
define Device/tplink_tl-wr802n-v4
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := TL-WR802N
DEVICE_VARIANT := v4
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0x08020004
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x4
TPLINK_HVERSION := 3
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
endef
TARGET_DEVICES += tplink_tl-wr802n-v4
define Device/tplink_tl-wr840n-v4
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := TL-WR840N
DEVICE_VARIANT := v4
TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0x08400004
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x4
TPLINK_HVERSION := 3
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
SUPPORTED_DEVICES += tl-wr840n-v4
endef
TARGET_DEVICES += tplink_tl-wr840n-v4
define Device/tplink_tl-wr840n-v5
$(Device/tplink-v2)
IMAGE_SIZE := 3904k
DEVICE_VENDOR := TP-Link
DEVICE_MODEL := TL-WR840N
DEVICE_VARIANT := v5
TPLINK_FLASHLAYOUT := 4Mmtk
TPLINK_HWID := 0x08400005
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x5
TPLINK_HVERSION := 3
KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header -e
IMAGE/sysupgrade.bin := tplink-v2-image -s -e | append-metadata | \
check-size $$$$(IMAGE_SIZE)
IMAGES := sysupgrade.bin
SUPPORTED_DEVICES += tl-wr840n-v5
endef
TARGET_DEVICES += tplink_tl-wr840n-v5
define Device/tplink_tl-wr841n-v13
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := TL-WR841N
DEVICE_VARIANT := v13
@ -432,27 +398,27 @@ define Device/tplink_tl-wr841n-v13
TPLINK_HWID := 0x08410013
TPLINK_HWREV := 0x268
TPLINK_HWREVADD := 0x13
TPLINK_HVERSION := 3
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
SUPPORTED_DEVICES += tl-wr841n-v13
endef
TARGET_DEVICES += tplink_tl-wr841n-v13
define Device/tplink_tl-wr841n-v14
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 3968k
DEVICE_MODEL := TL-WR841N
DEVICE_VARIANT := v14
TPLINK_FLASHLAYOUT := 4Mmtk
TPLINK_HWID := 0x08410014
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x14
TPLINK_HVERSION := 3
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 64k | $$(IMAGE/factory.bin)
endef
TARGET_DEVICES += tplink_tl-wr841n-v14
define Device/tplink_tl-wr842n-v5
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := TL-WR842N
DEVICE_VARIANT := v5
@ -460,13 +426,14 @@ define Device/tplink_tl-wr842n-v5
TPLINK_HWID := 0x08420005
TPLINK_HWREV := 0x5
TPLINK_HWREVADD := 0x5
TPLINK_HVERSION := 3
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
endef
TARGET_DEVICES += tplink_tl-wr842n-v5
define Device/tplink_tl-wr902ac-v3
$(Device/tplink)
$(Device/tplink-v2)
IMAGE_SIZE := 7808k
DEVICE_MODEL := TL-WR902AC
DEVICE_VARIANT := v3
@ -474,9 +441,10 @@ define Device/tplink_tl-wr902ac-v3
TPLINK_HWID := 0x000dc88f
TPLINK_HWREV := 0x89
TPLINK_HWREVADD := 0x1
TPLINK_HVERSION := 3
DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci \
kmod-usb-ledtrig-usbport
IMAGES := sysupgrade.bin tftp-recovery.bin
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
endef
TARGET_DEVICES += tplink_tl-wr902ac-v3