[PATCH v6 2/2] Add support for TP-Link Archer C50v1
Tim Niemeyer
tim at tn-x.org
Sa Nov 4 17:47:05 CET 2017
Am Montag, den 23.10.2017, 23:44 +0200 schrieb Adrian Schmutzler:
> From: Fabian Blaese <fabian at blaese.de>
>
> BROKEN: factory firmware is accepted, but causes bootloop
So lange das so ist, mag ich das nicht aufnehmen. :(
Den Support können wir nicht leisten, für die Leute die Kisten wieder
flott zu machen.
Tim
>
> Changes in v2:
> - Rebased onto 1043v5
> - Renamed TPLINK_BOARD_ID back to TPLINK_BOARD_NAME
> - Changed numbers of LEDE patches
> - Renamed device to include v1 in various places
> - Renamed board from 'c50' to 'archer-c50-v1'
>
> Changes in v3:
> - Add subtarget to bsp
> - Rename sysupgrade image
>
> Changes in v4:
> - Rename BSP to mt7620
>
> Changes in v5:
> - Update sysupgrade.sh to support C50
>
> Changes in v6:
> - Added two LEDE patches to provide flashable factory image
>
> Signed-off-by: Fabian Bläse <fabian at blaese.de>
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
> bsp/board_mt7620.bsp | 8 +
> bsp/mt7620/.config | 16 ++
> ...mktplinkfw2-related-commands-to-image-com.patch | 168
> +++++++++++++++++++++
> ...e-simplify-TP-Link-Archer-devices-definit.patch | 75 +++++++++
> ...s-Archer-C50v1-support-US-and-EU-versions.patch | 59 ++++++++
> ...ils-mktplinkfw2-support-additional-hardwa.patch | 149
> ++++++++++++++++++
> ...tils-mktplinkfw2-fix-support-for-w-option.patch | 34 +++++
> ...6-firmware-utils-mktplinkfw2-fix-MD5-salt.patch | 70 +++++++++
> ...d-mktplinkfw2-hardcoded-values-to-makefil.patch | 168
> +++++++++++++++++++++
> ...mmands-tplink-v2-header-pass-kernel-loada.patch | 33 ++++
> .../files/etc/uci-defaults/50-fff-boardname | 3 +
> .../fff/fff-network/ramips/network.archer-c50-v1 | 8 +
> .../fff/fff-sysupgrade/files/etc/sysupgrade.sh | 10 +-
> 13 files changed, 798 insertions(+), 3 deletions(-)
> create mode 100644 bsp/board_mt7620.bsp
> create mode 100644 bsp/mt7620/.config
> create mode 100644 build_patches/openwrt/0021-build-move-
> mktplinkfw2-related-commands-to-image-com.patch
> create mode 100644 build_patches/openwrt/0022-ramips-image-simplify-
> TP-Link-Archer-devices-definit.patch
> create mode 100644 build_patches/openwrt/0023-ramips-Archer-C50v1-
> support-US-and-EU-versions.patch
> create mode 100644 build_patches/openwrt/0024-firmware-utils-
> mktplinkfw2-support-additional-hardwa.patch
> create mode 100644 build_patches/openwrt/0025-firmware-utils-
> mktplinkfw2-fix-support-for-w-option.patch
> create mode 100644 build_patches/openwrt/0026-firmware-utils-
> mktplinkfw2-fix-MD5-salt.patch
> create mode 100644 build_patches/openwrt/0027-build-add-mktplinkfw2-
> hardcoded-values-to-makefil.patch
> create mode 100644 build_patches/openwrt/0028-image-commands-tplink-
> v2-header-pass-kernel-loada.patch
> mode change 100755 => 100644 src/packages/fff/fff-
> boardname/files/etc/uci-defaults/50-fff-boardname
> create mode 100644 src/packages/fff/fff-
> network/ramips/network.archer-c50-v1
>
> diff --git a/bsp/board_mt7620.bsp b/bsp/board_mt7620.bsp
> new file mode 100644
> index 0000000..948dff0
> --- /dev/null
> +++ b/bsp/board_mt7620.bsp
> @@ -0,0 +1,8 @@
> +machine=mt7620
> +chipset=ramips
> +subtarget=mt7620
> +target=$builddir/$machine
> +
> +images=(
> + "lede-ramips-mt7620-ArcherC50v1-squashfs-sysupgrade.bin"
> + )
> diff --git a/bsp/mt7620/.config b/bsp/mt7620/.config
> new file mode 100644
> index 0000000..9ebca41
> --- /dev/null
> +++ b/bsp/mt7620/.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_ArcherC50v1=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/0021-build-move-mktplinkfw2-
> related-commands-to-image-com.patch b/build_patches/openwrt/0021-
> build-move-mktplinkfw2-related-commands-to-image-com.patch
> new file mode 100644
> index 0000000..7a842dc
> --- /dev/null
> +++ b/build_patches/openwrt/0021-build-move-mktplinkfw2-related-
> commands-to-image-com.patch
> @@ -0,0 +1,168 @@
> +From 65450ee007e5379e022cb27bbeda10ada58667fc 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/6] 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>
> +[Rebased on 8ad1b09 + C25 + 1043v5]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.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 9e56ab8..c197967 100644
> +--- a/include/image-commands.mk
> ++++ b/include/image-commands.mk
> +@@ -182,6 +182,20 @@ define Build/sysupgrade-tar
> + $@
> + endef
> +
> ++define Build/tplink-v2-header
> ++ $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
> ++ -c -V "ver. 2.0" -B $(TPLINK_BOARD_NAME) $(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_NAME)
> $(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 49c4bc1..555c108 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_NAME
> +
> + 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_NAME := 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_NAME := 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_NAME := 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 c2c0ae2..5f26ca1 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_NAME
> +
> + 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_NAME := 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_NAME := 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_NAME := 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.7.4
> +
> diff --git a/build_patches/openwrt/0022-ramips-image-simplify-TP-
> Link-Archer-devices-definit.patch b/build_patches/openwrt/0022-
> ramips-image-simplify-TP-Link-Archer-devices-definit.patch
> new file mode 100644
> index 0000000..06e6805
> --- /dev/null
> +++ b/build_patches/openwrt/0022-ramips-image-simplify-TP-Link-
> Archer-devices-definit.patch
> @@ -0,0 +1,75 @@
> +From accb6db2f14f380524b441c8533526493e9d0328 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/6] 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>
> +[Rebased on 8ad1b09 + C25 + 1043v5]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.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 5f26ca1..69e5abb 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_NAME := 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_NAME := 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_NAME := 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_NAME := 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.7.4
> +
> diff --git a/build_patches/openwrt/0023-ramips-Archer-C50v1-support-
> US-and-EU-versions.patch b/build_patches/openwrt/0023-ramips-Archer-
> C50v1-support-US-and-EU-versions.patch
> new file mode 100644
> index 0000000..5c7ae8e
> --- /dev/null
> +++ b/build_patches/openwrt/0023-ramips-Archer-C50v1-support-US-and-
> EU-versions.patch
> @@ -0,0 +1,59 @@
> +From bca2f4cfa7721f17d5151f407b5e63c203e02bc5 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/6] ramips: Archer C50v1: support US and EU
> versions
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +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>
> +[Rebased on 8ad1b09]
> +Signed-off-by: Fabian Bläse <fabian at blaese.de>
> +[Rebased on 8ad1b09 + C25 + 1043v5]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> +---
> + 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 69e5abb..df96c32 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_NAME := 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.7.4
> +
> diff --git a/build_patches/openwrt/0024-firmware-utils-mktplinkfw2-
> support-additional-hardwa.patch b/build_patches/openwrt/0024-
> firmware-utils-mktplinkfw2-support-additional-hardwa.patch
> new file mode 100644
> index 0000000..2c18db1
> --- /dev/null
> +++ b/build_patches/openwrt/0024-firmware-utils-mktplinkfw2-support-
> additional-hardwa.patch
> @@ -0,0 +1,149 @@
> +From 067733515c6ebe92f81aad587128cd97cf28dc10 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 4/6] 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>
> +[Rebased on 8ad1b09 + C25 + 1043v5]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> +---
> + 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 3ab5c52..b6dd670 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.7.4
> +
> diff --git a/build_patches/openwrt/0025-firmware-utils-mktplinkfw2-
> fix-support-for-w-option.patch b/build_patches/openwrt/0025-firmware-
> utils-mktplinkfw2-fix-support-for-w-option.patch
> new file mode 100644
> index 0000000..1afba47
> --- /dev/null
> +++ b/build_patches/openwrt/0025-firmware-utils-mktplinkfw2-fix-
> support-for-w-option.patch
> @@ -0,0 +1,34 @@
> +From 5ead985c0d47952f0d70783ad5222d85a9381441 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 5/6] 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>
> +[Rebased on 8ad1b09 + C25 + 1043v5]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> +---
> + 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 b6dd670..4efe06a 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.7.4
> +
> diff --git a/build_patches/openwrt/0026-firmware-utils-mktplinkfw2-
> fix-MD5-salt.patch b/build_patches/openwrt/0026-firmware-utils-
> mktplinkfw2-fix-MD5-salt.patch
> new file mode 100644
> index 0000000..21304bb
> --- /dev/null
> +++ b/build_patches/openwrt/0026-firmware-utils-mktplinkfw2-fix-MD5-
> salt.patch
> @@ -0,0 +1,70 @@
> +From a8a8b0ee0f159a918ab224a51e0d2cf8620793e7 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 6/6] 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.bin | 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>
> +[Rebased on 8ad1b09 + C25 + 1043v5]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> +---
> + 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 4efe06a..f6436c9 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.7.4
> +
> diff --git a/build_patches/openwrt/0027-build-add-mktplinkfw2-
> hardcoded-values-to-makefil.patch b/build_patches/openwrt/0027-build-
> add-mktplinkfw2-hardcoded-values-to-makefil.patch
> new file mode 100644
> index 0000000..ec0286c
> --- /dev/null
> +++ b/build_patches/openwrt/0027-build-add-mktplinkfw2-hardcoded-
> values-to-makefil.patch
> @@ -0,0 +1,168 @@
> +From daa8bacdc6a21fb8f1558f6895dcab98df52301c Mon Sep 17 00:00:00
> 2001
> +From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= <hacks at slashdirt.org>
> +Date: Tue, 3 Oct 2017 12:46:09 +0200
> +Subject: [PATCH 7/8] build: add mktplinkfw2 hardcoded values to
> makefile
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +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 at slashdirt.org>
> +[Rebased on 8ad1b09 + C25 + 1043v5]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> +---
> + include/image-commands.mk | 11 ++++++++---
> + target/linux/lantiq/image/tp-link.mk | 15 ++++++++++++---
> + target/linux/ramips/image/mt7620.mk | 28 ++++++++++++++++++-------
> ---
> + 3 files changed, 38 insertions(+), 16 deletions(-)
> +
> +diff --git a/include/image-commands.mk b/include/image-commands.mk
> +index c197967..d8edc6d 100644
> +--- a/include/image-commands.mk
> ++++ b/include/image-commands.mk
> +@@ -184,14 +184,19 @@ endef
> +
> + define Build/tplink-v2-header
> + $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
> +- -c -V "ver. 2.0" -B $(TPLINK_BOARD_NAME) $(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 $@
> + endef
> +
> + define Build/tplink-v2-image
> + $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
> +- -a 0x4 -j -V "ver. 2.0" -B $(TPLINK_BOARD_NAME)
> $(1) \
> +- -k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new
> ++ -H $(TPLINK_HWID) -W $(TPLINK_HWREV) \
> ++ -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 >> $@
> + rm -rf $@.new
> + endef
> +diff --git a/target/linux/lantiq/image/tp-link.mk
> b/target/linux/lantiq/image/tp-link.mk
> +index 555c108..e432bac 100644
> +--- a/target/linux/lantiq/image/tp-link.mk
> ++++ b/target/linux/lantiq/image/tp-link.mk
> +@@ -1,6 +1,8 @@
> +-DEVICE_VARS += TPLINK_BOARD_NAME
> ++DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV
> TPLINK_HWREVADD TPLINK_HVERSION
> +
> + define Device/lantiqTpLink
> ++ TPLINK_HWREVADD := 0
> ++ TPLINK_HVERSION := 2
> + KERNEL := kernel-bin | append-dtb | lzma
> + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | \
> + tplink-v2-header -s -V "ver. 1.0"
> +@@ -12,7 +14,9 @@ endef
> + define Device/TDW8970
> + $(Device/lantiqTpLink)
> + DEVICE_PROFILE := TDW8970
> +- TPLINK_BOARD_NAME := TD-W8970v1
> ++ TPLINK_FLASHLAYOUT := 8Mltq
> ++ TPLINK_HWID := 0x89700001
> ++ TPLINK_HWREV := 1
> + IMAGE_SIZE := 7680k
> + DEVICE_TITLE := TP-LINK TD-W8970
> + DEVICE_PACKAGES:= kmod-ath9k wpad-mini kmod-usb-dwc2 kmod-usb-
> ledtrig-usbport
> +@@ -21,7 +25,9 @@ endef
> + define Device/TDW8980
> + $(Device/lantiqTpLink)
> + DEVICE_PROFILE := TDW8980
> +- TPLINK_BOARD_NAME := TD-W8980v1
> ++ TPLINK_FLASHLAYOUT := 8Mltq
> ++ TPLINK_HWID := 0x89800001
> ++ TPLINK_HWREV := 14
> + 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
> +@@ -31,6 +37,9 @@ define Device/VR200v
> + $(Device/lantiqTpLink)
> + DEVICE_PROFILE := VR200v
> + TPLINK_BOARD_NAME := ArcherVR200V
> ++ TPLINK_FLASHLAYOUT := 16Mltq
> ++ TPLINK_HWID := 0x73b70801
> ++ TPLINK_HWREV := 0x2f
> + 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 df96c32..8cd566a 100644
> +--- a/target/linux/ramips/image/mt7620.mk
> ++++ b/target/linux/ramips/image/mt7620.mk
> +@@ -2,7 +2,7 @@
> + # MT7620A Profiles
> + #
> +
> +-DEVICE_VARS += TPLINK_BOARD_NAME
> ++DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV
> TPLINK_HWREVADD TPLINK_HVERSION
> +
> + define Build/pad-kernel-ex2700
> + cp $@ $@.tmp && dd if=/dev/zero bs=64 count=1 >> $@.tmp \
> +@@ -30,17 +30,21 @@ define Build/zyimage
> + endef
> +
> + define Device/Archer
> ++ TPLINK_HWREVADD := 0
> ++ TPLINK_HVERSION := 3
> + 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
> ++ 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/ArcherC20i
> + $(Device/Archer)
> + DTS := ArcherC20i
> + SUPPORTED_DEVICES := c20i
> +- TPLINK_BOARD_NAME := ArcherC20i
> ++ TPLINK_FLASHLAYOUT := 8Mmtk
> ++ TPLINK_HWID := 0xc2000001
> ++ TPLINK_HWREV := 58
> + IMAGES += factory.bin
> + DEVICE_TITLE := TP-Link ArcherC20i
> + endef
> +@@ -50,10 +54,12 @@ define Device/ArcherC50v1
> + $(Device/Archer)
> + DTS := ArcherC50
> + SUPPORTED_DEVICES := c50
> +- TPLINK_BOARD_NAME := ArcherC50
> ++ TPLINK_FLASHLAYOUT := 8Mmtk
> ++ TPLINK_HWID := 0xc7500001
> ++ TPLINK_HWREV := 69
> + 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
> ++ IMAGE/factory-us.bin := tplink-v2-image -e -w 0
> ++ IMAGE/factory-eu.bin := tplink-v2-image -e -w 2
> + DEVICE_TITLE := TP-Link ArcherC50v1
> + endef
> + TARGET_DEVICES += ArcherC50v1
> +@@ -62,8 +68,10 @@ define Device/ArcherMR200
> + $(Device/Archer)
> + DTS := ArcherMR200
> + SUPPORTED_DEVICES := mr200
> +- TPLINK_BOARD_NAME := ArcherMR200
> +- DEVICE_PACKAGES := kmod-usb2 kmod-usb-net kmod-usb-net-rndis
> kmod-usb-serial kmod-usb-serial-option adb
> ++ 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_TITLE := TP-Link ArcherMR200
> + endef
> + TARGET_DEVICES += ArcherMR200
> +--
> +2.7.4
> +
> diff --git a/build_patches/openwrt/0028-image-commands-tplink-v2-
> header-pass-kernel-loada.patch b/build_patches/openwrt/0028-image-
> commands-tplink-v2-header-pass-kernel-loada.patch
> new file mode 100644
> index 0000000..aa7fb40
> --- /dev/null
> +++ b/build_patches/openwrt/0028-image-commands-tplink-v2-header-
> pass-kernel-loada.patch
> @@ -0,0 +1,33 @@
> +From 2d5395ad7607929ffc5b7eb317845c02b1eb7a30 Mon Sep 17 00:00:00
> 2001
> +From: Alexander Couzens <lynxis at fe80.eu>
> +Date: Mon, 9 Oct 2017 13:50:03 +0200
> +Subject: [PATCH 8/8] image-commands: tplink-v2-header: pass kernel
> loadaddr
> + and entry
> +
> +Initramfs images won't boot if the default loadaddr and entrypont is
> +different.
> +
> +Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
> +[Rebased on 8ad1b09 + C25 + 1043v5]
> +Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> +---
> + include/image-commands.mk | 3 ++-
> + 1 file changed, 2 insertions(+), 1 deletion(-)
> +
> +diff --git a/include/image-commands.mk b/include/image-commands.mk
> +index d8edc6d..9607d60 100644
> +--- a/include/image-commands.mk
> ++++ b/include/image-commands.mk
> +@@ -184,7 +184,8 @@ endef
> +
> + define Build/tplink-v2-header
> + $(STAGING_DIR_HOST)/bin/mktplinkfw2 \
> +- -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) \
> ++ -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L
> $(KERNEL_LOADADDR) \
> ++ -E $(if
> $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
> + -w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
> + -T $(TPLINK_HVERSION) -V "ver. 2.0" \
> + -k $@ -o $@.new $(1)
> +--
> +2.7.4
> +
> diff --git a/src/packages/fff/fff-boardname/files/etc/uci-
> defaults/50-fff-boardname b/src/packages/fff/fff-
> boardname/files/etc/uci-defaults/50-fff-boardname
> old mode 100755
> new mode 100644
> index 94b9884..8b81754
> --- a/src/packages/fff/fff-boardname/files/etc/uci-defaults/50-fff-
> boardname
> +++ b/src/packages/fff/fff-boardname/files/etc/uci-defaults/50-fff-
> boardname
> @@ -54,6 +54,9 @@ case "$BOARD" in
> archer-c7)
> BOARD=archer-c7-v2
> ;;
> + c50)
> + BOARD=archer-c50-v1
> + ;;
> esac
>
> uci set board.model.name=$BOARD
> diff --git a/src/packages/fff/fff-network/ramips/network.archer-c50-
> v1 b/src/packages/fff/fff-network/ramips/network.archer-c50-v1
> new file mode 100644
> index 0000000..280d597
> --- /dev/null
> +++ b/src/packages/fff/fff-network/ramips/network.archer-c50-v1
> @@ -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
> diff --git a/src/packages/fff/fff-sysupgrade/files/etc/sysupgrade.sh
> b/src/packages/fff/fff-sysupgrade/files/etc/sysupgrade.sh
> index 8aaa924..a87745c 100755
> --- a/src/packages/fff/fff-sysupgrade/files/etc/sysupgrade.sh
> +++ b/src/packages/fff/fff-sysupgrade/files/etc/sysupgrade.sh
> @@ -17,9 +17,11 @@ BOARD=$(uci get board.model.name)
> #decide SOC
> case $BOARD in
> tl-wdr4900-v1 )
> - SOC="mpc85xx" ;;
> + SOC="mpc85xx-g" ;;
> + archer-c50-v1 )
> + SOC="ramips-mt7620" ;;
> * )
> - SOC="ar71xx" ;;
> + SOC="ar71xx-g" ;;
> esac
> echo ""
> echo "Hardware: $BOARD"
> @@ -40,6 +42,8 @@ case $BOARD in
> BOARD="wr841-v10" ;;
> wr841n-v11 )
> BOARD="wr841-v11" ;;
> + archer-c50-v1 )
> + BOARD="ArcherC50v1" ;;
> esac
>
> wget "${UPGRADE_PATH}/release.nfo"
> @@ -81,7 +85,7 @@ if [ "$FIRMWARE_COMMUNITY" = "franken" ]; then
> FIRMWARE_COMMUNITY="fff"
> fi
>
> -FILE="${FIRMWARE_COMMUNITY}-${VERSION}-${SOC}-g-${BOARD}-squashfs-
> sysupgrade.bin"
> +FILE="${FIRMWARE_COMMUNITY}-${VERSION}-${SOC}-${BOARD}-squashfs-
> sysupgrade.bin"
> echo "Downloading $FILE"
> echo ""
> wget "${UPGRADE_PATH}/${FILE}"
> --
> 2.7.4
>
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname : signature.asc
Dateityp : application/pgp-signature
Dateigröße : 488 bytes
Beschreibung: This is a digitally signed message part
URL : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20171104/188129cb/attachment.sig>
Mehr Informationen über die Mailingliste franken-dev