build: add mktplinkfw2 hardcoded values to makefile

This patch adds all the board-specific values currently hardcoded
in mktplinkfw2.c back to the respective device declarations in the
makefiles.

The rationale is to avoid modifying the source code every time a
new board or board variant is added.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit is contained in:
Thibaut VARÈNE 2017-10-03 12:46:09 +02:00 committed by Mathias Kresin
parent 90805b16b6
commit 254061ee97
4 changed files with 52 additions and 21 deletions

View file

@ -249,14 +249,19 @@ endef
define Build/tplink-v2-header define Build/tplink-v2-header
$(STAGING_DIR_HOST)/bin/mktplinkfw2 \ $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
-c -V "ver. 2.0" -B $(TPLINK_BOARD_ID) $(1) -k $@ -o $@.new -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) \
-w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
-T $(TPLINK_HVERSION) -V "ver. 2.0" \
-k $@ -o $@.new $(1)
@mv $@.new $@ @mv $@.new $@
endef endef
define Build/tplink-v2-image define Build/tplink-v2-image
$(STAGING_DIR_HOST)/bin/mktplinkfw2 \ $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
-a 0x4 -j -V "ver. 2.0" -B $(TPLINK_BOARD_ID) $(1) \ -H $(TPLINK_HWID) -W $(TPLINK_HWREV) \
-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new -w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
-T $(TPLINK_HVERSION) -V "ver. 2.0" -a 0x4 -j \
-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new $(1)
cat $@.new >> $@ cat $@.new >> $@
rm -rf $@.new rm -rf $@.new
endef endef

View file

@ -1,6 +1,8 @@
DEVICE_VARS += TPLINK_BOARD_ID DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD TPLINK_HVERSION
define Device/lantiqTpLink define Device/lantiqTpLink
TPLINK_HWREVADD := 0
TPLINK_HVERSION := 2
KERNEL := kernel-bin | append-dtb | lzma KERNEL := kernel-bin | append-dtb | lzma
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | \ KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | \
tplink-v2-header -s -V "ver. 1.0" tplink-v2-header -s -V "ver. 1.0"
@ -12,7 +14,9 @@ endef
define Device/TDW8970 define Device/TDW8970
$(Device/lantiqTpLink) $(Device/lantiqTpLink)
DEVICE_PROFILE := TDW8970 DEVICE_PROFILE := TDW8970
TPLINK_BOARD_ID := TD-W8970v1 TPLINK_FLASHLAYOUT := 8Mltq
TPLINK_HWID := 0x89700001
TPLINK_HWREV := 1
IMAGE_SIZE := 7680k IMAGE_SIZE := 7680k
DEVICE_TITLE := TP-LINK TD-W8970 DEVICE_TITLE := TP-LINK TD-W8970
DEVICE_PACKAGES:= kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES:= kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
@ -21,7 +25,9 @@ endef
define Device/TDW8980 define Device/TDW8980
$(Device/lantiqTpLink) $(Device/lantiqTpLink)
DEVICE_PROFILE := TDW8980 DEVICE_PROFILE := TDW8980
TPLINK_BOARD_ID := TD-W8980v1 TPLINK_FLASHLAYOUT := 8Mltq
TPLINK_HWID := 0x89800001
TPLINK_HWREV := 14
IMAGE_SIZE := 7680k IMAGE_SIZE := 7680k
DEVICE_TITLE := TP-LINK TD-W8980 DEVICE_TITLE := TP-LINK TD-W8980
DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-mini kmod-usb-dwc2 kmod-usb-ledtrig-usbport
@ -31,6 +37,9 @@ define Device/VR200v
$(Device/lantiqTpLink) $(Device/lantiqTpLink)
DEVICE_PROFILE := VR200v DEVICE_PROFILE := VR200v
TPLINK_BOARD_ID := ArcherVR200V TPLINK_BOARD_ID := ArcherVR200V
TPLINK_FLASHLAYOUT := 16Mltq
TPLINK_HWID := 0x73b70801
TPLINK_HWREV := 0x2f
IMAGE_SIZE := 15808k IMAGE_SIZE := 15808k
DEVICE_TITLE := TP-LINK Archer VR200v DEVICE_TITLE := TP-LINK Archer VR200v
DEVICE_PACKAGES:= kmod-usb-dwc2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES:= kmod-usb-dwc2 kmod-usb-ledtrig-usbport

View file

@ -2,7 +2,7 @@
# MT7620A Profiles # MT7620A Profiles
# #
DEVICE_VARS += TPLINK_BOARD_ID DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD TPLINK_HVERSION
define Build/elecom-header define Build/elecom-header
cp $@ $(KDIR)/v_0.0.0.bin cp $@ $(KDIR)/v_0.0.0.bin
@ -26,17 +26,22 @@ endef
TARGET_DEVICES += ai-br100 TARGET_DEVICES += ai-br100
define Device/Archer define Device/Archer
TPLINK_HWREVADD := 0
TPLINK_HVERSION := 3
KERNEL := $(KERNEL_DTB) KERNEL := $(KERNEL_DTB)
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header -e
IMAGE/factory.bin := tplink-v2-image IMAGE/factory.bin := tplink-v2-image -e
IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata IMAGE/sysupgrade.bin := tplink-v2-image -s -e | append-metadata
endef endef
define Device/ArcherC20 define Device/ArcherC20
$(Device/Archer) $(Device/Archer)
DTS := ArcherC20 DTS := ArcherC20
SUPPORTED_DEVICES := c20 SUPPORTED_DEVICES := c20
TPLINK_BOARD_ID := ArcherC20 TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc2000001
TPLINK_HWREV := 0x44
TPLINK_HWREVADD := 0x1
IMAGES += factory.bin IMAGES += factory.bin
DEVICE_TITLE := TP-Link ArcherC20 DEVICE_TITLE := TP-Link ArcherC20
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
@ -47,7 +52,9 @@ define Device/ArcherC20i
$(Device/Archer) $(Device/Archer)
DTS := ArcherC20i DTS := ArcherC20i
SUPPORTED_DEVICES := c20i SUPPORTED_DEVICES := c20i
TPLINK_BOARD_ID := ArcherC20i TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc2000001
TPLINK_HWREV := 58
IMAGES += factory.bin IMAGES += factory.bin
DEVICE_TITLE := TP-Link ArcherC20i DEVICE_TITLE := TP-Link ArcherC20i
endef endef
@ -57,10 +64,12 @@ define Device/ArcherC50v1
$(Device/Archer) $(Device/Archer)
DTS := ArcherC50 DTS := ArcherC50
SUPPORTED_DEVICES := c50 SUPPORTED_DEVICES := c50
TPLINK_BOARD_ID := ArcherC50 TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0xc7500001
TPLINK_HWREV := 69
IMAGES += factory-us.bin factory-eu.bin IMAGES += factory-us.bin factory-eu.bin
IMAGE/factory-us.bin := tplink-v2-image -w 0 IMAGE/factory-us.bin := tplink-v2-image -e -w 0
IMAGE/factory-eu.bin := tplink-v2-image -w 2 IMAGE/factory-eu.bin := tplink-v2-image -e -w 2
DEVICE_TITLE := TP-Link ArcherC50v1 DEVICE_TITLE := TP-Link ArcherC50v1
endef endef
TARGET_DEVICES += ArcherC50v1 TARGET_DEVICES += ArcherC50v1
@ -69,7 +78,9 @@ define Device/ArcherMR200
$(Device/Archer) $(Device/Archer)
DTS := ArcherMR200 DTS := ArcherMR200
SUPPORTED_DEVICES := mr200 SUPPORTED_DEVICES := mr200
TPLINK_BOARD_ID := ArcherMR200 TPLINK_FLASHLAYOUT := 8MLmtk
TPLINK_HWID := 0xd7500001
TPLINK_HWREV := 0x4a
DEVICE_PACKAGES := kmod-usb2 kmod-usb-net kmod-usb-net-rndis kmod-usb-serial kmod-usb-serial-option adb-enablemodem DEVICE_PACKAGES := kmod-usb2 kmod-usb-net kmod-usb-net-rndis kmod-usb-serial kmod-usb-serial-option adb-enablemodem
DEVICE_TITLE := TP-Link ArcherMR200 DEVICE_TITLE := TP-Link ArcherMR200
endef endef

View file

@ -2,7 +2,7 @@
# MT76x8 Profiles # MT76x8 Profiles
# #
DEVICE_VARS += TPLINK_BOARD_ID DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD TPLINK_HVERSION
define Device/duzun-dm06 define Device/duzun-dm06
DTS := DUZUN-DM06 DTS := DUZUN-DM06
@ -85,12 +85,16 @@ define Device/tl-wr840n-v4
DTS := TL-WR840NV4 DTS := TL-WR840NV4
IMAGE_SIZE := 7808k IMAGE_SIZE := 7808k
DEVICE_TITLE := TP-Link TL-WR840N v4 DEVICE_TITLE := TP-Link TL-WR840N v4
TPLINK_BOARD_ID := TL-WR840NV4 TPLINK_FLASHLAYOUT := 8Mmtk
TPLINK_HWID := 0x08400004
TPLINK_HWREV := 0x1
TPLINK_HWREVADD := 0x4
TPLINK_HVERSION := 3
KERNEL := $(KERNEL_DTB) KERNEL := $(KERNEL_DTB)
IMAGES += tftp-recovery.bin IMAGES += tftp-recovery.bin
IMAGE/factory.bin := tplink-v2-image IMAGE/factory.bin := tplink-v2-image -e
IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin) IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata | \ IMAGE/sysupgrade.bin := tplink-v2-image -s -e | append-metadata | \
check-size $$$$(IMAGE_SIZE) check-size $$$$(IMAGE_SIZE)
endef endef
@ -98,7 +102,9 @@ define Device/tl-wr841n-v13
$(Device/tl-wr840n-v4) $(Device/tl-wr840n-v4)
DTS := TL-WR841NV13 DTS := TL-WR841NV13
DEVICE_TITLE := TP-Link TL-WR841N v13 DEVICE_TITLE := TP-Link TL-WR841N v13
TPLINK_BOARD_ID := TL-WR841NV13 TPLINK_HWID := 0x08410013
TPLINK_HWREV := 0x268
TPLINK_HWREVADD := 0x13
endef endef
TARGET_DEVICES += tl-wr840n-v4 tl-wr841n-v13 TARGET_DEVICES += tl-wr840n-v4 tl-wr841n-v13