project/firmware-utils.git
5 years agoath79: Add support for TP-Link CPE210 v3
Mario Schroen [Sun, 31 Mar 2019 19:07:03 +0000 (21:07 +0200)]
ath79: Add support for TP-Link CPE210 v3

Specifications:

    * SoC: Qualcomm Atheros QCA9533 (650MHz)
    * RAM: 64MB
    * Storage: 8 MB SPI NOR
    * Wireless: 2.4GHz N based built into SoC 2x2
    * Ethernet: 1x 100/10 Mbps, integrated into SoC, 24V POE IN

Installation:
    Flash factory image through stock firmware WEB UI or TFTP
    To get to TFTP recovery just hold reset button while powering
    on for around 4-5 seconds and release.
    Rename factory image to recovery.bin
    Stock TFTP server IP:192.168.0.100
    Stock device TFTP adress:192.168.0.254

Thanks to robimarko for the work inside the ar71xx tree.
Thanks to adrianschmutzler for deep discussion and fixes.

Signed-off-by: Mario Schroen <m.schroen@web.de>
[Split into DTS/DTSI, read-only config partition in DTSI]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[renamed dtsi filename, light subject touches]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years agoar71xx: Use dynamic partitions for TP-Link CPE210 v2
Adrian Schmutzler [Tue, 26 Mar 2019 10:41:57 +0000 (11:41 +0100)]
ar71xx: Use dynamic partitions for TP-Link CPE210 v2

This is also helpful to add support in ath79.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years agofirmware-utils: mkdlinkfw: add kernel image offset
Pawel Dembicki [Thu, 19 Apr 2018 17:36:55 +0000 (19:36 +0200)]
firmware-utils: mkdlinkfw: add kernel image offset

Some boards with JBOOT have partiton between bootloader
and kernel image. This patch add possibility to change kernel
partition start address.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
5 years agoath79: add support for TP-Link RE350K v1
Piotr Dymacz [Mon, 11 Mar 2019 17:50:42 +0000 (18:50 +0100)]
ath79: add support for TP-Link RE350K v1

TP-Link RE350K v1 (FCC ID: TE7RE350K) is a wall-plug AC1200 Wi-Fi range
extender with 'Kasa Smart' support. Device is based on Qualcomm/Atheros
QCA9558 + QCA9882 + AR8035 platform and is available only on US market.

Specification:

- 720/600/200 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of flash (SPI NOR)
- 1x 1 Gbps Ethernet (AR8035)
- 2T2R 2.4 GHz (QCA9558), with ext. PA (SE2565T) and LNA (SKY65971-11)
- 2T2R 5 GHz (QCA9882), with ext. PA (SE5003L1-R) and LNA (SKY65981-11)
- 2x U.FL connector on PCB
- 2x dual-band PCB antennas
- 1x LED, 2x dual-color LED (all driven by GPIO)
- 3x button (app config, led, reset)
- 1x mechanical on/off slide switch
- 1x UART (4-pin, 2.54 mm pitch) header on PCB
- 1x JTAG (8-pin, 1.27 mm pitch) header on PCB

Flash instruction:
Use 'factory' image directly in vendor GUI (default IP: 192.168.0.254,
default credentials: admin/admin).

Warning:
This device does not include any kind of recovery mechanism in U-Boot.

Vendor firmware access:
You can access vendor firmware over serial (RX line requires jumper
resistor in R306 place, near XTAL) with: root/sohoadmin credentials.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years agofirmware-tools/ptgen: Allow generation 0 size partitions
Linus Walleij [Fri, 15 Feb 2019 16:02:14 +0000 (17:02 +0100)]
firmware-tools/ptgen: Allow generation 0 size partitions

The firmware on the D-Link DNS-313 NAS require two blank
partitions before the boot partition. Support this if
explicitly requested with a "-n" flag.

Tested on the D-Link DNS-313.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
[Broken out from original patch]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoath79: add support for TP-Link Archer C2 V3 (AC900)
Skirmantas Lauzikas [Sun, 28 Oct 2018 04:30:52 +0000 (06:30 +0200)]
ath79: add support for TP-Link Archer C2 V3 (AC900)

This commit adds support for the TP-link Archer C2 V3 (AC900).

Specifications:

 - CPU: QCA9563 750Mhz
 - Ram: 64MB (DDR2)
 - Flash: 8MB (SPI NOR)
 - Ethernet: 5x 10/100/1000
 - Wifi: QCA9563 bgn + QCA9887 an+ac
 - 9x Leds, 2x buttons

Flash instructions:

Upload openwrt-ath79-generic-tplink_archer-c2-v3-squashfs-factory.bin
via the router Web interface and flash as normal firmware update.

Signed-off-by: Skirmantas Lauzikas <skirmantas.lauzikas@blackraven.lt>
[reorder entries, fix trailing whitespace in dts, add firmware partition
 compatible string, remove led default off states, use default on state
 for system led, reuse tplink-safeloader-uimage image build recipe, squash
 with dynamic partitioning commit, reword commit message, add
 installation instructions]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agofirmware-utils: tplink-safeloader: Fix for Archer C2 V3 image generation
Skirmantas Lauzikas [Wed, 14 Nov 2018 13:45:41 +0000 (15:45 +0200)]
firmware-utils: tplink-safeloader: Fix for Archer C2 V3 image generation

Fix for factory image generation, so that stock firmware will accept the
openwrt image.

Ref: https://forum.openwrt.org/t/support-for-tp-link-archer-c2-v3/15617/17
Signed-off-by: Skirmantas Lauzikas <skirmantas.lauzikas@blackraven.lt>
[reword commit message, use correct order for conditions,
 trim trailing whitespace]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agotools: tplink-safeloader: add C7v5 RU Support
Michael Gray [Fri, 18 Jan 2019 07:49:15 +0000 (18:49 +1100)]
tools: tplink-safeloader: add C7v5 RU Support

The added entry originates from TP-Links latest Archer C7 v5 RU firmware.

Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
5 years agotools: mktplinkfw2: add split-uboot layout
David Bauer [Mon, 31 Dec 2018 15:24:24 +0000 (16:24 +0100)]
tools: mktplinkfw2: add split-uboot layout

This commit adds the split-uboot partition layout used by the
Archer C50 v4 to mktplinkfw2.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years agofirmware-utils: mksercommfw: overhaul image creation
Mathias Kresin [Sat, 12 Jan 2019 19:18:52 +0000 (20:18 +0100)]
firmware-utils: mksercommfw: overhaul image creation

Move the zip compression into a build recipe. Pad the image using the
existing build recipes as well to remove duplicate functionality

Change the code to append header and footer in two steps. Allow to use a
fixed filename as the netgear update image does.

Use a fixed timestamp within the zip archive to make the images
reproducible.

Due to the changes we are now compatible to the gnu89 c standard used by
default on the buildbots and we don't need to force a more recent
standard anymore.

Beside all changes, the footer still looks wrong in compare to the
netgear update image.

Signed-off-by: Mathias Kresin <dev@kresin.me>
5 years agofirmware-utils: mkdlinkfw: fix build
Mathias Kresin [Sun, 13 Jan 2019 18:28:54 +0000 (19:28 +0100)]
firmware-utils: mkdlinkfw: fix build

While we don't need the gnu99 option anymore, we still need to force the
c99 standard to fix the following build error on the build bots:

src/mkdlinkfw.c: In function 'find_auh_headers':
src/mkdlinkfw.c:267:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for (int i = 0; i < header_counter; i++) {
   ^
src/mkdlinkfw.c:267:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

Signed-off-by: Mathias Kresin <dev@kresin.me>
5 years agofirmware-utils: mkdlinkfw: fix error handling
Mathias Kresin [Sat, 5 Jan 2019 06:40:55 +0000 (07:40 +0100)]
firmware-utils: mkdlinkfw: fix error handling

fread() doesn't set errno, ferror need to be used to check for errors.
While at it, check if we read the expect number of elements.

Signed-off-by: Mathias Kresin <dev@kresin.me>
5 years agofirmware-utils: mkdlinkfw: create reproducible header
Mathias Kresin [Sat, 5 Jan 2019 06:34:02 +0000 (07:34 +0100)]
firmware-utils: mkdlinkfw: create reproducible header

Use the SOURCE_DATE_EPOCH environment variable if set instead of the
current time. The used timestamp matches the timestamp of the latest
commit this way and make the images reproducible.

Signed-off-by: Mathias Kresin <dev@kresin.me>
5 years agofirmware-utils: mkdlinkfw: cleanup code
Mathias Kresin [Sat, 5 Jan 2019 11:08:09 +0000 (12:08 +0100)]
firmware-utils: mkdlinkfw: cleanup code

Drop unused function and macros. With the cleanup the gnu extension
typeof isn't used any longer and the gnu99 compile flag can be dropped.

Signed-off-by: Mathias Kresin <dev@kresin.me>
5 years agotools/firmware-utils: fix sysupgrade typo in mkdapimg2
Hans Dedecker [Sat, 12 Jan 2019 18:47:02 +0000 (19:47 +0100)]
tools/firmware-utils: fix sysupgrade typo in mkdapimg2

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
5 years agotools/firmware-utils: fix sysupgrade typo in mkdapimg
Hans Dedecker [Sat, 12 Jan 2019 18:42:56 +0000 (19:42 +0100)]
tools/firmware-utils: fix sysupgrade typo in mkdapimg

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
5 years agoath79: add support for TP-Link Archer C6 v2
Georgi Vlaev [Fri, 28 Dec 2018 08:24:01 +0000 (10:24 +0200)]
ath79: add support for TP-Link Archer C6 v2

This patch adds support for TP-Link Archer C6 v2 (EU)

Hardware specification:
- SOC: Qualcomm QCA9563 @ 775MHz
- Flash: GigaDevice GD25Q64CSIG (8MiB)
- RAM: Zentel A3R1GE40JBF (128 MiB DDR2)
- Ethernet: Qualcomm QCA8337N: 4x 1Gbps LAN + 1x 1Gbps WAN
- Wireless:
  - 2.4GHz (bgn) QCA9563 integrated (3x3)
  - 5GHz (ac) Qualcomm QCA9886 (2x2)
- Button: 1x power, 1x reset, 1x wps
- LED: 6x LEDs: power, wlan2g, wlan5g, lan, wan, wps
- UART: There's no UART header on the board

Flash instructions:

Upload
openwrt-ath79-generic-tplink_archer-c6-v2-squashfs-factory.bin
via the router Web interface.

Flash instruction using tftp recovery:

1. Connect the computer to one of the LAN ports of the router
2. Set the computer IP to 192.168.0.66
3. Start a tftp server with the OpenWrt factory image in the
   tftp root directory renamed to ArcherC6v2_tp_recovery.bin.
4. Connect power cable to router, press and hold the reset
   button and turn the router on
5. Keep the reset button pressed until the WPS LED lights up
6. Wait ~150 seconds to complete flashing

According to the GPL source the non-EU variant has different
GPIOs assigned to some of the LEDs and buttons. The flash
layout might be different as well. The wikidevi entry for
Archer A6/C6 assumes they are identical.

Signed-off-by: Georgi Vlaev <georgi.vlaev@gmail.com>
5 years agofirmware-utils: add hex pattern mode for xorimage
INAGAKI Hiroshi [Sat, 8 Dec 2018 06:07:52 +0000 (15:07 +0900)]
firmware-utils: add hex pattern mode for xorimage

This commit adds "hex pattern mode" to xorimage. This mode allows xor
with a hexadecimal pattern that cannot be expressed with ASCII
charactors.

usage (example):
  xorimage -i firmware.bin -o firmware.bin.new -p 6A57190601121E4C -x

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (fix checkpatch)
5 years agoath79: add support for TP-Link Archer A7
Karl-Felix Glatzer [Wed, 12 Dec 2018 16:56:15 +0000 (17:56 +0100)]
ath79: add support for TP-Link Archer A7

This patch adds support for TP-Link Archer A7

Specification:
- SOC: QCA9563
- Flash: 16 MiB (SPI)
- RAM: 128 MiB (DDR2)
- Ethernet: 4x 1Gbps LAN + 1x 1Gbps WAN
- Wireless:
  - 2.4GHz (bgn) SoC internal
  - 5GHz (ac) QCA988x
- USB: 1x USB 2.0 port
- Button: 1x power, 1x reset, 1x wps
- LED: 10x LEDs
- UART: holes in PCB
  - Vcc, GND, RX, TX from ethernet port side
  - 115200n8

Flash instructions:

Upload openwrt-ath79-generic-tplink_archer-a7-v5-squashfs-factory.bin
via the Webinterface.

Flash instruction using tftp recovery:

1. Connect the computer to one of the LAN ports of the Archer A7
2. Set the computer IP to 192.168.0.66
3. Start a tftp server with the OpenWrt factory image in the tftp
   root directory renamed to ArcherC7v5_tp_recovery.bin
2. Connect power cable to Archer A7, press and hold the reset button
   and turn the router on
3. Keep the reset button pressed for ~5 seconds
4. Wait ~150 seconds to complete flashing

Changes since first revision:

  - Flash instructions using stock image webinterface
  - Changed "Version 5" in model string to "v5"
  - Split DTS file in qca9563_tplink_archer-x7-v5.dtsi
    and qca9563_tplink_archer-a7-v5.dts
  - Firmware image is now build with dynamic partitioning
  - Default to ath10k-ct

Changes since second revision:
  - Changed uboot@0 to uboot@20000 in DTS file
  - Fixed ordering issue in board led script
  - Specify firmware partition format in DTS file
  - Rebased Makefile device definition on common
    Device/tplink-safeloader-uimage definition
  - Merged switch section in network script
    (same configuration as tplink,tl-wdr3600
    and tplink,tl-wdr4300)

Signed-off-by: Karl-Felix Glatzer <karl.glatzer@gmx.de>
5 years agoramips: use new image build code for D-Link DCS-930 family
Mathias Kresin [Thu, 29 Nov 2018 22:40:12 +0000 (23:40 +0100)]
ramips: use new image build code for D-Link DCS-930 family

Drop the factory images and the firmware tool to create them. They don't
work any more, since the factory image has an uImage header covering the
whole kernel + rootfs. This way the uImage splitter will not be able to
find the rootfs and the kernel will panic later on.

The factory images were most likely added at a time the board had
distinct partitions for kernel and rootfs.

Signed-off-by: Mathias Kresin <dev@kresin.me>
5 years agotools: tplink-safeloader: add C7v5 EU SupportList
David Bauer [Wed, 7 Nov 2018 21:31:46 +0000 (22:31 +0100)]
tools: tplink-safeloader: add C7v5 EU SupportList

Currently flash from WebIF is broken for Archer C7 v5 EU models as their
SupportList entries are missing.

The added entries originate from TP-Links latest Archer C7 v5 EU
firmware.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years agotools: firmware-utils: mksercommfw build on Darwin
Kevin Darbyshire-Bryant [Thu, 8 Nov 2018 21:35:17 +0000 (21:35 +0000)]
tools: firmware-utils: mksercommfw build on Darwin

asm/byteorder.h & hence __cpu_to_be32() doesn't exist on Darwin

Shamelessly copy some byte swap functions from oseama.c

Acked-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
5 years agoramips: fix netgear r6120 factory image generation
Koen Vandeputte [Thu, 8 Nov 2018 11:46:37 +0000 (12:46 +0100)]
ramips: fix netgear r6120 factory image generation

as indicated in commit c5bf408ed6bd "(ramips: fix image generation for mt76x8")
more rework was needed to fix the other issues.

Building on another machine, but using the same arch, showed
the application failing again for different reasons.

Fix this by completely rewriting the application, fixing following found issues:

- buffer overflows, resulting in stack corruption
- flaws in memory requirement calculations (too small, too large)
- memory leaks
- missing bounds checking on string handling
- non-reproducable images, by using unitilized memory in checksum calculation
- missing error handling, resulting in succes on specific image errors
- endianness errors when building on BE machines
- various minor build warnings
- documentation did not match the code actions (header item locations)
- allowing input to be decimal, hex or octal now

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years agoramips: fix image generation for mt76x8
Koen Vandeputte [Tue, 6 Nov 2018 14:10:17 +0000 (15:10 +0100)]
ramips: fix image generation for mt76x8

Buildbot fails to generate images for targets also generating a
Sercomm binary with following error:

Opening file: /mnt/ramdisk/koen/firmware/builds/owrt_mt76x8/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/tmp/openwrt-ramips-mt76x8-netgear_r6120-squashfs-factory.img.rootfs.zip
Filesize: 3648606 .
mksercommfw: malloc.c:2427: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Makefile:287: recipe for target '/mnt/ramdisk/koen/firmware/builds/owrt_mt76x8/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/tmp/openwrt-ramips-mt76x8-netgear_r6120-squashfs-factory.img' failed

Debugging using valgrind shows stack corruption due to a buffer overflow.
The author of the generator assumes the filename ends with "root",
while it should be "rootfs".

Fix this by accounting for the 2 missing characters which solves the build issues.

More work is required to cleanup this source, which will be done later on.

Reported-by: Hannu Nyman <hannu.nyman@iki.fi>
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years agoar71xx: fix sysupgrade generation for some targets
Koen Vandeputte [Wed, 24 Oct 2018 12:44:30 +0000 (14:44 +0200)]
ar71xx: fix sysupgrade generation for some targets

These targets are already defined as having a dynamic partition
but the safeloader was not adapted for them.

This causes a build warning for the sysupgrade image being too big.

Targets:
- c58-v1
- c60-v1
- c60-v2
- TL-WR1043 v5
- TL-WR902AC v1
- TL-WR942N V1

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years agoar71xx: switch more targets to dynamic partitioning
Koen Vandeputte [Wed, 24 Oct 2018 12:49:07 +0000 (14:49 +0200)]
ar71xx: switch more targets to dynamic partitioning

Targets:
- TP-LINK ER355
- TP-LINK C25 V1
- TP-LINK C59 V1
- TP-LINK C7 V4
- TP-LINK C7 V5

Fixes build issues seen due to the kernel being too big

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years agoar71xx: switch TP-Link RE450 v1 to dynamic partitioning
Radek Dostál [Mon, 22 Oct 2018 20:34:17 +0000 (22:34 +0200)]
ar71xx: switch TP-Link RE450 v1 to dynamic partitioning

As mentioned in commit 5f24933 recent changes on ar71xx (switch to 4.14,
memory compaction, ...) cause an increase in kernel size, making it too
big for RE450.

RE450 images were not build due to the following error message:
os-image partition too big (more than 1572864 bytes): Success

Tested on RE450, device boots and was used to send this patch.

Reported-by: Enrico Mioso <mrkiko.rs@gmail.com>
Suggested-by: David Bauer <mail@david-bauer.net>
Signed-off-by: Radek Dostál <rd@radekdostal.com>
[rewrote commit msg keeping it tight + fixed SoB lines]
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years agomkfwimage: Add image type definition for WA images
Tobias Schramm [Wed, 24 Jan 2018 00:38:14 +0000 (01:38 +0100)]
mkfwimage: Add image type definition for WA images

This patch adds a new type of ubiquiti image, the WA image. First seen
on the NanoStation AC loco the generic name implies that we will see
this type of image on more ubiquiti devices thus it makes sense to
implement it in mkfwimage.

The main difference is that WA images are signed. The "END" header has
been replaced by a "ENDS" header followed by a 2048 bit RSA signature.
This signature is not being generated by mkfwimage and filled with 0x00.

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
5 years agofirmware-utils: mkedimaximg: add "big-endianness mode" option
INAGAKI Hiroshi [Mon, 10 Sep 2018 07:29:39 +0000 (09:29 +0200)]
firmware-utils: mkedimaximg: add "big-endianness mode" option

In addition to the default little-endianness format, I added a mode
so that we can generate firmware with big-endianness format.

example: ELECOM WRC-300GHBK2-I (QCA9563)

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
5 years agobuild: add mkrasimage
David Bauer [Wed, 22 Aug 2018 15:30:44 +0000 (17:30 +0200)]
build: add mkrasimage

The current make-ras.sh image generation script for the ZyXEL NBG6617
has portability issues with bash. Because of this, factory images are
currently not built correctly by the OpenWRT buildbots.

This commit replaces the make-ras.sh by C-written mkrasimage.

The new mkrasimage is also compatible with other ZyXEL devices using
the ras image-format.
This is not tested with the NBG6616 but it correctly builds the
header for ZyXEL factory image.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years agofirmware-utils/mksercommfw: fix build with clang/macOS
Ryan Mounce [Tue, 14 Aug 2018 04:49:29 +0000 (14:19 +0930)]
firmware-utils/mksercommfw: fix build with clang/macOS

fixes error: non-void function 'main' should return a value

Fixes: FS#1770
Signed-off-by: Ryan Mounce <ryan@mounce.com.au>
5 years agofirmware-utils/mksercommfw: fix musl build
Andy Walsh [Mon, 13 Aug 2018 12:33:39 +0000 (14:33 +0200)]
firmware-utils/mksercommfw: fix musl build

* add missing <sys/types.h> for musl

Signed-off-by: Andy Walsh <andy.walsh44+github@gmail.com>
5 years agofirmware-utils: add sercomm/netgear tool
Ludwig Thomeczek [Tue, 12 Jun 2018 19:16:40 +0000 (21:16 +0200)]
firmware-utils: add sercomm/netgear tool

This adds a tool to generate a firmware file accepted
by Netgear or sercomm devices.

They use a zip-packed rootfs with header and a custom
checksum. The generated Image can be flashed via the
nmrpflash tool or the webinterface of the router.

Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
5 years agoar71xx: add support for TP-LINK CPE510 V2.0
Andrew Cameron [Wed, 27 Jun 2018 03:09:03 +0000 (22:09 -0500)]
ar71xx: add support for TP-LINK CPE510 V2.0

Adds Support for the TP-LINK CPE510 V2.0 by TP-Link.
The hardware is almost the same as the CPE510 V1.0
Follow the same processes as for the CPE510 V1.0

Signed-off-by: Andrew Cameron <apcameron@softhome.net>
5 years agoar71xx: add support for TP-Link Archer C59 v2
Keith Maika [Fri, 15 Jun 2018 04:39:09 +0000 (00:39 -0400)]
ar71xx: add support for TP-Link Archer C59 v2

TP-Link Archer C59v2 is a dual-band AC1350 router based on
Qualcomm/Atheros QCA9561+QCA9886 chips.

Specification:

- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- USB 2.0 port
- UART header on PCB

Flash instruction:
  - via web UI:
    1. Download openwrt-ar71xx-generic-archer-c59-v2-squashfs-factory.bin
    2. Login to router and open the Advanced tab
    3. Navigate to System Tools -> Firmware Upgrade
    4. Upload firmware using the Manual Upgrade form
  - via TFTP:
    1. Set PC to fixed ip address 192.168.0.66
    2. Download openwrt-ar71xx-generic-archer-c59-v2-squashfs-factory.bin
       and rename it to tp_recovery.bin
    3. Start a tftp server with the file tp_recovery.bin in its root directory
    4. Turn off the router
    5. Press and hold Reset button
    6. Turn on router with the reset button pressed and wait ~15 seconds
    7. Release the reset button and after a short time
       the firmware should be transferred from the tftp server
    8. Wait ~30 second to complete recovery.

Signed-off-by: Keith Maika <keithm@aoeex.com>
5 years agofirmware-utils: tplink-safeloader: add calloc error handling
Hyeonsik Song [Mon, 25 Jun 2018 02:02:43 +0000 (11:02 +0900)]
firmware-utils: tplink-safeloader: add calloc error handling

Signed-off-by: Hyeonsik Song <blogcin@naver.com>
5 years agoath79: add support for TP-Link RE450 v2
Peter Lundkvist [Fri, 29 Jun 2018 03:44:58 +0000 (05:44 +0200)]
ath79: add support for TP-Link RE450 v2

TP-Link RE450 v2 is a dual band router/range-extender
based on Qualcomm/Atheros QCA9563 + QCA9880.

Specification:

- 775 MHz CPU
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 3T3R 5 GHz
- 1x 10/100/1000 Mbps Ethernet (AR8033 PHY)
- 7x LED, 4x button
- UART header on PCB (needs unmounted R64 & R69 0201 resistors/jumpers)

Flash instruction:
Apply factory image in OEM firmware web-gui.

U-Boot does not seem to have any recovery functions, so
debricking requires connection via UART.

Signed-off-by: Peter Lundkvist <peter.lundkvist@gmail.com>
5 years agofirmware-utils: tplink-safeloader: switch tl-wr1043nd-v4 to dynamic partitions
Lucian Cristian [Tue, 26 Jun 2018 17:43:28 +0000 (20:43 +0300)]
firmware-utils: tplink-safeloader: switch tl-wr1043nd-v4 to dynamic partitions

Use the new dynamic partition split in tplink-safeloader so we no longer
have to worry about kernel size increases.

Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com>
5 years agofirmware-utils: tplink-safeloader: switch RE350 to dynamic partitions
Alex Maclean [Wed, 20 Jun 2018 13:56:22 +0000 (14:56 +0100)]
firmware-utils: tplink-safeloader: switch RE350 to dynamic partitions

Use the new dynamic partition split in tplink-safeloader so we no longer
have to worry about kernel size increases.

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
5 years agofirmware-utils: tplink-safeloader: add dynamic partitions
Alex Maclean [Wed, 20 Jun 2018 13:56:20 +0000 (14:56 +0100)]
firmware-utils: tplink-safeloader: add dynamic partitions

Add support to dynamically split the firmware partition into os-image
and file-system partitions. This is done by replacing those entries in
the partition table with a single unified firmware partition, which is
then split according to actual kernel image size.

The factory image will have the file-system partition aligned to a 64K
erase block, but the sysupgrade image skips this and aligns only the
JFFS2 EOF marker to squeeze out more space.

This should prevent further creeping updates to the kernel partition
size while maximizing space for the overlay filesystem on smaller
devices.

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
5 years agofirmware-utils: mktplinkfw: add rootfs offset for combined images
Alex Maclean [Wed, 20 Jun 2018 13:56:19 +0000 (14:56 +0100)]
firmware-utils: mktplinkfw: add rootfs offset for combined images

Add an option (-O) to calculate rootfs offset for combined images.

This is needed for the TP-Link mtdsplit driver to locate the rootfs
when the start is not aligned to an erase block. This will be the
case for sysupgrade images produced by tplink-safeloader with upcoming
dynamic partition splitting.

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
5 years agoar71xx: Add support for TP-Link CPE210 v2
Adrian Schmutzler [Fri, 19 Jan 2018 13:45:42 +0000 (14:45 +0100)]
ar71xx: Add support for TP-Link CPE210 v2

This PR adds support for a popular low-cost 2.4GHz N based AP

Specifications:
 - SoC: Qualcomm Atheros QCA9533 (650MHz)
 - RAM: 64MB
 - Storage: 8 MB SPI NOR
 - Wireless: 2.4GHz N based built into SoC 2x2
 - Ethernet: 1x 100/10 Mbps, integrated into SoC, 24V POE IN

Installation:
Flash factory image through stock firmware WEB UI
or through TFTP
To get to TFTP recovery just hold reset button while powering on for
around 4-5 seconds and release.
Rename factory image to recovery.bin
Stock TFTP server IP:192.168.0.100
Stock device TFTP adress:192.168.0.254

Notes:
TP-Link does not use bootstrap registers so without this patch reference
clock detects as 40MHz while it is actually 25MHz.
This is due to messed up bootstrap resistor configuration on the PCB.
Provided GPL code just forces 25MHz reference clock.
That causes booting with completely wrong clocks, for example, CPU tries
to boot at 1040MHz while the stock is 650MHz.
So this PR depends on PR #672 to remove 40MHz reference clock.
Thanks to Sven Eckelmann <sven@narfation.org> for properly patching that.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years agoar71xx: add support for TP-LINK Archer C7 v5
Arvid E. Picciani [Mon, 16 Apr 2018 11:18:37 +0000 (13:18 +0200)]
ar71xx: add support for TP-LINK Archer C7 v5

TP-Link Archer C7 v5 is a dual-band AC1750 router, based on Qualcomm/Atheros
QCA9563+QCA9880.

Specification:

- 750/400/250 MHz (CPU/DDR/AHB
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 3T3R 5 GHz
- 5x 10/100/1000 Mbps Ethernet
- 10x LED, 2x button
- UART header on PCB

Flash instruction:
1. Upload lede-ar71xx-generic-archer-c7-v5-squashfs-factory.bin via Web interface

Flash instruction using TFTP recovery:
1. Set PC to fixed ip address 192.168.0.66
2. Download lede-ar71xx-generic-archer-c7-v5-squashfs-factory.bin
and rename it to ArcherC7v5_tp_recovery.bin
3. Start a tftp server with the file tp_recovery.bin in its root directory
4. Turn off the router
5. Press and hold Reset button
6. Turn on router with the reset button pressed and wait ~15 seconds
7. Release the reset button and after a short time
the firmware should be transferred from the tftp server
8. Wait ~30 second to complete recovery.

Signed-off-by: Arvid E. Picciani <aep@exys.org>
5 years agoath79: add tl-wr1043nd-v4 support everything is working
Lucian Cristian [Sat, 16 Jun 2018 10:37:55 +0000 (13:37 +0300)]
ath79: add tl-wr1043nd-v4 support everything is working

tplink-safeloader: resize kernel partition
kernel 4.14 is much bigger, resize the partition

Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com>
5 years agoipq806x: increase kernel partition size for the TP-Link Archer C2600
Stefan Lippers-Hollmann [Fri, 18 May 2018 01:10:18 +0000 (03:10 +0200)]
ipq806x: increase kernel partition size for the TP-Link Archer C2600

The default image does not fit 2 MB anymore, expand os-image partition
to 4 MB.

Upgrading works transparently via sysupgrade in both directions.
Another option would have been to merge "os-image" and "rootfs" into a
single "firmware" partition using MTD_SPLIT_TPLINK_FW, but just
changing the sizes of the existing partitioning has been deemed safer
and actually tested on an affected device; the maximum for rootfs
changes from 27 MB to 25 MB.

Run-tested on TP-Link Archer C2600.

Signed-off-by: Joris de Vries <joris@apptrician.nl>
[slh: extend comments and commit message, rename rootfs]
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
6 years agofirmware-utils: add DNS-313 image header tool
Linus Walleij [Wed, 4 Apr 2018 20:15:29 +0000 (22:15 +0200)]
firmware-utils: add DNS-313 image header tool

This tool is used to create headers on images for the
D-Link DNS-313 in gemini target.
Will be used after switching gemini to 4.14 kernel.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
6 years agofirmware-utils: tplink-safeloader: increase RE350 kernel size
Alex Maclean [Mon, 23 Apr 2018 17:36:54 +0000 (18:36 +0100)]
firmware-utils: tplink-safeloader: increase RE350 kernel size

4.14 increased kernel size, so grow the kernel partition by 128K to compensate.

Fixes FS#1479.

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
6 years agoar71xx: increase kernel partition size for CPE/WBS 210/510
Matthias Schiffer [Tue, 10 Apr 2018 16:14:41 +0000 (18:14 +0200)]
ar71xx: increase kernel partition size for CPE/WBS 210/510

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years agofirmware-utils: tplink-safeloader: move CPE/WBS 210/510 version metainfo to the end
Matthias Schiffer [Tue, 10 Apr 2018 15:26:34 +0000 (17:26 +0200)]
firmware-utils: tplink-safeloader: move CPE/WBS 210/510 version metainfo to the end

Having the metainfo between kernel and rootfs prevents us from resizing
the kernel partition as necessary.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years agoar71xx: add support for TP-Link Archer C60 v2
Henryk Heisig [Mon, 15 Jan 2018 05:44:14 +0000 (06:44 +0100)]
ar71xx: add support for TP-Link Archer C60 v2

TP-Link Archer C60 v2 is a dual-band AC1350 router, based on
Qualcomm/Atheros QCA9561 + QCA9886.

Specification:

- 775/650/258 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- 7x LED, 2x button
- UART header on PCB

Flash instruction (web):

Download lede-ar71xx-generic-archer-c60-v2-squashfs-factory.bin and use
OEM System Tools - Firmware Upgrade site.

Flash instruction (recovery):

1. Set PC to fixed IP address 192.168.0.66
2. Download lede-ar71xx-generic-archer-c60-v2-squashfs-factory.bin and
   rename it to tp_recovery.bin
3. Start a tftp server with the file tp_recovery.bin in its root
   directory
4. Turn off the router
5. Press and hold reset button
6. Turn on router with the reset button pressed and wait ~15 seconds
7. Release the reset button and after a short time the firmware should
   be transferred from the tftp server
8. Wait ~30 second to complete recovery

Flash instruction (under U-Boot, using UART):

tftp 0x81000000 lede-ar71xx-...-sysupgrade.bin
erase 0x9f030000 +$filesize
cp.b $fileaddr 0x9f030000 $filesize
reset

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years agofirmware-utils: image generator for D-Link DAP-1330
Nicolò Veronese [Fri, 16 Jun 2017 12:06:07 +0000 (12:06 +0000)]
firmware-utils: image generator for D-Link DAP-1330

Signed-off-by: Nicolò Veronese <nicveronese@gmail.com>
6 years agofirmware-utils: mkdlinkfw: compile as gnu99
Mathias Kresin [Mon, 19 Mar 2018 07:10:14 +0000 (08:10 +0100)]
firmware-utils: mkdlinkfw: compile as gnu99

Compile as gnu99 to fix the build.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years agofirmware-utils: add JBOOT bootloader image support
Pawel Dembicki [Sat, 3 Feb 2018 11:59:50 +0000 (12:59 +0100)]
firmware-utils: add JBOOT bootloader image support

Tested on D-Link DWR-116.
Based on mktplinkfw.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
6 years agofirmware-utils: tplink-safeloader: compile as gnu99
Alexander Couzens [Thu, 15 Mar 2018 17:17:01 +0000 (18:17 +0100)]
firmware-utils: tplink-safeloader: compile as gnu99

Also fix minor coding style issue and one redeclaration.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
6 years agofirmware-utils: fix erroneous variable redeclaration
Jo-Philipp Wich [Thu, 15 Mar 2018 17:16:46 +0000 (18:16 +0100)]
firmware-utils: fix erroneous variable redeclaration

Fixes: 638e2193fe ("tplink-safeloader: add support to split & extract firmwares")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years agotplink-safeloader: add support to convert factory into sysupgrade
Alexander Couzens [Thu, 1 Mar 2018 23:44:31 +0000 (00:44 +0100)]
tplink-safeloader: add support to convert factory into sysupgrade

Those converted factory images can be used to regain the original
tp-link firmware.
Be aware of firmware upgrade which additional require changes of
other partition than os-image (kernel) & file-system (rootfs).
OEM factory images from tplink can change nearly all partitions.
However using those images, OpenWrt's sysupgrade will only
modify the partitions os-image and file-system.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
6 years agotplink-safeloader: add support to split & extract firmwares
Alexander Couzens [Thu, 1 Mar 2018 23:44:30 +0000 (00:44 +0100)]
tplink-safeloader: add support to split & extract firmwares

Split the oem firmware upgrade images into seperate files.
Useful when analysing oem firmware files.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
6 years agoar71xx: add support for TP-Link RE355
Henryk Heisig [Tue, 6 Feb 2018 21:08:28 +0000 (22:08 +0100)]
ar71xx: add support for TP-Link RE355

This device is identical as TP-Link RE450
RE355 is a dual-band AC1200 router, based on Qualcomm/Atheros
QCA9558+QCA9880.

Specification:

720/600/200 MHz (CPU/DDR/AHB)
64/128 MB of RAM (DDR2)
8 MB of FLASH (SPI NOR)
3T3R 2.4 GHz
3T3R 5 GHz
1x 10/100/1000 Mbps Ethernet
7x LED, 3x button
UART header on PCB

Flash instruction:
Web:
Download lede-ar71xx-generic-archer-c60-v2-squashfs-factory.bin
and use OEM System Tools - Firmware Upgrade site.

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years agoramips: tl-wr840n-v5: increase firmware partition for 4Mmtk layot
Serg Studzinskii [Sun, 24 Dec 2017 16:00:13 +0000 (18:00 +0200)]
ramips: tl-wr840n-v5: increase firmware partition for 4Mmtk layot

According to console log during TP-Link TL-WR840N v5 OEM firmware update
procedure 0x3e0000-0x3f0000 64kB "config" partition, which is used to store
router's configuration settings, is erased and recreated again during every
OEM firmware update procedure, thus does not contain any valuable factory data.
So it is conviniant to use this extra 64kB erase block for jffs overlay due
limited flash size on this device like it used on TP-Link's ar71xx boards.

Signed-off-by: Serg Studzinskii <serguzhg@gmail.com>
6 years agofirmware-tools/ptgen: use portable exit codes
Michael Heimpold [Thu, 21 Dec 2017 22:59:30 +0000 (23:59 +0100)]
firmware-tools/ptgen: use portable exit codes

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
6 years agofirmware-tools/ptgen: fix minor coding style issues
Michael Heimpold [Thu, 21 Dec 2017 22:59:28 +0000 (23:59 +0100)]
firmware-tools/ptgen: fix minor coding style issues

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
6 years agofirmware-utils: mktplinkfw: add support for BR region code
Henryk Heisig [Thu, 7 Dec 2017 20:28:28 +0000 (21:28 +0100)]
firmware-utils: mktplinkfw: add support for BR region code

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years agofirmware-utils: mktplinkfw: fix JFFS2 EOF markers
Sergey Ryazanov [Tue, 10 Oct 2017 22:07:08 +0000 (01:07 +0300)]
firmware-utils: mktplinkfw: fix JFFS2 EOF markers

mktplinkfw/mktplinkfw2 utilities put JFFS2 EOF market only at 64KB
boundary, this could lead to current device configuration lost during
the sysupgrade on a device, which is equpped with flash with the 4KB
erase block size (e.g. TP-Link Archer C20).

This happens when 64KB and 4KB alignments do not match, so the JFFS2
data is written not exactly at the partition beginnig and startup
scripts can not find the JFFS2 during the first boot just after the
sysupgrade.

Fix this by placing additional JFFS2 EOF marker at a 4KB boundary. Also
keep the marker at 64KB intact, so the utilities will produce images
suitable for devices with both 4KB and 64KB erase blocks.

Fixes: 29a2c2ea80441895a2ffe100d854d2b26d5fa606 (add ability to put
jffs2 eof marker into the image)

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years agofirmware-utils: add otrx tool for handling TRX images
Rafał Miłecki [Fri, 17 Nov 2017 10:42:59 +0000 (11:42 +0100)]
firmware-utils: add otrx tool for handling TRX images

It can be a replacement for the trx tool. The advantage is that otrx
doesn't alloc buffer for the whole TRX which can be a nice optimization
when creating big images.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years agoar71xx: add support for TP-Link TL-WR1043N v5
Tim Thorpe [Mon, 25 Sep 2017 09:38:49 +0000 (04:38 -0500)]
ar71xx: add support for TP-Link TL-WR1043N v5

TP-Link TL-WR1043N v5 appears to be identical to the TL-WR1043ND v4,
except that the USB port has been removed and there is no longer a
removable antenna option.

The software is more in line with the Archer series in that it uses a
nested bootloader scheme.

Specifications:

 - QCA9563 at 775 MHz
 - 64 MB RAM
 - 16 MB flash
 - 3 (non-detachable) Antennas / 450 Mbit
 - 1x/4x WAN/LAN Gbps Ethernet (QCA8337)
 - reset and Wi-Fi buttons

Signed-off-by: Tim Thorpe <tim@tfthorpe.net>
Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
6 years agofirmware-utils: tplink-safeloader: add more country codes for Archer C7 v4
Dmitry Tunin [Fri, 3 Nov 2017 14:31:54 +0000 (17:31 +0300)]
firmware-utils: tplink-safeloader: add more country codes for Archer C7 v4

If codes do not match, it is impossible to flash from the stock
firmware.

Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
6 years agoar71xx: increase kernel partition size for TP-Link RE450 v1
Piotr Dymacz [Mon, 6 Nov 2017 22:17:24 +0000 (23:17 +0100)]
ar71xx: increase kernel partition size for TP-Link RE450 v1

This increases kernel partition size and fixes rootfs (file-system)
partition size on TP-Link RE450 v1. Also, while we are at it, switch
from statically defined kernel and rootfs partitions in kernel cmdline
to "tplink-fw" mtd splitter.

Fixes: FS#1072.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agoar71xx: increase kernel partition size for some TP-Link boards
Henryk Heisig [Thu, 26 Oct 2017 22:23:17 +0000 (00:23 +0200)]
ar71xx: increase kernel partition size for some TP-Link boards

This patch increases kernel partition size and re-enables image
generation for below TP-Link boards:

- archer-c58-v1
- archer-c60-v1
- tl-wr902ac-v1
- tl-wr942n-v1

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
[commit message and title reworded]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agoramips: add support for TP-Link TL-WR840N v5
Robert Marko [Wed, 8 Nov 2017 13:00:06 +0000 (14:00 +0100)]
ramips: add support for TP-Link TL-WR840N v5

TP-Link TL-WR840N v5 is simple N300 router with 5-port FE switch and
non-detachable antennas, based on MediaTek MT7628NN (aka MT7628N) WiSoC.

Specification:

- MT7628N/N (580 MHz)
- 64 MB of RAM (DDR2)
- 4 MB of FLASH
- 2T2R 2.4 GHz
- 5x 10/100 Mbps Ethernet
- 2x external, non-detachable antennas
- UART (J1) header on PCB (115200 8n1)
- 1x LED (GPIO-controlled), 1x button

* LED in TL-WR840N v5 is a dual-color, dual-leads type which isn't
  (fully) supported by gpio-leds driver. This type of LED requires both
  GPIOs state change at the same time to select color or turn it off.
  For now, we support/use only the green part of the LED.
  Orange LED is registered so you can later use it for your own purposes.

  Flash instruction:

  Unlike TL-WR840N v4 flashing through WEB UI works in v5.
  1. Download lede-ramips-mt76x8-tl-wr840n-v5-squashfs-sysupgrade.bin image.
  2. Go to 192.168.0.1
  3. Flash the sysupgrade image through Firmware upgrade section of WEB UI.
  4. Wait until green LED stops flashing and use the router.

Notes:
TFTP recovery is broken since TP-Link reused bootloader code for v4 and
that does not take into account only 4 MB of flash and bricks the device.
So do not use TFTP Recovery or you will have to rewrite SPI flash.
They fixed it in later GPL code,but it is unknown which version of
bootloader you have.

After manually compiling and flashing bootloader from GPL sources TFTP
recovery works properly.

Signed-off-by: Robert Marko <robimarko@gmail.com>
6 years agotools/firmware-utils: mktplinkfw* fix rootfs offset
Thibaut VARÈNE [Fri, 27 Oct 2017 18:12:15 +0000 (20:12 +0200)]
tools/firmware-utils: mktplinkfw* fix rootfs offset

With '-a' specified on the command line, the current code:
- computes an aligned _kernel length_ instead of an aligned _rootfs
  offset_.
- does not update the rootfs offset after computing the new kernel
  length, and instead retains the layout default.

When the kernel length exceeds the available space left with this
fixed offset, the resulting image header contains invalid data, with
the recorded rootfs offset overlapping the kernel area.

This patch ensures that rootfs offset is correctly computed and
reflected in the final image.

Furthermore, the build_fw() function special cases the rootfs_align
option because of the above invalid logic. This is also fixed and
the computed (or command-line provided, or layout-provided) rootfs_ofs
value is used in all cases.

There seems to be no valid reason to extend the kernel length beyond
the actual length of the kernel itself (OFW images don't do it) so this
part of the existing behavior is dropped.

Example image before the patch:
Kernel data offset     : 0x00000200 /      512 bytes
Kernel data length     : 0x00158438 /  1410104 bytes
Kernel load address    : 0x00000080
Kernel entry point     : 0x00000080
Rootfs data offset     : 0x00140000 /  1310720 bytes
Rootfs data length     : 0x001e4f7e /  1986430 bytes

Example image after the patch:
Kernel data offset     : 0x00000200 /      512 bytes
Kernel data length     : 0x001583fe /  1410046 bytes
Kernel load address    : 0x00000080
Kernel entry point     : 0x00000080
Rootfs data offset     : 0x00158600 /  1410560 bytes
Rootfs data length     : 0x001e4e22 /  1986082 bytes

Tested-by: Mathias Kresin <dev@kresin.me>
Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Tested-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
Tested-by: Henryk Heisig <hyniu@o2.pl>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
6 years agoar71xx: add support for TP-LINK Archer C7 v4
Felix Fietkau [Tue, 25 Jul 2017 11:32:47 +0000 (13:32 +0200)]
ar71xx: add support for TP-LINK Archer C7 v4

TP-Link Archer C7 v4 is a dual-band AC1750 router, based on Qualcomm/Atheros
QCA9561+QCA9888.

Specification:

- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 3T3R 5 GHz
- 5x 10/100/1000 Mbps Ethernet
- 7x LED, 2x button
- UART header on PCB

Flash instruction:
1. Upload lede-ar71xx-generic-archer-c7-v4-squashfs-factory.bin via Web interface

Flash instruction using TFTP recovery:
1. Set PC to fixed ip address 192.168.0.66
2. Download lede-ar71xx-generic-archer-c7-v4-squashfs-factory.bin
and rename it to ArcherC7v4_tp_recovery.bin
3. Start a tftp server with the file tp_recovery.bin in its root directory
4. Turn off the router
5. Press and hold Reset button
6. Turn on router with the reset button pressed and wait ~15 seconds
7. Release the reset button and after a short time
the firmware should be transferred from the tftp server
8. Wait ~30 second to complete recovery.

Flash instruction under U-Boot, using UART:

1. tftp 0x81000000 lede-ar71xx-...-sysupgrade.bin
2. erase 0x9f040000 +$filesize
3. cp.b $fileaddr 0x9f040000 $filesize
4. reset

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years agotools/firmware-utils: mktplinkfw move build_fw() to lib
Thibaut VARÈNE [Tue, 3 Oct 2017 18:19:52 +0000 (20:19 +0200)]
tools/firmware-utils: mktplinkfw move build_fw() to lib

This patch moves build_fw() to mktplinkfw-lib.c

The versions of mktplinkfw.c and mktplinkfw2.c had slight
differences in code flow, the version from mktplinkfw.c has been
preferred.

While it's expected that this change will not affect mktplinkfw2,
all use cases could not be tested and so this particular change
is committed separately.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
6 years agotools/firmware-utils: mktplinkfw regroup duplicate code
Thibaut VARÈNE [Tue, 3 Oct 2017 16:12:27 +0000 (18:12 +0200)]
tools/firmware-utils: mktplinkfw regroup duplicate code

This patch carves out the duplicated code of mktplinfw.c and
mktplinkfw2.c and moves it to mktplinkfw-lib.c

This change is a semantic NOP (the code is unchanged).

To ensure compatibility with gcc-5.x and newer without changing
the code, -fgnu89-inline is added to the build flags for these
two binaries.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
6 years agotools/firmware-utils: remove hardcoded values from mktplinkfw2.c
Thibaut VARÈNE [Tue, 3 Oct 2017 10:46:09 +0000 (12:46 +0200)]
tools/firmware-utils: remove hardcoded values from mktplinkfw2.c

This patch removes all the hardcoded board-specific values from
mktplinkfw2.c, and as well as the corresponding support code.

By design, this change also deletes all of the broken matching logic
that was embedded in mktplinkfw2 and aligns the "inspect" behavior
with that of mktplinkfw (i.e. print the parsed header content as
they are without further processing).

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
6 years agoramips: add support for TP-Link Archer C20 v1
Maxim Anisimov [Fri, 8 Sep 2017 09:39:17 +0000 (12:39 +0300)]
ramips: add support for TP-Link Archer C20 v1

TP-Link Archer C20 v1 is a router with 5-port FE switch and
non-detachable antennas. It's very similiar to TP-Link Archer C50.
Also it's based on MediaTek MT7620A+MT7610EN.

Specification:
- MediaTek MT7620A (580 Mhz)
- 64 MB of RAM
- 8 MB of FLASH
- 2T2R 2.4 GHz and 1T1R 5 GHz
- 5x 10/100 Mbps Ethernet
- 2x external, non-detachable antennas
- UART (J1) header on PCB (115200 8n1)
- 8x LED (GPIO-controlled*), 2x button, power input switch
- 1 x USB 2.0 port

* WAN LED in this devices is a dual-color, dual-leads type which isn't
  (fully) supported by gpio-leds driver. This type of LED requires both
  GPIOs state change at the same time to select color or turn it off.
  For now, we support/use only the blue part of the LED.
* MT7610EN ac chip isn't not supported by LEDE. Therefore 5Ghz won't
  work.

Factory image notes:

These devices use version 3 of TP-Link header, fortunately without RSA
signature (at least in case of devices sold in Europe). The difference
lays in the requirement for a non-zero value in "Additional Hardware
Version" field. Ideally, it should match the value stored in vendor
firmware header on device.

We are able to prepare factory firwmare file which is accepted and
(almost) correctly flashed from the vendor GUI. As it turned out, it
accepts files without U-Boot image with second header at the beginning
but due to some kind of bug in upgrade routine, flashed image gets
corrupted before it's written to flash. So, to flash this device we must
to prepare image using original firmware from tp-link site with uboot.

Flash instruction:

Until (if at all) TP-Link fixes described problem, the only way to flash
LEDE image in these devices is to use tftp recovery mode in U-Boot.
There are two ways to flash the device to LEDE:

1) Using tftp mode with UART connection and original LEDE image

 - Place lede-ramips-mt7620-ArcherC20-squashfs-factory.bin in tftp
   server directory
 - Configure PC with static IP 192.168.0.66/24 and tftp server.
 - Connect PC with one of LAN ports, power up the router and press
   key "4" to access U-Boot CLI.
 - Use the following commands to update the device to LEDE:

    setenv serverip 192.168.0.66
    tftp 0x80060000 lede-ramips-mt7620-ArcherC20-squashfs-factory.bin
    erase tplink 0x20000 0x7a0000
    cp.b 0x80060000 0x20000 0x7a0000
    reset

 - After that the device will reboot and boot to LEDE

2) Using tftp mode without UART connection but require some
   manipulations with target image

 - Download and unpack TP-Link Archer C20 v1 firmware from original web
   site
 - Split uboot.bin from original firmware by this command (example):

    dd if=Archer_C20v1_0.9.1_4.0_up_boot(160427)_2016-04-27_13.53.59.bin of=uboot.bin bs=512 count=256 skip=1

 - Create ArcherC20V1_tp_recovery.bin using this command:

    cat uboot.bin lede-ramips-mt7620-ArcherC20-squashfs-factory.bin > ArcherC20V1_tp_recovery.bin

 - Place ArcherC20V1_tp_recovery.bin in tftp server directory.
 - Configure PC with static IP 192.168.0.66/24 and tftp server.
 - Connect PC with one of LAN ports, press the reset button, power up
   the router and keep button pressed for around 6-7 seconds, until
   device starts downloading the file.
 - Router will download file from server, write it to flash and reboot.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
6 years agotools/firmware-utils: mktplinkfw2: allow parameter override
Thibaut VARENE [Fri, 28 Jul 2017 10:59:42 +0000 (12:59 +0200)]
tools/firmware-utils: mktplinkfw2: allow parameter override

This patch enables commandline override of board hw_ver and hw_ver_add

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
6 years agotools/firmware-utils: document reserved fields in mkchkimg
Thibaut VARENE [Sun, 30 Jul 2017 10:40:25 +0000 (12:40 +0200)]
tools/firmware-utils: document reserved fields in mkchkimg

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
6 years agofirmware-utils: mktplinkfw2: respect -e option when reading fw info
Rafał Miłecki [Sun, 23 Jul 2017 20:19:21 +0000 (22:19 +0200)]
firmware-utils: mktplinkfw2: respect -e option when reading fw info

When -e option it specified a corresponding flag is set in the
custom_board. By using custom_board as fallback -e option gets respected
for unknown boards.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
6 years agofirmware-utils: mktplinkfw2: fix info for images with LE kernel LA/EP
Rafał Miłecki [Sun, 23 Jul 2017 20:19:20 +0000 (22:19 +0200)]
firmware-utils: mktplinkfw2: fix info for images with LE kernel LA/EP

With this change endianness is also respected when reading firmware
info.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
6 years agofirmware-utils: mktplinkfw2: replace "endian_swap" field with "flags"
Rafał Miłecki [Sun, 23 Jul 2017 20:19:19 +0000 (22:19 +0200)]
firmware-utils: mktplinkfw2: replace "endian_swap" field with "flags"

This will allow adding more similar tricks needed by other hardware.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
6 years agofirmware-utils: tplink-safeloader: add support for TP-Link RE350
Alex Maclean [Mon, 3 Jul 2017 20:05:44 +0000 (21:05 +0100)]
firmware-utils: tplink-safeloader: add support for TP-Link RE350

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
6 years agofirmware-utils: drop mktplinkfw-kernel tool
Piotr Dymacz [Thu, 6 Jul 2017 16:26:23 +0000 (18:26 +0200)]
firmware-utils: drop mktplinkfw-kernel tool

As we can now use combined mode in "mktplinkfw" tool to generate the
same header/image, this tool is no longer needed.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agofirmware-utils: mktplinkfw: rework combined image option
Piotr Dymacz [Thu, 6 Jul 2017 14:34:47 +0000 (16:34 +0200)]
firmware-utils: mktplinkfw: rework combined image option

We use combined option in "mktplinkfw" tool for generating initramfs
kernel images and header for kernel inside "safeloader" image type (in
fact, only for TL-WR1043ND v4 at this moment).

There is also "mktplinkfw-kernel" tool, a stripped-down version, used
only for generating "simple" header, for safeloader image types.

This changes how "mktplinkfw" handles combined images (which then will
allow us to drop the stripped-down version of the tool):

- drop "ignore size" command line option (it was used only for combined
  images anyway)
- don't require "flash layout id" for combined images (we don't need and
  shouldn't limit size of the initramfs kernel and for kernels inside
  safeloader images, the "tplink-safeloader" tool does the size check)
- require kernel address and entry point in command line parameters for
  combined images (consequence of previous point)
- don't include md5 sum and firmware length values in header (they are
  needed only for update from vendor GUI and are ingored in case of
  initramfs and "tplink-safeloader" images)
- drop "fake" flash layout for TL-WR1043ND v4 as it's no longer needed

Also, adjust "mktplinkfw-combined" command in ar71xx/image/tp-link.mk to
match introduced changes in "mktplinkfw" tool.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agofirmware-utils: tplink-safeloader: add support for TL-WR902AC v1 US
Piotr Dymacz [Wed, 19 Jul 2017 20:12:07 +0000 (22:12 +0200)]
firmware-utils: tplink-safeloader: add support for TL-WR902AC v1 US

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agofirmware-utils: tplink-safeloader: fix Archer C60 factory image
Henryk Heisig [Fri, 30 Jun 2017 22:45:19 +0000 (00:45 +0200)]
firmware-utils: tplink-safeloader: fix Archer C60 factory image

This commit fixes build factory image for TP-Link Archer C60v1.
Size of partition "SupportList" is only 256 bytes, and can
contain only 3 entries.

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years agofirmware-utils: mktplinkfw2: use static board struct for custom values
Rafał Miłecki [Sun, 2 Jul 2017 21:09:46 +0000 (23:09 +0200)]
firmware-utils: mktplinkfw2: use static board struct for custom values

It seems simpler to store all custom (command line set) option values in
a struct identical to the predefined ones. It doesn't require:
1) Having so many global variables
2) Copying data from the predefined boards

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
6 years agofirmware-utils: mktplinkfw2: update firmware header
Rafał Miłecki [Sun, 2 Jul 2017 09:23:52 +0000 (11:23 +0200)]
firmware-utils: mktplinkfw2: update firmware header

1) Be consistent and use tabs
2) Drop FIXME from boot comments - some images use these fields normally

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
6 years agofirmware-utils: mktplinkfw: add option for endianness swap
Piotr Dymacz [Tue, 4 Jul 2017 13:40:43 +0000 (15:40 +0200)]
firmware-utils: mktplinkfw: add option for endianness swap

This adds command line option in "mktplinkfw" tool for endianness swap
in kernel load address and entry point fields. As in "mktplinkfw2" tool,
we will need this for little-endian targets, like "ramips".

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agofirmware-utils: mktplinkfw2: add missing options descriptions
Piotr Dymacz [Tue, 4 Jul 2017 11:26:40 +0000 (13:26 +0200)]
firmware-utils: mktplinkfw2: add missing options descriptions

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agoar71xx: add support for TP-Link TL-WR902AC v1
Piotr Dymacz [Sun, 2 Jul 2017 16:32:38 +0000 (18:32 +0200)]
ar71xx: add support for TP-Link TL-WR902AC v1

TP-Link TL-WR902AC v1 is a pocket-size, dual-band (AC750), successor of
TL-MR3020 (both devices use very similar enclosure, in same size). New
device is based on Qualcomm QCA9531 v2 + QCA9887. FCC ID: TE7WR902AC.

Specification:

- 650/391/216 MHz (CPU/DDR/AHB)
- 1x 10/100 Mbps Ethernet
- 1x USB 2.0 (GPIO-controlled power)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH
- 2T2R 2.4 GHz (QCA9531)
- 1T1R 5 GHz (QCA9887)
- 5x LED (GPIO-controlled), 2x button, 1x 3-pos switch
- UART pads on PCB (TP1 -> TX, TP2 -> RX, TP3 -> GND, TP4 -> 3V3, jumper
  resitors are missing on TX/RX lines)
- 1x micro USB (for power only)

Flash instructions:

Use "factory" image under vendor GUI.

Recovery instructions:

This device contains tftp recovery mode inside U-Boot. You can use it to
flash LEDE (use "factory" image) or vendor firmware.

1. Configure PC with static IP 192.168.0.66/24 and tftp server.
2. Rename "lede-ar71xx-generic-tl-wr902ac-v1-squashfs-factory.bin"
   to "wr902acv1_un_tp_recovery.bin" and place it in tftp server dir.
3. Connect PC with LAN port, press the reset button, power up the router
   and keep button pressed until WPS LED lights up.
4. Router will download file from server, write it to flash and reboot.

Root access over serial line in vendor firmware: root/sohoadmin.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agofirmware-utils: mktplinkfw2: fix MD5 salt
Rafał Miłecki [Sun, 2 Jul 2017 15:06:58 +0000 (17:06 +0200)]
firmware-utils: mktplinkfw2: fix MD5 salt

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@milecki.pl>
Acked-by: Mathias Kresin <dev@kresin.me>
6 years agofirmware-utils: mktplinkfw2: fix support for -w option
Rafał Miłecki [Sun, 2 Jul 2017 20:28:24 +0000 (22:28 +0200)]
firmware-utils: mktplinkfw2: fix support for -w option

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@milecki.pl>
6 years agoramips: add support for TP-Link TL-WR840N v4 and TL-WR841N v13
Piotr Dymacz [Wed, 21 Jun 2017 12:16:15 +0000 (14:16 +0200)]
ramips: add support for TP-Link TL-WR840N v4 and TL-WR841N v13

TP-Link TL-WR840N v4 and TL-WR841N v13 are simple N300 routers with
5-port FE switch and non-detachable antennas. Both are very similar
and are based on MediaTek MT7628NN (aka MT7628N) WiSoC.

The difference between these two models is in number of available
LEDs, buttons and power input switch.

This work is partially based on GitHub PR#974.

Specification:

- MT7628N/N (580 MHz)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH
- 2T2R 2.4 GHz
- 5x 10/100 Mbps Ethernet
- 2x external, non-detachable antennas
- UART (J1) header on PCB (115200 8n1)
- TL-WR840N v4: 5x LED (GPIO-controlled), 1x button
- TL-WR841N v13: 8x LED (GPIO-controlled*), 2x button, power input
  switch

* WAN LED in TL-WR841N v13 is a dual-color, dual-leads type which isn't
  (fully) supported by gpio-leds driver. This type of LED requires both
  GPIOs state change at the same time to select color or turn it off.
  For now, we support/use only the green part of the LED.

Factory image notes:

These devices use version 3 of TP-Link header, fortunately without RSA
signature (at least in case of devices sold in Europe). The difference
lays in the requirement for a non-zero value in "Additional Hardware
Version" field. Ideally, it should match the value stored in vendor
firmware header on device ("0x4"/"0x13" for these devices) but it seems
that anything other than "0" is correct.

We are able to prepare factory firwmare file which is accepted and
(almost) correctly flashed from the vendor GUI. As it turned out, it
accepts files without U-Boot image with second header at the beginning
but due to some kind of bug in upgrade routine, flashed image gets
corrupted before it's written to flash.

Tests showed that the GUI upgrade routine copies value of "Additional
Hardware Version" from existing firmware into offset "0x2023c" in
provided file, _before_ storing it in flash. In case of vendor firmware
upgrade files (which all include U-Boot image and two headers), this
offset points to the matching field in kernel+rootfs firmware part
header. Unfortunately, in case of LEDE factory image file which contains
only one header, it points to the offset "0x2023c" in kernel image. This
leads to a corrupted kernel and ends up with a "soft-bricked" device.

The good news is that U-Boot in these devices contains well known tftp
recovery mode, which can be triggered with "reset" button. What's more,
in comparison to some of older MediaTek based TP-Link devices, this
recovery mode doesn't write whole file at offset "0x0" in flash, without
verifying provided file in advance. In case of recovery mode in these
devices, first "0x20000" bytes are always skipped and "0x7a0000" bytes
from rest of the file are stored in flash at offset "0x20000".

Flash instruction:

Until (if at all) TP-Link fixes described problem, the only way to flash
LEDE image in these devices is to use tftp recovery mode in U-Boot:

1. Configure PC with static IP 192.168.0.66/24 and tftp server.
2. Rename "lede-ramips-mt7628-tl-wr84...-squashfs-tftp-recovery.bin"
   to "tp_recovery.bin" and place it in tftp server directory.
3. Connect PC with one of LAN ports, press the reset button, power up
   the router and keep button pressed for around 6-7 seconds, until
   device starts downloading the file.
4. Router will download file from server, write it to flash and reboot.

To access U-Boot CLI, keep pressed "4" key during boot.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years agofirmware-utils: mktplinkfw2: support additional hardware version
Piotr Dymacz [Wed, 21 Jun 2017 12:15:55 +0000 (14:15 +0200)]
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@gmail.com>
6 years agoar71xx: add support for TP-Link Archer C58 v1
Henryk Heisig [Fri, 16 Jun 2017 13:26:30 +0000 (15:26 +0200)]
ar71xx: add support for TP-Link Archer C58 v1

TP-Link Archer C58 v1 is a dual-band AC1350 router, based on Qualcomm
QCA9561 + QCA9886. It looks like Archer C59 v1 without USB port.

Specification:

- 775/650/258 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- 6x LED, 3x button
- UART header on PCB, RX, TX at TP4+5 (backside)

QCA9886 wlan needs pre_cal_data file and enable ieee80211 phy hotplug to
patch macaddress.

Flash instruction:

Use "factory" image directly in vendor GUI.

Recovery method:

1. Set PC to fixed ip address 192.168.0.66/24.
2. Download "lede-ar71xx-generic-archer-c58-v1-squashfs-factory.bin" and
   rename it to "tp_recovery.bin".
3. Start a tftp server with the file "tp_recovery.bin" in its root
   directory.
4. Turn off the router.
5. Press and hold Reset button.
6. Turn on router with the reset button pressed and wait ~15 seconds.
7. Release the reset button and after a short time the firmware should
   be transferred from the tftp server.
8. Wait ~30 second to complete recovery.

Flash instruction under U-Boot, using UART:

tftp 0x81000000 lede-ar71xx-...-sysupgrade.bin
erase 0x9f020000 +$filesize
cp.b $fileaddr 0x9f020000 $filesize
reset

This commit is based on GitHub PR#1112

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years agofirmware-utils: tplink-safeloader: add support for Archer C5 v2 JP/US
Jean-Pierre St-Yves [Tue, 27 Jun 2017 08:20:19 +0000 (10:20 +0200)]
firmware-utils: tplink-safeloader: add support for Archer C5 v2 JP/US

Add support for Japan and US versions of TP-Link Archer C5 v2

Signed-off-by: Jean-Pierre St-Yves <jpstyves@gmail.com>
6 years agofirmware-utils: tplink-safeloader: add support for Archer C59/C60 RU
Henryk Heisig [Wed, 14 Jun 2017 14:38:30 +0000 (16:38 +0200)]
firmware-utils: tplink-safeloader: add support for Archer C59/C60 RU

Add support for Russian version of TP-Link Archer C59/C60 v1

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years agoar71xx: add support for TP-Link TL-WA855RE v1
Federico Cappon [Fri, 9 Jun 2017 15:11:39 +0000 (15:11 +0000)]
ar71xx: add support for TP-Link TL-WA855RE v1

TP-Link TL-WA855RE v1 is a wall-plug N300 Wi-Fi range extender,
based on Qualcomm/Atheros QCA9533 v2.

Short specification:

- 550/397/198 MHz (CPU/DDR/AHB)
- 1x 10/100 Mbps Ethernet
- 32 MB of RAM (DDR1)
- 4 MB of FLASH
- 2T2R 2.4 GHz
- 2x external antennas
- 2x LED (green and orange in the same package), 2x button
- UART: TP5(TX) and TP4(RX) test points on PCB

Flash instruction: use "factory" image directly in vendor GUI.

Warning: this device does not include any kind of recovery mechanism
in the bootloader and disassembling process is not trivial.

You can access vendor firmware over serial line using:
- login: root
- password: sohoadmin

Image was tested only in EU version of the device, but should work
also with the same device version sold in other countries.

Signed-off-by: Federico Cappon <dududede371@gmail.com>
6 years agofirmware-utils: fix dgn3500sum compiler warnings
Mathias Kresin [Mon, 26 Jun 2017 17:22:52 +0000 (19:22 +0200)]
firmware-utils: fix dgn3500sum compiler warnings

The sum variable need to be initialised, otherwise it will points to
random stack memory and a bogus image checksum might be calculated.

While at it, fix the segfault in case the product region code isn't
specified and enable compiler warnings which had revealed all the code
issues.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years agofirmware-utils: honor env SOURCE_DATE_EPOCH
Alexander Couzens [Sun, 18 Jun 2017 00:21:21 +0000 (02:21 +0200)]
firmware-utils: honor env SOURCE_DATE_EPOCH

Use the timestamp from the enviroment SOURCE_DATE_EPOCH
if set instead of the build time.
Fixes reproducible builds for certain firmware images.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>