[PATCH] Add support for TP-Link Archer C50v1

mail at adrianschmutzler.de mail at adrianschmutzler.de
Fr Okt 20 19:25:28 CEST 2017


Wenn ich den bestell, wie hoch ist die Chance auf einen v1?

https://www.amazon.de/TP-Link-Archer-C50-Anschluss-GlasfaserModem/dp/B011NLWSQS/ref=sr_1_2?ie=UTF8&qid=1508520112&sr=8-2&keywords=c50



> -----Original Message-----
> From: Fabian Bläse [mailto:fabian at blaese.de]
> Sent: Freitag, 20. Oktober 2017 19:17
> To: mail at adrianschmutzler.de
> Cc: franken-dev at freifunk.net
> Subject: Re: [PATCH] Add support for TP-Link Archer C50v1
> 
> Ah, geht es um flashen auf die Factory Firmware? Das habe ich ehrlich gesagt
> bisher noch nicht probiert, ich war leider gezwungen, per SPI zu flashen, da
> hab ich gleich LEDE rauf geflasht.
> Ich kümmere mich drum, danke für den Hinweis.
> 
> Fabian
> 
> > On 20. Oct 2017, at 19:14, mail at adrianschmutzler.de wrote:
> >
> > Das geht auch, nur das Gerät nimmt ihn dann nicht an, weil es das Image
> mit TPLINK_BOARD_NAME prüft, ob es das richtige Gerät ist. Hatte genau
> das beim 1043v5.
> >
> >> -----Original Message-----
> >> From: Fabian Bläse [mailto:fabian at blaese.de]
> >> Sent: Freitag, 20. Oktober 2017 19:12
> >> To: Adrian Schmutzler <mail at adrianschmutzler.de>
> >> Cc: franken-dev at freifunk.net
> >> Subject: Re: [PATCH] Add support for TP-Link Archer C50v1
> >>
> >> Hallo Adrian,
> >>
> >> ich schau nochmal drüber, sobald ich mit testen fertig bin.
> >> Wann ist das passiert? Das letzte mal, als ich es probiert habe, hat
> >> sich der Patch noch wunderbar applien und kompilieren lassen.
> >>
> >> Fabian
> >>
> >>> On 20. Oct 2017, at 18:03, Adrian Schmutzler
> >>> <mail at adrianschmutzler.de>
> >> wrote:
> >>>
> >>> Hallo nochmal,
> >>>
> >>> es gab im LEDE master mal einen Patch, der hat TPLINK_BOARD_NAME
> to
> >> TPLINK_BOARD_ID umbenannt. Da du den nicht drin hast (und auch nicht
> >> reinnehmen solltest), musst du alle Fälle von TPLINK_BOARD_ID
> >> entsprechend nach TPLINK_BOARD_NAME zurück-umbenennen.
> >>>
> >>> Geht wahrscheinlich mit Find/Replace.
> >>>
> >>> Grüße
> >>>
> >>> Adrian
> >>>
> >>>> -----Original Message-----
> >>>> From: franken-dev [mailto:franken-dev-bounces at freifunk.net] On
> >> Behalf
> >>>> Of Fabian Bläse
> >>>> Sent: Mittwoch, 18. Oktober 2017 16:41
> >>>> To: franken-dev at freifunk.net
> >>>> Subject: [PATCH] Add support for TP-Link Archer C50v1
> >>>>
> >>>> Signed-off-by: Fabian Bläse <fabian at blaese.de>
> >>>> ---
> >>>> bsp/board_c50.bsp                                  |   7 +
> >>>> bsp/c50/.config                                    |  16 ++
> >>>> ...mktplinkfw2-related-commands-to-image-com.patch | 166
> >>>> +++++++++++++++++++++  ...e-simplify-TP-Link-Archer-devices-
> >>>> definit.patch |  73 +++++++++  ...s-Archer-C50v1-support-US-and-EU-
> >>>> versions.patch |  52 +++++++
> >>>> ...ils-mktplinkfw2-support-additional-
> >>>> hardwa.patch | 147 ++++++++++++++++++
> >>>> ...tils-mktplinkfw2-fix-support- for-w-option.patch |  32 ++++
> >>>> ...5-firmware-utils-mktplinkfw2-fix-MD5-
> >>>> salt.patch |  68 +++++++++
> >>>> src/packages/fff/fff-network/ramips/network.c50    |   8 +
> >>>> 9 files changed, 569 insertions(+)
> >>>> create mode 100644 bsp/board_c50.bsp create mode 100644
> >>>> bsp/c50/.config create mode 100644
> >>>> build_patches/openwrt/0009-build-move-
> >> mktplinkfw2-
> >>>> related-commands-to-image-com.patch
> >>>> create mode 100644
> >>>> build_patches/openwrt/0010-ramips-image-simplify-
> >>>> TP-Link-Archer-devices-definit.patch
> >>>> create mode 100644 build_patches/openwrt/0011-ramips-Archer-
> C50v1-
> >>>> support-US-and-EU-versions.patch
> >>>> create mode 100644 build_patches/openwrt/0013-firmware-utils-
> >>>> mktplinkfw2-support-additional-hardwa.patch
> >>>> create mode 100644 build_patches/openwrt/0014-firmware-utils-
> >>>> mktplinkfw2-fix-support-for-w-option.patch
> >>>> create mode 100644 build_patches/openwrt/0015-firmware-utils-
> >>>> mktplinkfw2-fix-MD5-salt.patch
> >>>> create mode 100644 src/packages/fff/fff-network/ramips/network.c50
> >>>>
> >>>> diff --git a/bsp/board_c50.bsp b/bsp/board_c50.bsp new file mode
> >>>> 100644 index 0000000..74576c7
> >>>> --- /dev/null
> >>>> +++ b/bsp/board_c50.bsp
> >>>> @@ -0,0 +1,7 @@
> >>>> +machine=c50
> >>>> +chipset=ramips
> >>>> +target=$builddir/$machine
> >>>> +
> >>>> +images=(
> >>>> +        "lede-ramips-mt7620-ArcherC50-squashfs-factory-
> sysupgrade.bin"
> >>>> +       )
> >>>> diff --git a/bsp/c50/.config b/bsp/c50/.config new file mode 100644
> >>>> index
> >>>> 0000000..6e9a624
> >>>> --- /dev/null
> >>>> +++ b/bsp/c50/.config
> >>>> @@ -0,0 +1,16 @@
> >>>> +# Generated using "./buildscript config openwrt".
> >>>> +# Do no edit manually
> >>>> +#
> >>>> +CONFIG_TARGET_ramips=y
> >>>> +CONFIG_TARGET_ramips_mt7620=y
> >>>> +CONFIG_TARGET_ramips_mt7620_DEVICE_ArcherC50=y
> >>>> +CONFIG_BUSYBOX_CUSTOM=y
> >>>> +CONFIG_CLEAN_IPKG=y
> >>>> +CONFIG_PACKAGE_kmod-ifb=y
> >>>> +CONFIG_PACKAGE_kmod-ledtrig-heartbeat=y
> >>>> +CONFIG_PACKAGE_kmod-ledtrig-netdev=y
> >>>> +CONFIG_PACKAGE_kmod-sched-connmark=y
> >>>> +CONFIG_PACKAGE_qos-scripts=y
> >>>> +CONFIG_PACKAGE_tc=y
> >>>> +CONFIG_STRIP_KERNEL_EXPORTS=y
> >>>> +CONFIG_TARGET_SQUASHFS_BLOCK_SIZE=512
> >>>> diff --git
> >>>> a/build_patches/openwrt/0009-build-move-mktplinkfw2-related-
> >>>> commands-to-image-com.patch b/build_patches/openwrt/0009-build-
> >>>> move-mktplinkfw2-related-commands-to-image-com.patch
> >>>> new file mode 100644
> >>>> index 0000000..1c9999b
> >>>> --- /dev/null
> >>>> +++ b/build_patches/openwrt/0009-build-move-mktplinkfw2-related-
> >>>> commands
> >>>> +++ -to-image-com.patch
> >>>> @@ -0,0 +1,166 @@
> >>>> +From 82e87bab1f0572e576a89aa85b5ebfe45f257cc9 Mon Sep 17
> 00:00:00
> >>>> 2001
> >>>> +From: Piotr Dymacz <pepe2k at gmail.com>
> >>>> +Date: Fri, 23 Jun 2017 23:07:10 +0200
> >>>> +Subject: [PATCH 1/3] build: move mktplinkfw2 related commands to
> >>>> +image-commands.mk
> >>>> +MIME-Version: 1.0
> >>>> +Content-Type: text/plain; charset=UTF-8
> >>>> +Content-Transfer-Encoding: 8bit
> >>>> +
> >>>> +There are already two targets (lantiq, ramips) which use
> >>>> +mktplinkfw2 tool for creating images. This de-duplicates code,
> >>>> +introduces two new build commands: tplink-v2-header,
> >>>> +tplink-v2-image and makes use of them in place of old, (sub)target
> specific ones.
> >>>> +
> >>>> +Signed-off-by: Piotr Dymacz <pepe2k at gmail.com> [Rebased on
> >> 8ad1b09]
> >>>> +Signed-off-by: Fabian Bläse <fabian at blaese.de>
> >>>> +---
> >>>> + include/image-commands.mk            | 14 ++++++++++++++
> >>>> + target/linux/lantiq/image/tp-link.mk | 25
> >>>> +++++++++----------------- target/linux/ramips/image/mt7620.mk  |
> >>>> +24 ++++++++++++------------
> >>>> + 3 files changed, 34 insertions(+), 29 deletions(-)
> >>>> +
> >>>> +diff --git a/include/image-commands.mk b/include/image-
> >> commands.mk
> >>>> +index 04fa853fbb..90fe5fc242 100644
> >>>> +--- a/include/image-commands.mk
> >>>> ++++ b/include/image-commands.mk
> >>>> +@@ -173,6 +173,20 @@ define Build/sysupgrade-tar
> >>>> + 		$@
> >>>> + endef
> >>>> +
> >>>> ++define Build/tplink-v2-header
> >>>> ++	$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
> >>>> ++		-c -V "ver. 2.0" -B $(TPLINK_BOARD_ID) $(1) -k $@ -o
> $@.new
> >>>> ++	@mv $@.new $@
> >>>> ++endef
> >>>> ++
> >>>> ++define Build/tplink-v2-image
> >>>> ++	$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
> >>>> ++		-a 0x4 -j -V "ver. 2.0" -B $(TPLINK_BOARD_ID) $(1) \
> >>>> ++		-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o
> $@.new
> >>>> ++	cat $@.new >> $@
> >>>> ++	rm -rf $@.new
> >>>> ++endef
> >>>> ++
> >>>> + json_quote=$(subst ','\'',$(subst ",\",$(1)))
> >>>> + #")')
> >>>> + metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip
> >>>> +$(foreach v,$(1),"$(call json_quote,$(v))")))) diff --git
> >>>> +a/target/linux/lantiq/image/tp-link.mk
> >>>> +b/target/linux/lantiq/image/tp-link.mk
> >>>> +index 49c4bc10e1..976184175a 100644
> >>>> +--- a/target/linux/lantiq/image/tp-link.mk
> >>>> ++++ b/target/linux/lantiq/image/tp-link.mk
> >>>> +@@ -1,27 +1,18 @@
> >>>> +-define Build/tplink-fw
> >>>> +-	mktplinkfw2 -c -B $(BOARD_ID) -s \
> >>>> +-		-k $@ -o $@.new
> >>>> +-	mv $@.new $@
> >>>> +-endef
> >>>> +-
> >>>> +-define Build/mktplinkfw2
> >>>> +-	mktplinkfw2 -B $(BOARD_ID) -s -a 0x4 -j \
> >>>> +-		-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) \
> >>>> +-		-o $@
> >>>> +-endef
> >>>> +-DEVICE_VARS += BOARD_ID
> >>>> ++DEVICE_VARS += TPLINK_BOARD_ID
> >>>> +
> >>>> + define Device/lantiqTpLink
> >>>> +   KERNEL := kernel-bin | append-dtb | lzma
> >>>> +-  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-fw
> >>>> ++  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | \
> >>>> ++	tplink-v2-header -s -V "ver. 1.0"
> >>>> +   IMAGES := sysupgrade.bin
> >>>> +-  IMAGE/sysupgrade.bin := mktplinkfw2 | append-metadata |
> >>>> +check-size
> >>>> +$$$$(IMAGE_SIZE)
> >>>> ++  IMAGE/sysupgrade.bin := tplink-v2-image -s -V "ver. 1.0" | \
> >>>> ++	append-metadata | check-size $$$$(IMAGE_SIZE)
> >>>> + endef
> >>>> +
> >>>> + define Device/TDW8970
> >>>> +   $(Device/lantiqTpLink)
> >>>> +   DEVICE_PROFILE := TDW8970
> >>>> +-  BOARD_ID := TD-W8970v1
> >>>> ++  TPLINK_BOARD_ID := TD-W8970v1
> >>>> +   IMAGE_SIZE := 7680k
> >>>> +   DEVICE_TITLE := TP-LINK TD-W8970
> >>>> +   DEVICE_PACKAGES:= kmod-ath9k wpad-mini kmod-usb-dwc2
> >>>> +kmod-usb-ledtrig-usbport @@ -30,7 +21,7 @@ endef  define
> >>>> Device/TDW8980
> >>>> +   $(Device/lantiqTpLink)
> >>>> +   DEVICE_PROFILE := TDW8980
> >>>> +-  BOARD_ID := TD-W8980v1
> >>>> ++  TPLINK_BOARD_ID := TD-W8980v1
> >>>> +   IMAGE_SIZE := 7680k
> >>>> +   DEVICE_TITLE := TP-LINK TD-W8980
> >>>> +   DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-mini
> kmod-
> >>>> usb-dwc2
> >>>> +kmod-usb-ledtrig-usbport @@ -39,7 +30,7 @@ endef  define
> >>>> Device/VR200v
> >>>> +   $(Device/lantiqTpLink)
> >>>> +   DEVICE_PROFILE := VR200v
> >>>> +-  BOARD_ID := ArcherVR200V
> >>>> ++  TPLINK_BOARD_ID := ArcherVR200V
> >>>> +   IMAGE_SIZE := 15808k
> >>>> +   DEVICE_TITLE := TP-LINK Archer VR200v
> >>>> +   DEVICE_PACKAGES:= kmod-usb-dwc2 kmod-usb-ledtrig-usbport diff
> >>>> +--git a/target/linux/ramips/image/mt7620.mk
> >>>> +b/target/linux/ramips/image/mt7620.mk
> >>>> +index c2c0ae271d..bb79acb894 100644
> >>>> +--- a/target/linux/ramips/image/mt7620.mk
> >>>> ++++ b/target/linux/ramips/image/mt7620.mk
> >>>> +@@ -2,10 +2,7 @@
> >>>> + # MT7620A Profiles
> >>>> + #
> >>>> +
> >>>> +-define Build/tplink-header
> >>>> +-	$(STAGING_DIR_HOST)/bin/mktplinkfw2 -a 0x4 -V "ver. 2.0" -
> B $(1) \
> >>>> +-		-o $@.new -k $@ -r $(IMAGE_ROOTFS) && mv
> $@.new $@
> >>>> +-endef
> >>>> ++DEVICE_VARS += TPLINK_BOARD_ID
> >>>> +
> >>>> + define Build/pad-kernel-ex2700
> >>>> + 	cp $@ $@.tmp && dd if=/dev/zero bs=64 count=1 >> $@.tmp
> \ @@ -
> >>>> 35,10
> >>>> ++32,11 @@ endef  define Device/ArcherC20i
> >>>> +   DTS := ArcherC20i
> >>>> +   SUPPORTED_DEVICES := c20i
> >>>> ++  TPLINK_BOARD_ID := ArcherC20i
> >>>> +   KERNEL := $(KERNEL_DTB)
> >>>> +-  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherC20i -c
> >>>> +-  IMAGE/factory.bin := append-kernel | tplink-header ArcherC20i
> >>>> +-j
> >>>> +-  IMAGE/sysupgrade.bin := append-kernel | tplink-header
> >>>> +ArcherC20i -j -s | append-metadata
> >>>> ++  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
> >>>> ++ IMAGE/factory.bin := tplink-v2-image  IMAGE/sysupgrade.bin :=
> >>>> ++ tplink-v2-image -s | append-metadata
> >>>> +   IMAGES += factory.bin
> >>>> +   DEVICE_TITLE := TP-Link ArcherC20i  endef @@ -47,10 +45,11 @@
> >>>> +TARGET_DEVICES += ArcherC20i  define
> >>>> +Device/ArcherC50
> >>>> +   DTS := ArcherC50
> >>>> +   SUPPORTED_DEVICES := c50
> >>>> ++  TPLINK_BOARD_ID := ArcherC50
> >>>> +   KERNEL := $(KERNEL_DTB)
> >>>> +-  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherC50 -c
> >>>> +-  IMAGE/factory.bin := append-kernel | tplink-header ArcherC50 -j
> >>>> +-  IMAGE/sysupgrade.bin := append-kernel | tplink-header ArcherC50
> >>>> +-j -s | append-metadata
> >>>> ++  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
> >>>> ++ IMAGE/factory.bin := tplink-v2-image  IMAGE/sysupgrade.bin :=
> >>>> ++ tplink-v2-image -s | append-metadata
> >>>> +   IMAGES += factory.bin
> >>>> +   DEVICE_TITLE := TP-Link ArcherC50  endef @@ -59,9 +58,10 @@
> >>>> +TARGET_DEVICES += ArcherC50  define
> >>>> +Device/ArcherMR200
> >>>> +   DTS := ArcherMR200
> >>>> +   SUPPORTED_DEVICES := mr200
> >>>> ++  TPLINK_BOARD_ID := ArcherMR200
> >>>> +   KERNEL := $(KERNEL_DTB)
> >>>> +-  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header
> ArcherMR200
> >>>> +-c
> >>>> +-  IMAGE/sysupgrade.bin := append-kernel | tplink-header
> >> ArcherMR200
> >>>> +-j -s | append-metadata
> >>>> ++  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
> >>>> ++ IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata
> >>>> +   DEVICE_PACKAGES := kmod-usb2 kmod-usb-net kmod-usb-net-
> rndis
> >>>> kmod-usb-serial kmod-usb-serial-option adb
> >>>> +   DEVICE_TITLE := TP-Link ArcherMR200  endef
> >>>> +--
> >>>> +2.14.2
> >>>> +
> >>>> diff --git
> >>>> a/build_patches/openwrt/0010-ramips-image-simplify-TP-Link-
> >>>> Archer-devices-definit.patch
> >>>> b/build_patches/openwrt/0010-ramips-image-
> >>>> simplify-TP-Link-Archer-devices-definit.patch
> >>>> new file mode 100644
> >>>> index 0000000..f30411f
> >>>> --- /dev/null
> >>>> +++ b/build_patches/openwrt/0010-ramips-image-simplify-TP-Link-
> >> Archer
> >>>> +++ -
> >>>> de
> >>>> +++ vices-definit.patch
> >>>> @@ -0,0 +1,73 @@
> >>>> +From 16cbb38ac1f84d60b9901f9d6827a498a1cbba46 Mon Sep 17
> 00:00:00
> >>>> 2001
> >>>> +From: Piotr Dymacz <pepe2k at gmail.com>
> >>>> +Date: Fri, 23 Jun 2017 23:20:53 +0200
> >>>> +Subject: [PATCH 2/3] ramips: image: simplify TP-Link Archer
> >>>> +devices definitions
> >>>> +MIME-Version: 1.0
> >>>> +Content-Type: text/plain; charset=UTF-8
> >>>> +Content-Transfer-Encoding: 8bit
> >>>> +
> >>>> +Signed-off-by: Piotr Dymacz <pepe2k at gmail.com> [Rebased on
> >> 8ad1b09]
> >>>> +Signed-off-by: Fabian Bläse <fabian at blaese.de>
> >>>> +---
> >>>> + target/linux/ramips/image/mt7620.mk | 21 ++++++++++-----------
> >>>> + 1 file changed, 10 insertions(+), 11 deletions(-)
> >>>> +
> >>>> +diff --git a/target/linux/ramips/image/mt7620.mk
> >>>> +b/target/linux/ramips/image/mt7620.mk
> >>>> +index bb79acb894..dd75f5a504 100644
> >>>> +--- a/target/linux/ramips/image/mt7620.mk
> >>>> ++++ b/target/linux/ramips/image/mt7620.mk
> >>>> +@@ -29,39 +29,38 @@ define Build/zyimage
> >>>> + 	$(STAGING_DIR_HOST)/bin/zyimage $(1) $@  endef
> >>>> +
> >>>> +-define Device/ArcherC20i
> >>>> +-  DTS := ArcherC20i
> >>>> +-  SUPPORTED_DEVICES := c20i
> >>>> +-  TPLINK_BOARD_ID := ArcherC20i
> >>>> ++define Device/Archer
> >>>> +   KERNEL := $(KERNEL_DTB)
> >>>> +   KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
> >>>> +   IMAGE/factory.bin := tplink-v2-image
> >>>> +   IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata
> >>>> ++endef
> >>>> ++
> >>>> ++define Device/ArcherC20i
> >>>> ++  $(Device/Archer)
> >>>> ++  DTS := ArcherC20i
> >>>> ++  SUPPORTED_DEVICES := c20i
> >>>> ++  TPLINK_BOARD_ID := ArcherC20i
> >>>> +   IMAGES += factory.bin
> >>>> +   DEVICE_TITLE := TP-Link ArcherC20i endef TARGET_DEVICES +=
> >>>> + ArcherC20i
> >>>> +
> >>>> + define Device/ArcherC50
> >>>> ++  $(Device/Archer)
> >>>> +   DTS := ArcherC50
> >>>> +   SUPPORTED_DEVICES := c50
> >>>> +   TPLINK_BOARD_ID := ArcherC50
> >>>> +-  KERNEL := $(KERNEL_DTB)
> >>>> +-  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
> >>>> +-  IMAGE/factory.bin := tplink-v2-image
> >>>> +-  IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata
> >>>> +   IMAGES += factory.bin
> >>>> +   DEVICE_TITLE := TP-Link ArcherC50  endef  TARGET_DEVICES +=
> >>>> +ArcherC50
> >>>> +
> >>>> + define Device/ArcherMR200
> >>>> ++  $(Device/Archer)
> >>>> +   DTS := ArcherMR200
> >>>> +   SUPPORTED_DEVICES := mr200
> >>>> +   TPLINK_BOARD_ID := ArcherMR200
> >>>> +-  KERNEL := $(KERNEL_DTB)
> >>>> +-  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header
> >>>> +-  IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata
> >>>> +   DEVICE_PACKAGES := kmod-usb2 kmod-usb-net kmod-usb-net-
> rndis
> >>>> kmod-usb-serial kmod-usb-serial-option adb
> >>>> +   DEVICE_TITLE := TP-Link ArcherMR200  endef
> >>>> +--
> >>>> +2.14.2
> >>>> +
> >>>> diff --git
> >>>> a/build_patches/openwrt/0011-ramips-Archer-C50v1-support-US-
> >>>> and-EU-versions.patch b/build_patches/openwrt/0011-ramips-Archer-
> >>>> C50v1-support-US-and-EU-versions.patch
> >>>> new file mode 100644
> >>>> index 0000000..95d8ce7
> >>>> --- /dev/null
> >>>> +++ b/build_patches/openwrt/0011-ramips-Archer-C50v1-support-US-
> >> and-
> >>>> EU-v
> >>>> +++ ersions.patch
> >>>> @@ -0,0 +1,52 @@
> >>>> +From cfa1a9466db691915960be89e40f3c8335b9ea4f Mon Sep 17
> 00:00:00
> >>>> 2001
> >>>> +From: Thibaut VARENE <hacks at slashdirt.org>
> >>>> +Date: Fri, 28 Jul 2017 13:00:54 +0200
> >>>> +Subject: [PATCH 3/3] ramips: Archer C50v1: support US and EU
> >>>> +versions
> >>>> +
> >>>> +For the Archer C50v1, the EU and US versions are differentiated by
> >>>> +their respective HW additional version (0x0 for US, 0x2 for EU).
> >>>> +
> >>>> +The stock web interface checks this field before flashing, making
> >>>> +it impossible to flash the current (US) factory image on EU hardware.
> >>>> +
> >>>> +However the bootloader does not check this field, making it
> >>>> +possible to use a single sysupgrade image for both hardware.
> >>>> +
> >>>> +This patch adds the necessary build bits to generate both EU and
> >>>> +US factory images, and renames the target as "Archer C50v1" since
> >>>> +there are as of now
> >>>> +3 different versions of Archer C50 (all with different CPUs).
> >>>> +
> >>>> +Signed-off-by: Thibaut VARENE <hacks at slashdirt.org>
> >>>> +---
> >>>> + target/linux/ramips/image/mt7620.mk | 10 ++++++----
> >>>> + 1 file changed, 6 insertions(+), 4 deletions(-)
> >>>> +
> >>>> +diff --git a/target/linux/ramips/image/mt7620.mk
> >>>> +b/target/linux/ramips/image/mt7620.mk
> >>>> +index dd75f5a504..64d11a5b0a 100644
> >>>> +--- a/target/linux/ramips/image/mt7620.mk
> >>>> ++++ b/target/linux/ramips/image/mt7620.mk
> >>>> +@@ -46,15 +46,17 @@ define Device/ArcherC20i  endef
> >> TARGET_DEVICES
> >>>> += ArcherC20i
> >>>> +
> >>>> +-define Device/ArcherC50
> >>>> ++define Device/ArcherC50v1
> >>>> +   $(Device/Archer)
> >>>> +   DTS := ArcherC50
> >>>> +   SUPPORTED_DEVICES := c50
> >>>> +   TPLINK_BOARD_ID := ArcherC50
> >>>> +-  IMAGES += factory.bin
> >>>> +-  DEVICE_TITLE := TP-Link ArcherC50
> >>>> ++  IMAGES += factory-us.bin factory-eu.bin  IMAGE/factory-us.bin
> >>>> ++ := tplink-v2-image -w 0  IMAGE/factory-eu.bin := tplink-v2-image
> >>>> ++ -w 2 DEVICE_TITLE := TP-Link ArcherC50v1
> >>>> + endef
> >>>> +-TARGET_DEVICES += ArcherC50
> >>>> ++TARGET_DEVICES += ArcherC50v1
> >>>> +
> >>>> + define Device/ArcherMR200
> >>>> +   $(Device/Archer)
> >>>> +--
> >>>> +2.14.2
> >>>> +
> >>>> diff --git a/build_patches/openwrt/0013-firmware-utils-mktplinkfw2-
> >>>> support-additional-hardwa.patch
> >>>> b/build_patches/openwrt/0013-firmware-
> >>>> utils-mktplinkfw2-support-additional-hardwa.patch
> >>>> new file mode 100644
> >>>> index 0000000..e679fd0
> >>>> --- /dev/null
> >>>> +++ b/build_patches/openwrt/0013-firmware-utils-mktplinkfw2-
> support
> >>>> +++ -
> >>>> addi
> >>>> +++ tional-hardwa.patch
> >>>> @@ -0,0 +1,147 @@
> >>>> +From fc3aa153d006a0eb7e43f3f06af309ec60996755 Mon Sep 17
> 00:00:00
> >>>> 2001
> >>>> +From: Piotr Dymacz <pepe2k at gmail.com>
> >>>> +Date: Wed, 21 Jun 2017 14:15:55 +0200
> >>>> +Subject: [PATCH 1/3] firmware-utils: mktplinkfw2: support
> >>>> +additional hardware  version
> >>>> +
> >>>> +As it turned out, some of new MediaTek based TP-Link devices use
> >>>> +value from field at 0x3c offset in version 3 of TP-Link header to
> >>>> +specify "Additional Hardware Version".
> >>>> +
> >>>> +Value from this field is validated during regular (GUI) firmware
> >>>> +upgrade on devices like TL-WR840N v4 or TL-WR841N v13. If it's
> >>>> +zero (based on some tests, it seems that firmware will accept
> >>>> +anything != 0), errors like below are printed on console and upgrade
> fails:
> >>>> +
> >>>> +[ rsl_sys_updateFirmware ] 2137:  Firmware Additional
> >>>> +HardwareVersion check failed
> >>>> +
> >>>> +[ rdp_updateFirmware ] 345:  perror:4506
> >>>> +
> >>>> +Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
> >>>> +---
> >>>> + tools/firmware-utils/src/mktplinkfw2.c | 26
> >>>> +++++++++++++++++++++------
> >>>> + 1 file changed, 20 insertions(+), 6 deletions(-)
> >>>> +
> >>>> +diff --git a/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +b/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +index 3ab5c52ec2..b6dd670b90 100644
> >>>> +--- a/tools/firmware-utils/src/mktplinkfw2.c
> >>>> ++++ b/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +@@ -43,7 +43,7 @@ struct fw_header {
> >>>> + 	char		fw_version[48]; /* 0x04: fw version string */
> >>>> + 	uint32_t	hw_id;		/* 0x34: hardware id */
> >>>> + 	uint32_t	hw_rev;		/* 0x38: FIXME:
> hardware
> >>>> revision? */
> >>>> +-	uint32_t	unk1;	        /* 0x3c: 0x00000000 */
> >>>> ++	uint32_t	hw_ver_add;	/* 0x3c: additional hardware
> version
> >>>> */
> >>>> + 	uint8_t		md5sum1[MD5SUM_LEN]; /* 0x40 */
> >>>> + 	uint32_t	unk2;		/* 0x50: 0x00000000 */
> >>>> + 	uint8_t		md5sum2[MD5SUM_LEN]; /* 0x54 */
> >>>> +@@ -80,6 +80,7 @@ struct board_info {
> >>>> + 	char		*id;
> >>>> + 	uint32_t	hw_id;
> >>>> + 	uint32_t	hw_rev;
> >>>> ++	uint32_t	hw_ver_add;
> >>>> + 	char		*layout_id;
> >>>> + 	uint32_t	hdr_ver;
> >>>> + 	bool		endian_swap;
> >>>> +@@ -104,6 +105,8 @@ static char *opt_hw_id;  static uint32_t
> >>>> +hw_id; static char *opt_hw_rev;  static uint32_t hw_rev;
> >>>> ++static char *opt_hw_ver_add;
> >>>> ++static uint32_t hw_ver_add;
> >>>> + static int fw_ver_lo;
> >>>> + static int fw_ver_mid;
> >>>> + static int fw_ver_hi;
> >>>> +@@ -288,6 +291,7 @@ static void usage(int status)
> >>>> + "  -L <la>         overwrite kernel load address with <la> (hexval prefixed
> >> with
> >>>> 0x)\n"
> >>>> + "  -H <hwid>       use hardware id specified with <hwid>\n"
> >>>> + "  -W <hwrev>      use hardware revision specified with <hwrev>\n"
> >>>> ++"  -w <hwveradd>   use additional hardware version specified with
> >>>> <hwveradd>\n"
> >>>> + "  -F <id>         use flash layout specified with <id>\n"
> >>>> + "  -k <file>       read kernel image from the file <file>\n"
> >>>> + "  -r <file>       read rootfs image from the file <file>\n"
> >>>> +@@ -391,6 +395,7 @@ static int check_options(void)
> >>>> +
> >>>> + 		hw_id = board->hw_id;
> >>>> + 		hw_rev = board->hw_rev;
> >>>> ++		hw_ver_add = board->hw_ver_add;
> >>>> + 		if (board->hdr_ver)
> >>>> + 			hdr_ver = board->hdr_ver;
> >>>> + 		endian_swap = board->endian_swap; @@ -405,6
> +410,11
> >> @@ static int
> >>>> +check_options(void)
> >>>> + 			hw_rev = strtoul(opt_hw_rev, NULL, 0);
> >>>> + 		else
> >>>> + 			hw_rev = 1;
> >>>> ++
> >>>> ++		if (opt_hw_ver_add)
> >>>> ++			hw_ver_add = strtoul(opt_hw_rev, NULL, 0);
> >>>> ++		else
> >>>> ++			hw_ver_add = 0;
> >>>> + 	}
> >>>> +
> >>>> + 	layout = find_layout(layout_id); @@ -511,6 +521,7 @@ static
> void
> >>>> +fill_header(char *buf, int len)
> >>>> +
> >>>> + 	hdr->hw_id = htonl(hw_id);
> >>>> + 	hdr->hw_rev = htonl(hw_rev);
> >>>> ++	hdr->hw_ver_add = htonl(hw_ver_add);
> >>>> +
> >>>> + 	if (boot_info.file_size == 0) {
> >>>> + 		memcpy(hdr->md5sum1, md5salt_normal,
> sizeof(hdr-
> >>>>> md5sum1)); @@
> >>>> +-535,7 +546,6 @@ static void fill_header(char *buf, int len)
> >>>> + 	hdr->boot_ofs = htonl(0);
> >>>> + 	hdr->boot_len = htonl(boot_info.file_size);
> >>>> +
> >>>> +-	hdr->unk1 = htonl(0);
> >>>> + 	hdr->unk2 = htonl(0);
> >>>> + 	hdr->unk3 = htonl(0xffffffff);
> >>>> + 	hdr->unk4 = htons(0x55aa);
> >>>> +@@ -779,9 +789,6 @@ static int inspect_fw(void)
> >>>> +
> >>>> + 	inspect_fw_phexdec("Version 2 Header size", sizeof(struct
> >>>> + fw_header));
> >>>> +
> >>>> +-	if (ntohl(hdr->unk1) != 0)
> >>>> +-		inspect_fw_phexdec("Unknown value 1", hdr-
> >unk1);
> >>>> +-
> >>>> + 	memcpy(md5sum, hdr->md5sum1, sizeof(md5sum));
> >>>> + 	if (ntohl(hdr->boot_len) == 0)
> >>>> + 		memcpy(hdr->md5sum1, md5salt_normal,
> sizeof(md5sum));
> >>>> @@ -820,11
> >>>> ++827,15 @@ static int inspect_fw(void)
> >>>> + 		                    ntohl(hdr->hw_id), board->id);
> >>>> + 		inspect_fw_phexexp("Hardware Revision",
> >>>> + 		                   ntohl(hdr->hw_rev), board->hw_rev);
> >>>> ++		inspect_fw_phexexp("Additional HW Version",
> >>>> ++		                   ntohl(hdr->hw_ver_add), board-
> >hw_ver_add);
> >>>> + 	} else {
> >>>> + 		inspect_fw_phexpost("Hardware ID",
> >>>> + 		                    ntohl(hdr->hw_id), "unknown");
> >>>> + 		inspect_fw_phex("Hardware Revision",
> >>>> + 		                ntohl(hdr->hw_rev));
> >>>> ++		inspect_fw_phex("Additional HW Version",
> >>>> ++		                ntohl(hdr->hw_ver_add));
> >>>> + 	}
> >>>> +
> >>>> + 	printf("%-23s: %d.%d.%d-%d.%d\n", "Software version", @@
> -919,7
> >>>> ++930,7 @@ int main(int argc, char *argv[])
> >>>> + 	while ( 1 ) {
> >>>> + 		int c;
> >>>> +
> >>>> +-		c = getopt(argc, argv,
> >>>> "a:B:H:E:F:L:V:N:W:ci:k:r:R:o:xhsjv:y:T:e");
> >>>> ++		c = getopt(argc, argv,
> >>>> ++"a:B:H:E:F:L:V:N:W:w:ci:k:r:R:o:xhsjv:y:T:e");
> >>>> + 		if (c == -1)
> >>>> + 			break;
> >>>> +
> >>>> +@@ -942,6 +953,9 @@ int main(int argc, char *argv[])
> >>>> + 		case 'W':
> >>>> + 			opt_hw_rev = optarg;
> >>>> + 			break;
> >>>> ++		case 'w':
> >>>> ++			opt_hw_ver_add = optarg;
> >>>> ++			break;
> >>>> + 		case 'L':
> >>>> + 			sscanf(optarg, "0x%x", &kernel_la);
> >>>> + 			break;
> >>>> +--
> >>>> +2.11.0 (Apple Git-81)
> >>>> +
> >>>> diff --git
> >>>> a/build_patches/openwrt/0014-firmware-utils-mktplinkfw2-fix-
> >>>> support-for-w-option.patch
> >>>> b/build_patches/openwrt/0014-firmware-utils-
> >>>> mktplinkfw2-fix-support-for-w-option.patch
> >>>> new file mode 100644
> >>>> index 0000000..4ce76b6
> >>>> --- /dev/null
> >>>> +++ b/build_patches/openwrt/0014-firmware-utils-mktplinkfw2-fix-
> >> suppo
> >>>> +++ rt-
> >>>> +++ for-w-option.patch
> >>>> @@ -0,0 +1,32 @@
> >>>> +From f116ed7573cc77e4db1ef8c183932da6a56a195f Mon Sep 17
> 00:00:00
> >>>> 2001
> >>>> +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
> >>>> +Date: Sun, 2 Jul 2017 22:28:24 +0200
> >>>> +Subject: [PATCH 2/3] firmware-utils: mktplinkfw2: fix support for
> >>>> +-w option
> >>>> +MIME-Version: 1.0
> >>>> +Content-Type: text/plain; charset=UTF-8
> >>>> +Content-Transfer-Encoding: 8bit
> >>>> +
> >>>> +This fixes copy & paste typo when reading -w argument.
> >>>> +
> >>>> +Fixes: 4b35e174caa5b ("firmware-utils: mktplinkfw2: support
> >>>> +additional hardware version")
> >>>> +Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> >>>> +---
> >>>> + tools/firmware-utils/src/mktplinkfw2.c | 2 +-
> >>>> + 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>> +
> >>>> +diff --git a/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +b/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +index b6dd670b90..4efe06acf3 100644
> >>>> +--- a/tools/firmware-utils/src/mktplinkfw2.c
> >>>> ++++ b/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +@@ -412,7 +412,7 @@ static int check_options(void)
> >>>> + 			hw_rev = 1;
> >>>> +
> >>>> + 		if (opt_hw_ver_add)
> >>>> +-			hw_ver_add = strtoul(opt_hw_rev, NULL, 0);
> >>>> ++			hw_ver_add = strtoul(opt_hw_ver_add,
> NULL, 0);
> >>>> + 		else
> >>>> + 			hw_ver_add = 0;
> >>>> + 	}
> >>>> +--
> >>>> +2.11.0 (Apple Git-81)
> >>>> +
> >>>> diff --git
> >>>> a/build_patches/openwrt/0015-firmware-utils-mktplinkfw2-fix-
> >>>> MD5-salt.patch
> >>>> b/build_patches/openwrt/0015-firmware-utils-mktplinkfw2-
> >>>> fix-MD5-salt.patch
> >>>> new file mode 100644
> >>>> index 0000000..a0e14df
> >>>> --- /dev/null
> >>>> +++ b/build_patches/openwrt/0015-firmware-utils-mktplinkfw2-fix-
> MD5
> >>>> +++ -
> >>>> salt
> >>>> +++ .patch
> >>>> @@ -0,0 +1,68 @@
> >>>> +From 2f7382a3b9ae90e67980f0baedeb7f3109cfc0a6 Mon Sep 17
> 00:00:00
> >>>> 2001
> >>>> +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal at milecki.pl>
> >>>> +Date: Sun, 2 Jul 2017 17:06:58 +0200
> >>>> +Subject: [PATCH 3/3] firmware-utils: mktplinkfw2: fix MD5 salt
> >>>> +MIME-Version: 1.0
> >>>> +Content-Type: text/plain; charset=UTF-8
> >>>> +Content-Transfer-Encoding: 8bit
> >>>> +
> >>>> +LEDE supports few devices using TP-Link firmware format (V2 or V3):
> >>>> +ArcherC20i, ArcherC50, ArcherMR200, TDW8970, TDW8980, TL-
> WR840N
> >> v4,
> >>>> +TL-WR841N v13 and VR200v
> >>>> +
> >>>> +Testing mktplinkfw2 tool with official (vendor generated) firmware
> >>>> +files for above devices has shown an error when comparing
> >>>> +calculated and included MD5 sum, e.g.:
> >>>> +> mktplinkfw2 -i
> >>>> +> Archer_C20iv1_0.9.1_3.2_up_boot\(170221\)_2017-02-
> 21_17.14.03.bi
> >>>> +> n
> >>>> +> | grep -A 1 MD5Sum1
> >>>> +Header MD5Sum1         : 22 5a cb 92 10 d2 95 7b df 62 9a f8 62 17 37 10
> >>>> (*ERROR*)
> >>>> +          --> expected : ad 19 11 d1 78 98 a7 42 5f 2e 64 da 8a 34
> >>>> +ec cb
> >>>> +
> >>>> +This problem has been verified to occur with:
> >>>> +Archer_C20iv1_0.9.1_3.2_up_boot(170221)_2017-02-21_17.14.03.bin
> >>>> +Archer MR200v1_0.9.1_1.1_up_boot_v004a.0 Build 160905
> >> Rel.60037n.bin
> >>>> +TD-W8970v3_0.9.1_2.0_up_boot(160816)_2016-08-16_10.40.57.bin
> >>>> +TD-W8980v1_0.6.0_1.8_up_boot(150514)_2015-05-14_11.16.43.bin
> >>>> +Archer_VR200vv2_0.2.0_0.8.0_up_boot(161202)_2016-12-
> >> 05_14.39.06.bin
> >>>> +
> >>>> +For some images, e.g.:
> >>>> +Archer_C50v3_EU_0.9.1_0.3_up_boot[170417-rel52298].bin
> >>>> +TL-WR840Nv4_EU_0.9.1_4.16_up_boot[170421-rel70692].bin
> >>>> +TL-WR841Nv13_0.9.1_3.16_up_boot(161012).bin
> >>>> +mktplinkfw2 calculates zero MD5 so these has to be fixed separately:
> >>>> +> mktplinkfw2 -i TL-WR841Nv13_0.9.1_3.16_up_boot\(161012\).bin |
> >>>> +> grep -A 1 MD5Sum1
> >>>> +Header MD5Sum1         : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> >>>> (*ERROR*)
> >>>> +          --> expected : 6f 1d 9b 57 5d 42 14 6d bf a2 03 9d 46 7d
> >>>> +55
> >>>> +55
> >>>> +
> >>>> +It's most likely that MD5 salt used in mktplinkfw2 has been always
> >>>> +wrong (and it's not a matter of e.g. a vendor change). Update it
> >>>> +to fix
> >>>> +MD5 calculation.
> >>>> +
> >>>> +This has been also verified to calculate MD5 correctly for other
> >>>> +(not yet supported) devices, e.g.:
> >>>> +Archer_C3150v2_0.1.0_0.9.1_up_boot(160812)_2016-08-
> 12_10.52.54.bin
> >>>> +Archer_C3200v1_0.9.1_0.1_up_boot(160704)_2016-07-
> 04_15.48.28.bin
> >>>> +
> >>>> +Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> >>>> +Acked-by: Mathias Kresin <dev at kresin.me>
> >>>> +---
> >>>> + tools/firmware-utils/src/mktplinkfw2.c | 4 ++--
> >>>> + 1 file changed, 2 insertions(+), 2 deletions(-)
> >>>> +
> >>>> +diff --git a/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +b/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +index 4efe06acf3..f6436c95b3 100644
> >>>> +--- a/tools/firmware-utils/src/mktplinkfw2.c
> >>>> ++++ b/tools/firmware-utils/src/mktplinkfw2.c
> >>>> +@@ -135,8 +135,8 @@ char md5salt_normal[MD5SUM_LEN] = {  };
> >>>> +
> >>>> + char md5salt_boot[MD5SUM_LEN] = {
> >>>> +-	0x8c, 0xef, 0x33, 0x5b, 0xd5, 0xc5, 0xce, 0xfa,
> >>>> +-	0xa7, 0x9c, 0x28, 0xda, 0xb2, 0xe9, 0x0f, 0x42,
> >>>> ++	0x8c, 0xef, 0x33, 0x5f, 0xd5, 0xc5, 0xce, 0xfa,
> >>>> ++	0xac, 0x9c, 0x28, 0xda, 0xb2, 0xe9, 0x0f, 0x42,
> >>>> + };
> >>>> +
> >>>> + static struct flash_layout layouts[] = {
> >>>> +--
> >>>> +2.11.0 (Apple Git-81)
> >>>> +
> >>>> diff --git a/src/packages/fff/fff-network/ramips/network.c50
> >>>> b/src/packages/fff/fff-network/ramips/network.c50
> >>>> new file mode 100644
> >>>> index 0000000..280d597
> >>>> --- /dev/null
> >>>> +++ b/src/packages/fff/fff-network/ramips/network.c50
> >>>> @@ -0,0 +1,8 @@
> >>>> +WANDEV=eth0
> >>>> +SWITCHDEV=eth0
> >>>> +CLIENT_PORTS="6t 1 2"
> >>>> +WAN_PORTS="6t 0"
> >>>> +BATMAN_PORTS="6t 3 4"
> >>>> +
> >>>> +ETHMESHMAC=
> >>>> +ROUTERMAC=eth0
> >>>> --
> >>>> 2.14.2
> >>>>
> >>>> --
> >>>> franken-dev mailing list
> >>>> franken-dev at freifunk.net
> >>>> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
> >>>
> >
> >




Mehr Informationen über die Mailingliste franken-dev