Commit Graph

1459 Commits (3c77e4ae4d97ec14daeabfab12ec8b451184d0d6)

Author SHA1 Message Date
Hauke Mehrtens 07e8c217cb tools: patch: make patch build depend on automake
The Makefile.am changed and now patch wants to use automake to
regenerate the Makefile.in. Make sure automake was build before we build
patch.

This fixes build problem seen by the build bots.
Fixes: 4797dddfde ("patch: apply upstream cve fixes")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years ago
Russell Senior 4797dddfde patch: apply upstream cve fixes
Apply two upstream patches to address two CVEs:

 * CVE-2018-1000156
 * CVE-2018-6952

Add PKG_CPE_ID to Makefile.

Build tested on apm821xx and ar71xx.

Signed-off-by: Russell Senior <russell@personaltelco.net>
6 years ago
Tobias Schramm 8f697e406a 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>
6 years ago
Daniel Engberg f6159c1e37 tools/cmake: Update to 3.12.3
Update CMake to 3.12.3

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg 9efd0cb403 tools/bison: Update to 3.1
Update bison to 3.1

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg 6bdc6cdd04 tools/libressl: Update to 2.8.1
Update libressl to 2.8.1

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg 7808ba86ea tools/mtools: Update to 4.0.19
Update mtools to 4.0.19

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Felix Fietkau 03c7c8c853 tools/e2fsprogs: fix build with clang
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Marko Ratkaj 6e80dd58bb tools/expat: fix docbook2man error on some systems
On some systems (Gentoo) configure stage fails because of docbook2man
working with SGML rather than with XML. We don't need xmlwf man pages so
we disable this.

Signed-off-by: Marko Ratkaj <marko.ratkaj@sartura.hr>
6 years ago
Daniel Engberg 3e734e822b tools/expat: Update to 2.2.6
Update (lib)expat to 2.2.6

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg c6a0d57ca9 tools/e2fsprogs: Update to 1.44.4
Update e2fsprogs to 1.44.4

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
INAGAKI Hiroshi 7a67b437e7 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>
6 years ago
Daniel Engberg 791a3a22ad tools/cmake: Update to 3.12.2
Update CMake to 3.12.2

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
David Bauer 8e9a59a6b9 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>
6 years ago
Ryan Mounce 9c6c7d11c7 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>
6 years ago
Andy Walsh 22b8237ba1 firmware-utils/mksercommfw: fix musl build
* add missing <sys/types.h> for musl

Signed-off-by: Andy Walsh <andy.walsh44+github@gmail.com>
6 years ago
Daniel Engberg 0578993a41 tools/cmake: Update to 3.12.1
Update cmake to 3.12.1

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Ludwig Thomeczek e5b802b9c2 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>
6 years ago
Luis Araneda caebb77b45 tools: findutils: fix compilation with glibc 2.28
Add a temporary workaround to compile with glibc 2.28
as some constants were removed and others made private

Signed-off-by: Luis Araneda <luaraneda@gmail.com>
6 years ago
Luis Araneda 8ae8489986 tools: m4: fix compilation with glibc 2.28
Add a temporary workaround to compile with glibc 2.28
as some constants were removed and others made private

Signed-off-by: Luis Araneda <luaraneda@gmail.com>
6 years ago
Andrew Cameron bae927c551 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>
6 years ago
Keith Maika 4caab80830 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>
6 years ago
Daniel Engberg b078229412 tools/cmake: Update to 3.12.0
Update cmake to 3.12.0
Remove 140-curl-fix-libressl.patch as fix is in upstream

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg df5f914b83 tools/e2fsprogs: Update to 1.44.3
Update e2fsprogs to 1.44.3

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Mathias Kresin a07e1126bc tools: kernel2minor: update to latest version
9fa9190 create reproducible images

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Hannu Nyman 7ec931b7f0 tools/ccache: update to 3.4.2
update version and refresh patch

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Hannu Nyman 55fa8068c4 tools/cmake: update to 3.11.4
Update cmake and refresh patches.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Hyeonsik Song c2766270ef firmware-utils: tplink-safeloader: add calloc error handling
Signed-off-by: Hyeonsik Song <blogcin@naver.com>
6 years ago
Peter Lundkvist 781ad46206 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>
6 years ago
Lucian Cristian 4ec9763ee9 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>
6 years ago
Alex Maclean 97da92b127 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>
6 years ago
Alex Maclean 408c54b02f 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>
6 years ago
Alex Maclean 0a2f21fa71 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>
6 years ago
Adrian Schmutzler 5c5bf8b865
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>
6 years ago
Arvid E. Picciani bf39d5594b 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>
6 years ago
Krystian Kozak 142477e751 b43-tools: update to latest git HEAD
122ca37 Rename bits in hostflags to match new identifiers for the hostflags
32c2a3c Change order of identifiers to be ascending with the spr numbers
f7016b5 Remove definitions which are not Broadcom specific
b77c0a3 debug: Fix ordering of HF bits
3f46e61 fwcutter: Add firmware 9.10.178.27
27892ef fwcutter/make: Avoid _DEFAULT_SOURCE warning

Signed-off-by: Krystian Kozak <krystian.kozak20@gmail.com>
6 years ago
Lucian Cristian 71ae0792ba 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>
6 years ago
Zoltan HERPAI 3e0489dcd9 tools: build squashfs (v3) for ath79
Certain Netgear and AVM devices use BE squashfs for the kernel image. As
squashfs4 only supports creating LE images, add squashfs (v3) into
the tools to be built for ath79.

Trying to use an LE squashfs (thus trying to use squashfs4 only for
building the image) for the kernel image results in the bootloader
barfing and stopping.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
6 years ago
Daniel Engberg df02e7a3c7 tools/bison: Update to 3.0.5
Update bison to 3.0.5
Bugfix release
Remove 001-fix-macos-vasnprintf.patch as it is fixed upstream

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg 651a62353b tools/e2fsprogs: Update to 1.44.2
Update e2fsprogs to 1.44.2

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Krystian Kozak 0e9927d157 sparse: updated to version 0.5.2
Updated to latest stable release

Signed-off-by: Krystian Kozak <krystian.kozak20@gmail.com>
6 years ago
Krystian Kozak c844d6a8e4 imx-uuc: updated to latest git HEAD
8e29d86 linuxrc: remove superfluous shebang line
12d2045 gitignore: remove Windows stuff
57d8969 Add travis hint
8edf4cc sdimage: use fsync before closing the device (fixes #1)
d395b31 uuc: fix some compiler warnings

Signed-off-by: Krystian Kozak <krystian.kozak20@gmail.com>
6 years ago
Jo-Philipp Wich 4da832e201 tools: zlib: do not hardcode the install prefix in zlib.pc
Our pkg-config wrapper relies on the ability to redefine the $prefix and
$exec_prefix variables in order to construct proper search paths relative
to the build environment.

Patch the .pc file template to construct libdir, sharedlibdir and includedir
relative to the ${prefix} variable so that it can be overridden as needed.

This also fixes the libxml2/host build issue raised at
https://github.com/openwrt/packages/issues/6073 - it was caused by libxml2's
configure picking up a wrong host search path through zlib.pc, letting it
include the wrong endian.h, causing spurious member redeclaration errors in
system headers.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Stefan Lippers-Hollmann b72b36653a 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 ago
Daniel Engberg bc5283381c tools/cmake: Update to 3.11.1
Update cmake to 3.11.1

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg 93959bd86d tools/xz: Update to 5.2.4
Update to 5.2.4
Remove FreeBSD fix as it's not needed
Disable docs

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg 0f5e01b691 tools/mm-macros: Update to 0.9.12
Update mm-macros to 0.9.12

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg 2d913fc48d tools/sed: Update to 4.5
Update sed to 4.5

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Linus Walleij 20d0dace40 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 ago
Felix Fietkau 56ae9f9b0b mtd-utils: add back macOS compatibility code that was dropped during the update
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Hauke Mehrtens 60427a940f tools/make-ext4fs: Fix build on MacOSX
MacOSX does not support "-Wl,-Bstatic" so do not force the static
linking.
We only copy the static libz library into the staging libraries
directories, the linker will anyway only find the static version and
link against that on all systems.

Fixes: 8dcd941d8b ("tools/zlib: move zlib build to tools")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years ago
Hauke Mehrtens 2c192b6916 tools/libressl: update to version 2.7.2
Libressl version 2.7.0 and later implement more of the OpenSSL 1.1 API
and this needs some modifications of the code using it.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years ago
Hauke Mehrtens c7cd166479 tools/mtd-utils: update to version 2.0.2
This version now uses autotools to configure the build system. They are
also using the newly added zlib package.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Hauke Mehrtens bf167f8a9a tools/mtd-utils: Mark some lzma functions as static
These functions are not declared in any header file and only used in
same compile unit, mark them as static to remove one gcc warning and
make it easier for the compiler to optimize them out.

This also fixes some style problems to make this patch match the version
in the packages folder.

This is copied from this commit to the mtd-utils we pack into the image:
56d0dd56e9 ("mtd-utils: Mark some lzma functions as static")

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Hauke Mehrtens 8dcd941d8b tools/zlib: move zlib build to tools
This allows us to link the other tools against our libz and we do not
need the system zlib any more.

Only the static linked library is copied to the staging directory so we
have a statically linked library on all systems and not only on Linux.
This also adds the new dependencies of the packages which are depending
on zlib.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Alex Maclean a31107a97a 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 ago
Jo-Philipp Wich a656ea0bdb tools: mkimage: provide dtc path during build
The new mkimage version requires a CONFIG_MKIMAGE_DTC_PATH variable to be
provided during build, in order to hardcode a path to a suitable DT
compiler executable.

Failure to do so will result in stray "sh: 1: -I: not found" errors when
invoking mkimage for FIT image generation.

Fix the issue by supplying "dtc" as CONFIG_MKIMAGE_DTC_PATH value during
build. As we intend our host utilities to be relocatable and since we're
already overriding PATH when invoking mkimage, an absolute path is not
required.

Fixes: b13e981d72 ("tools/mkimage: update to version 2018.03")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Hauke Mehrtens b13e981d72 tools/mkimage: update to version 2018.03
This activates support for fit images and some other new mkimage
features. Some of the patches were applied upstream and could be
removed.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years ago
Daniel Engberg 85282ae69c tools/mpfr: Update to 4.0.1
Update mpfr to 4.0.1

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Daniel Engberg a8c315192b tools/cmake: Update to 3.11.0
Update cmake to 3.11.0
Remove 110-alpine_musl-compat.patch as it's integrated upstream
Rename and refresh patches

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Matthias Schiffer e39847ea2f
ar71xx: increase kernel partition size for CPE/WBS 210/510
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 373dc11b51
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 ago
Henryk Heisig c0742307a1 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 ago
Nicolò Veronese 0d8a0a6a17
firmware-utils: image generator for D-Link DAP-1330
Signed-off-by: Nicolò Veronese <nicveronese@gmail.com>
6 years ago
Paul Wassi 8262179f4a tools/e2fsprogs: update to 1.44.1
Update e2fsprogs to upstream 1.44.1 (feature and bugfix release)

Signed-off-by: Paul Wassi <p.wassi@gmx.at>
6 years ago
Mathias Kresin 9fc916a40c firmware-utils: mkdlinkfw: compile as gnu99
Compile as gnu99 to fix the build.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Pawel Dembicki 84c1b786b9 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 ago
Alexander Couzens 3137622efb
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 ago
Jo-Philipp Wich 677d8df9b8 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 ago
Alexander Couzens 068ba612db
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 ago
Alexander Couzens 638e2193fe 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 ago
Ansuel Smith a9c00578b5 e2fsprogs: bump to 1.44.0
Fix compilation error

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
6 years ago
Evgeniy Didin 063fa4cfa2 tools/mkimage: copy mkenvimage to bin directory
For some boards u-boot binary environment file is required,
which is generated by mkenvimage utility. But in OpenWrt there
is no separate support for mkenvimage, which is a part of u-boot tools.
mkenvimage gets built in u-boot/tools as well as mkimage anyways.

So lets just copy mkenvimage to the $(STAGING_DIR_HOST)/bin/ directory.

Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
CC: Alexey Brodkin <abrodkin@synopsys.com>
CC: Hauke Mehrtens <hauke@hauke-m.de>
CC: John Crispin <john@phrozen.org>
6 years ago
Henryk Heisig a338491a30 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 ago
Russell Senior 89a0fed2a2 tools: update patch to v2.7.6
Removes a redundant patch with a fix already upstream.  Build tested on
apm821xx (PPC).

Signed-off-by: Russell Senior <russell@personaltelco.net>
6 years ago
Hannu Nyman 64858a0e25 tools/ccache: update to 3.3.6
Update ccache to 3.3.6

Release notes:
https://ccache.samba.org/releasenotes.html#_ccache_3_3_6

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Hannu Nyman e787ad5c96 tools/tar: update to 1.30
update GNU tar to 1.30

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Serg Studzinskii eb58b14d27 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 ago
Hannu Nyman 4343ac5515 tools/mpfr: update to 4.0.0
Update mpfr to 4.0.0

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Hannu Nyman d0610332dc tools/mpc: Update to 1.1.0
Update mpc to 1.1.0

(note: adds compatibility with mpfr 4.0.0)

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Hannu Nyman 3c4df661c0 tools/cmake: update to 3.10.1
Update cmake to 3.10.1
Refresh patches

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Hannu Nyman b0d513ec91 tools/scons: update to 3.0.1
Update scons to 3.0.1

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Hannu Nyman b4a46f0764 tools/libressl: update to 2.6.4
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
6 years ago
Jo-Philipp Wich ebd15471ea tools: make-ext4fs: remove LEDE_GIT references
Change the make-ext4fs Makefile to use the common PROJECT_GIT
variable instead.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Michael Heimpold 498285922e firmware-tools/ptgen: use portable exit codes
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
6 years ago
Michael Heimpold 83f729dfb2 firmware-tools/ptgen: fix minor coding style issues
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
6 years ago
Daniel Engberg 3be10e3a30 tools/expat: Update to 2.2.5
Update (lib)expat to 2.2.5

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
6 years ago
Henryk Heisig 3083cc6acf firmware-utils: mktplinkfw: add support for BR region code
Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years ago
Sergey Ryazanov 1a51241cb1 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: 29a2c2ea80 (add ability to put
jffs2 eof marker into the image)

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Rosen Penev d6e34b7352 tools/sstrip: Fix compile under standard linux.
bswap32 undefined is the issue. Added the proper header. Also fixed a few format/conversion warnings that clang complained about without -Wall or -Wextra.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
6 years ago
Rosen Penev 08cc9a2ca8 tools/e2fsprogs: Update to 1.43.7
Compile tested on Fedora 27.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
7 years ago
Rafał Miłecki fb66dc9b03 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>
7 years ago
Alexander Couzens c61a239514
add PKG_CPE_ID ids to package and tools
CPE ids helps to tracks CVE in packages.
https://cpe.mitre.org/specification/

Thanks to swalker for CPE to package mapping and
keep tracking CVEs.

Acked-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
7 years ago
Tim Thorpe 673793d753 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>
7 years ago
Dmitry Tunin 3ad5c161f4 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>
7 years ago
Piotr Dymacz 55c77b3d3c 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>
7 years ago
Henryk Heisig ca6002c0ef 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>
7 years ago
Felix Fietkau 6bcc1c5331 tools/coreutils: install readlink
Parts of the build system use non-portable invocation of readlink

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Robert Marko d0ef27594a 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>
7 years ago
Thibaut VARÈNE 050fb3b55c 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>
7 years ago
Alex Maclean 4425fa84da tools/squashfs4: include sysmacros.h explicitly
glibc is moving to remove the include of sys/sysmacros.h from
sys/types.h, and some distros have done this early. Other libcs may
already lack this include. Include sysmacros.h explicitly.

Fixes: FS#1017

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
[refresh patches]
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Alex Maclean 09bfca653c tools/squashfs: include sysmacros.h explicitly
glibc is moving to remove the include of sys/sysmacros.h from
sys/types.h, and some distros have done this early. Other libcs may
already lack this include. Include sysmacros.h explicitly.

Fixes: FS#1018

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
7 years ago
Alex Maclean 855d210f65 tools/mtd-utils: include sysmacros.h explicitly
glibc is moving to remove the include of sys/sysmacros.h from
sys/types.h, and some distros have done this early. Other libcs may
already lack this include. Include sysmacros.h explicitly.

Fixes: FS#1015

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
[refresh patches]
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Alex Maclean 4a5de1f430 tools/findutils: include sysmacros.h explicitly
glibc is moving to remove the include of sys/sysmacros.h from
sys/types.h, and some distros have done this early. Other libcs may
already lack this include. Include sysmacros.h explicitly.

Fixes: FS#1016

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
7 years ago
Felix Fietkau 20d363aed3 tools/squashfs: use host cflags
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 9887afb1af 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>
7 years ago
Thibaut VARÈNE 9e768b9aac 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>
7 years ago
Thibaut VARÈNE 10324fcb39 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>
7 years ago
Thibaut VARÈNE 10832c8e12 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>
7 years ago
Felix Fietkau 90805b16b6 cmake: fix build error with Xcode 9 on macOS 12
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Jo-Philipp Wich 64da598c8f tools: cmake: fix librt linking (FS#1032)
Commit 839129b864 "tools/cmake: Update to 3.9.3" improperly rebased the
librt linking patch, causing FS#381 to resurface.

Fixes FS#1032.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Daniel Engberg a4ec0aa527 tools/mm-macros: Update to 0.9.11
Update mm-macros to 0.9.11

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg 85d93b67af tools/mpfr: Update to 3.1.6
Update mpfr to 3.1.6

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg 839129b864 tools/cmake: Update to 3.9.3
Update CMake to 3.9.3
Remove FreeBSD patch (not needed)
Rearrage and update patches

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Marko Ratkaj 0fb14a2b1a tools: flex: fix segfault with glibc 2.26+
Fix segmentation fault caused by implicit declaration of function 'reallocarray'. Added patch will enable
reallocarray() prototype in glibc 2.26+ on Linux systems. This fix will be included in flex 2.6.5.

Fixes LEDE issue: FS#1003 (Flex does not build with GCC 7.2)

Signed-off-by: Marko Ratkaj <marko.ratkaj@sartura.hr>
7 years ago
Daniel Engberg ed617fd8f2 tools/e2fsprogs: Update to 1.43.6
Update e2fsprogs to 1.43.6
* Remove FreeBSD patch as it's not needed, FreeBSD 9.1 is EoL and this
  is compiling on FreeBSD 11.1.
* Remove libmagic patch, RHEL 5 is EoL (End of Production Phase) since
  March 31, 2017.

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg b0f26243fe tools/expat: Update to 2.2.4
Update (lib)expat to 2.2.4

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Maxim Anisimov 161a3be5ad 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>
7 years ago
Thibaut VARENE 66a8c8f04c 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>
7 years ago
Ryan Mounce 25c045763a tools: patch various gnu tools for macOS 10.13
These host tools compile but may crash at runtime when building on
macOS 10.13 (High Sierra). Backport upstream gnulib patch until new
releases of affected tools.

https://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00056.html
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c41f233c4c38e84023a16339782ee306f03e7f59

Signed-off-by: Ryan Mounce <ryan@mounce.com.au>
7 years ago
Marty Plummer 9ebb23cf51 tools/mkimage: fix musl build
Taken from: http://git.denx.de/?p=u-boot.git;a=commit;h=26e355d131a6b56ea78a156c1cee4f6ba0500b37

Signed-off-by: Marty Plummer <ntzrmtthihu777@gmail.com>
7 years ago
Daniel Engberg 965df21fd1 tools/pkg-config: Update to 0.29.2
* Update pkg-config to 0.29.2
* Remove patch as it's upstreamed

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg 1a5b7cc151 tools/expat: Update to 2.2.3
Update (lib)expat to 2.2.3
Remove poor entropy hack, 2.2.3 uses /dev/urandom in worst case

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg 8477d54545 tools/e2fsprogs: Update to 1.43.5
Update e2fsprogs to 1.43.5

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Thibaut VARENE b70a96285c tools/firmware-utils: document reserved fields in mkchkimg
Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
7 years ago
Rafał Miłecki 993c740255 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>
7 years ago
Rafał Miłecki 35ddef8455 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>
7 years ago
Rafał Miłecki d181cbbfb0 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>
7 years ago
Alex Maclean 1c7144f078 firmware-utils: tplink-safeloader: add support for TP-Link RE350
Signed-off-by: Alex Maclean <monkeh@monkeh.net>
7 years ago
Piotr Dymacz d72371e42b 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>
7 years ago
Piotr Dymacz b3cb0e7588 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>
7 years ago
Piotr Dymacz 5bc5d94549 firmware-utils: tplink-safeloader: add support for TL-WR902AC v1 US
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
7 years ago
Jo-Philipp Wich 7c727c6fa4 tools: expat: fix build on older host systems
Expat release 2.2.2 requires support for either syscall(SYS_getrandom) which
is available on Linux 3.17 or support for getrandom() which is only available
in glibc 2.25 or later.

Since some of our builders still run on Linux 3.16, we need to forcibly
disable the use of getrandom() for the host builds.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Ted Hess b4ce088f06 tools/expat: Update host version to 2.2.2
Ref: CVE-2017-9233, CVE-2016-9063

Signed-off-by: Ted Hess <thess@kitschensync.net>
7 years ago
Hauke Mehrtens 027aea8af7 tools/flex: Revert "tools/flex: add autoreconf"
This was already done in commit 91e262c6b3 ("tools: flex: fix build
with automake 1.15.1")

This reverts commit 6b127d8639.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Henryk Heisig 8cd28140f1 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>
7 years ago
Rafał Miłecki 7805745791 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>
7 years ago
Rafał Miłecki 90e27a185f 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>
7 years ago
John Crispin 6b127d8639 tools/flex: add autoreconf
build blows up on latest debian due to automake mismatch

Signed-off-by: John Crispin <john@phrozen.org>
7 years ago
Jo-Philipp Wich 91e262c6b3 tools: flex: fix build with automake 1.15.1
After the update of GNU automake, the flex configure fails with

    configure.ac:31: error: version mismatch.  This is Automake 1.15.1,
    configure.ac:31: but the definition used by this AM_INIT_AUTOMAKE
    configure.ac:31: comes from Automake 1.15.

Apply the autoreconf host fixup to properly regenerate configure before
to avoid triggering the version mismatch. Also refresh the patch while
we're at it.

Fixes FS#885.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Thomas Langer eafaef3765 automake: Update to version 1.15.1
The new version includes the fix for new perl versions,
so remove the related patch.

Signed-off-by: Thomas Langer <thomas.langer.71@gmail.com>
7 years ago
Piotr Dymacz a3d232e1e6 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>
7 years ago
Piotr Dymacz 3b7928cc9d firmware-utils: mktplinkfw2: add missing options descriptions
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
7 years ago
Piotr Dymacz 6165e4aab0 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>
7 years ago
Rafał Miłecki 23da3fbf68 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>
7 years ago
Rafał Miłecki 896246b8c5 firmware-utils: mktplinkfw2: fix support for -w option
This fixes copy & paste typo when reading -w argument.

Fixes: 4b35e174ca ("firmware-utils: mktplinkfw2: support additional hardware version")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years ago
Piotr Dymacz 24043a0d2e 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>
7 years ago
Piotr Dymacz 4b35e174ca 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>
7 years ago
Henryk Heisig b05c7193fd 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>
7 years ago
Jean-Pierre St-Yves 01280bc8dc 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>
7 years ago
Henryk Heisig 7d21b4eed0 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>
7 years ago
Federico Cappon 9fec39a033 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>
7 years ago
Mathias Kresin 06741411e0 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>
7 years ago
Alexander Couzens b5aaafe9a3
mtd-utils/mkfs.jffs2: honor env SOURCE_DATE_EPOCH
Use the timestamp from the enviroment SOURCE_DATE_EPOCH
if set instead of the build time.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
7 years ago
Alexander Couzens c47a1a3527 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>
7 years ago
Ludwig Thomeczek 9cd69c45c5 firmware-utils: tplink-safeloader: add TP-Link Archer C25 v1
This adds the necessary firmware layout definitions for the Archer C25.
It has an addtional partition containing some static data ("extra-para")
without which no factory flash is possible, therefore put_data() has been
added.

Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
7 years ago
Serg Studzinskii b7cc661615 ar71xx: add support for TP-Link TL-WR942N v1
TP-Link TL-WR942N v1 is a 2.4 GHz single-band N450 router, based on
Qualcomm/Atheros QCA9561.

Specification:

- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 5x 10/100 Mbps Ethernet
- 2x USB 2.0
- 11x LED (most are controlled by 74HC595)
- 2x button
- UART header on PCB*

* Serial console is disabled in OEM non-beta firmwares and corresponding
  GPIO pins 14 and 15 are assigned to control USB1 and USB2 LEDs by
  production (non-beta) U-Boot and firmware.

Currently not working:

1. USB1 and USB2 LEDs if UART RX and TX pins are assigned to their GPIOs
   by some U-Boot versions.

Flash instruction under vendor GUI:

1. Download "lede-ar71xx-generic-tl-wr942n-v1-squashfs-factory.bin".
2. Go to WEB interface and perform usual firmware upgrade.

FLash instruction under U-Boot recovery mode (doesn't work in beta
firmware):

1. Setup PC with static IP "192.168.0.66/24" and tftp server.
2. Change "*-factory" image filename to "WR942v1_recovery.bin" and make
   it available to download from your tftp server.
3. Press "reset" button and power up the router, wait till "WPS" LED
   turns on.

Flash instruction under U-Boot, using UART (can be done only with
preinstalled UART-enabled U-Boot version!):

1. Use "tpl" to stop autobooting and obtain U-Boot CLI access.
2. Setup ip addresses for U-Boot and your tftp server.
3. Issue below commands:
   tftp 0x81000000 lede-ar71xx-generic-tl-wr942n-v1-sysupgrade.bin
   erase 0x9f020000 +$filesize
   cp.b 0x81000000 0x9f020000 $filesize
   reset

Signed-off-by: Serg Studzinskii <serguzhg@gmail.com>
[minor code style fixes, extended commit message]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
7 years ago
Jan Niehusmann c4022243d8 firmware-utils: tplink-safeloader: support strings as soft_version
Some TP-Link routers (C25, C59, C60) contain a version string instead
of a binary structure in the soft_version partition.

Flashing LEDE from the original firmware's GUI, this version string
taken from the soft_ver partition of the firmware image is written to
the router's config partition.

When using tftp recovery to go back to the original Archer C25 firmware,
a version check compares that version to the version of the firmware to
be flashed.

Without proper contents in the config partition, reverting to the
original firmware fails.

Therefore, write the string "soft_ver:1.0.0\n" to that soft_ver
partition.

Signed-off-by: Jan Niehusmann <jan@gondor.com>
7 years ago
Daniel Golle 92c80f38cf automake: import upstream fix for perl 5.26
Build broke as distributions now include Perl 5.26 and automake
triggered an "Unescaped left brace in regex" error.
Import upstream commit 13f00eb449 to fix that.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
7 years ago
Felix Fietkau e25cedd0b5 tar: override symlink permissions
On Linux, symlink permissions cannot be altered and are always 0777.
On Mac OS X they can be 0755. Force 0777 here to keep tarballs
reproducible across systems

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Daniel Engberg 9235a29e1a tools/sparse: Update to snapshot 2017-03-31
Update sparse to snapshot 2017-03-31
Switch to HTTPS

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Eric Luehrsen aeeb2faf88 flex: update to 2.6.4 (FS#809)
flex 2.6.3 has a bug which fails code generation and compile of some packages

Signed-off-by: Eric Luehrsen <ericluehrsen@hotmail.com>
7 years ago
Hannu Nyman d7a3120cdc tools/libressl: update to 2.5.4
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
7 years ago
Hannu Nyman 8040420b00 tools/flex: update to 2.6.3
* update flex to 2.6.3
* download .tar.gz (as upstream has dropped .xz)
* refresh patches

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
7 years ago
Hannu Nyman 1a0d52a733 tools/cmake: update to 3.8.1
* update cmake to 3.8.1
* refresh patches

Release notes:
https://cmake.org/cmake/help/v3.8/release/3.8.html

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
7 years ago
Syrone Wong a0f4b4b3a2 tools/isl: update to 0.18
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
7 years ago
Rosen Penev 74f9c9c159 tools: host/include/getline.h: Remove
Seems to be useful only for old and unsupported operating systems. Removed and adjusted the mtd-utils Makefile.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
7 years ago
Daniel Engberg 0685f2a66c tools/upx: Remove from repo
Remove upx from repo, it hasn't been used for a very long time and serves little to no purpose.

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg 80246ce67e tools/coreutils: Update to 8.27
Update coreutils to 8.27

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg e45ee66149 tools/libressl: Update to 2.5.1
Update libressl to 2.5.1

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg 49ded28027 tools/dosfstools: Update to 4.1
Update to 4.1
Remove 0001-mkfs-Default-to-64-32-heads-sectors-for-targets-smal.patch
as it's included in upstream repo.
Refresh patch

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Daniel Engberg 65d2800bd6 tools/sed: Update to 4.4
Update sed to 4.4

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
7 years ago
Kevin Darbyshire-Bryant 2cf00b640d ccache: update to 3.3.4
Update from 3.3.2 to 3.3.4 & refresh patches.

Remove 110-disable-assembler-support as ccache now understands the
'.incbin' directive.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
7 years ago
Rafał Miłecki dfac808076 firmware-utils: tplink-safeloader: add support for Archer C5 V2
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years ago
Etienne Haarsma d90abebd06 tools/m4: update 1.4.18
Patch 100-fix-gets-removal.patch is removed because it's included in the new version.

Signed-off-by: Etienne Haarsma <bladeoner112@gmail.com>
7 years ago
Furong Xu 8d53e3721c tools: patch-image: fix file descriptor leak.
Maybe this is committed by mistake, fix it.

Signed-off-by: Furong Xu <xfr@outlook.com>
7 years ago
Piotr Dymacz 56561b9f51 ar71xx: add support for TP-Link TL-WA850RE v2
TP-Link TL-WA850RE v2 is a wall-plug N300 Wi-Fi range extender,
based on Qualcomm/Atheros QCA9533 v2.

Short specification:

- 550/391/195 MHz (CPU/DDR/AHB)
- 1x 10/100 Mbps Ethernet
- 32 MB of RAM (DDR1)
- 4 MB of FLASH
- 2T2R 2.4 GHz
- 2x internal antennas (embedded on PCB)
- 9x LED (all can be turned off with GPIO15), 2x button
- UART (J3) header 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 US version of the device, but should work
also with the same device version sold in other countries.

Available FLASH space, with LEDE trunk, is only 240 KB.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
7 years ago
Etienne Haarsma 0928b6d2ab cmake: update to version 3.7.2
Signed-off-by: Etienne Haarsma <bladeoner112@gmail.com>
7 years ago
Daniel Engberg 34ba64fe70 tools/e2fsprogs: Update to 1.43.4
* Update to 1.43.4
* Refresh patches
* xz tarball which saves about 2M in size

Changelog: http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.43.4

Tested by Etienne Haarsma (ar71xx), Daniel Engberg (kirkwood)

Signed-off-by: Etienne Haarsma <bladeoner112@gmail.com>
Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
Signed-off-by: Felix Fietkau <nbd@nbd.name> [use @KERNEL instead of harcoded URL]
7 years ago
Hannu Nyman eaf3fef946 ccache, samba36: fix samba.org addresses to use https
samba.org has started to enforce https and
currently plain http downloads with curl/wget fail,
so convert samba.org download links to use https.

Modernise links at the same time.

Also convert samba.org URL fields to have https.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
7 years ago
FUKAUMI Naoki 7faee1bc9f firmware-utils: improve tools for Buffalo DHP series
some of Buffalo DHP series use slightly different trx magic, buffalo-enc,
buffalo-tag, and factory image begin with 'bgn'.

this patch adds support for building those images.

Signed-off-by: FUKAUMI Naoki <naobsd@gmail.com>
7 years ago
Stijn Tintel 456e1b6481 qemu: rename internal crypto/aes symbols
Qemu's local AES code defines symbols that conflict with
LibreSSL/OpenSSL's libcrypto. Rename them to avoid build problems.

See upstream commit c8d70e59738e672021926c7747af8ef9dea15c82.

Fixes FS#444.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Henryk Heisig e39dc8d823 ar71xx: add support to TP-Link Archer C59v1 and C60v1
TP-Link Archer C59v1 is a dual-band AC1350 router, based on Qualcomm/Atheros
QCA9561+QCA9886.

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
- 8x LED (controled by 74HC595), 3x button
- UART header on PCB

TP-Link Archer C60v1 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

Currently not working:
- Port LAN1 on C59, LAN4 on C60
- WiFi 5GHz (missing ath10k firmware for QCA9886 chip)
- Update from oficial web interface ( tplink-saveloader not support "product-info")

Flash instruction:
1. Set PC to fixed ip address 192.168.0.66
2. Download lede-ar71xx-generic-archer-cXX-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:

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

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
[Jo-Philipp Wich: remove duplicate ATH79_MACH_ARCHER_C59/C60_V1 entries]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Sergey Sergeev e2b8e9e0f3 tools: update kernel2minor to 0.24 version
Signed-off-by: Sergey Sergeev <adron@yapic.net>
7 years ago
John Crispin 920ee1f707 Revert "tools: wrt400n: fix making factory images with kernel bigger than 1MB"
This reverts commit 5f9b20bc7d.

The builders were failing with a segfault when generating the image

Signed-off-by: John Crispin <john@phrozen.org>
7 years ago
Yousong Zhou 5f9b20bc7d tools: wrt400n: fix making factory images with kernel bigger than 1MB
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
7 years ago
Felix Fietkau d98bb7e6b9 build: extend CONFIG_AUTOREMOVE to tools/
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 131db366a3 build: remove separate /install step for host builds
Reduces the number of recursive make invocations

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Alexandru Ardelean 2b84dfafa4 tools/qemu: use default host configure rule ; set appropriate vars & args
Admittedly, this is my own OCD wanting to get rid of this.

Because I tried (a while back to upgrade QEMU to a newer version),
and (during that attempt) I tried to get rid of this.

Tested on Linux & Mac.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years ago
Alexandru Ardelean 968fa53197 tools/cmake: remove HOST_CONFIGURE_CMD and re-distribute the args & vars
The final semantic is the same, but this is a bit more correct.

Build tested on Windows 10 (yes, there is some
Ubuntu mode for Windows 10, and I've been also building LEDE
on it for a few weeks).

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
7 years ago
Felix Fietkau 6f9011f089 cmake: properly pass host cflags/ldflags to the build
This should hopefully fix build issues where libraries that we ship in
tools/ were accidentally picked up from other places on the system, e.g.
/usr/local

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 7969770100 cmake: support verbose build that shows compiler commands
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau d6de31310c cmake: restore parallel build support for bootstrap
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Jo-Philipp Wich 43d5339940 tools: cmake: link librt if needed (FS#381)
Patch cmakes cmcurl component to unconditionally link librt when we discover
a clock_gettime() symbol in -lrt.

This is required to sucessfully link LibreSSL's libcrypto which might or
might not reqauire librt.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Jo-Philipp Wich 69be65b594 tools: mkimage: pass crypto libraries through HOST_LOADLIBES (FS#381)
Since linker argument order is significant on modern host compilers, pass
the required libcrypto libraries through the HOST_LOADLIBES variable in
order to ensure proper order of the final linker command line.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Matthias Schiffer 96a940308b
tools: libressl: always build as PIC
Fixes link errors for host packages like ruby like the following:

/usr/bin/ld: .../staging_dir/host/lib/libcrypto.a(libcrypto_la-md5_dgst.o):
relocation R_X86_64_PC32 against symbol `memcpy@@GLIBC_2.14' can not be used when making a shared object; recompile with -fPIC

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
7 years ago
Felix Fietkau 828a471e8d tools: remove obsolete yaffs tool
This was added a long time ago and was apparently never used

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau a9232ba1ed tools: reorganize dependencies, fix build after deleting staging dir
A lot of packages (especially those using libtool) depend on sed being
available. xz fails on an incremental build pretty early if it's not
there.

Clean up handling if essential core tools (patch, tar, xz), build them
in parallel and make them depend on sed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 018d80007e kernel: remove ubifs xz decompression support
It has been unused, and less useful than squashfs for cases where flash
space usage matters.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau b9857b21c2 tools/kernel2minor: fix permissions of created files
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago