aboutsummaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* firmware-utils: mkfwimage: add support for Ubiquiti XC devicesRoger Pueyo Centelles2020-05-171-0/+9
| | | | | | | | This commit adds support for Ubiquiti devices based on the XC board type, such as the PowerBeam 5AC 500. The factory binary structure is the same as the WA type. Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
* tools/mkimage: update to 2020.04Lucian Cristian2020-04-267-241/+113
| | | | | | | | | also change the download source to https and add a mirror drop merged patches Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com> [Add extra changes to compile on FreeBSD, merge two patches] Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* tools/e2fsprogs: fix build under macosKevin Darbyshire-Bryant2020-04-101-1/+1
| | | | | | | | | macos doesn't define a loff_t type, the native off_t type being 64bit anyway. Persuade e2fsprogs to accept off_t instead on macos Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* tools/mm-macros: Update to 1.0.0Daniel Engberg2020-04-091-3/+5
| | | | | | Update mm-macros to 1.0.0 Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/xz: Update to 5.2.5Daniel Engberg2020-04-091-2/+3
| | | | | | | Update xz to 5.2.5 Disable NLS support to be consistent with other tools such as bison, e2fsprogs and sed. Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/mtools: Update to 4.0.24Daniel Engberg2020-04-091-2/+2
| | | | | | Update mtools to 4.0.24 Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/findutils: Update to 4.7.0Daniel Engberg2020-04-093-120/+9
| | | | | | | | | | | | Update findutils to 4.7.0 Remove patches Enable pthreads Disable NLS support to be consistent with other tools such as bison, e2fsprogs and sed. Disable selinux support to be consistent with other tools such as sed and tar Disable rpath as we don't need hardcoded paths Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/e2fsprogs: Update to 1.45.6Daniel Engberg2020-04-091-2/+2
| | | | | | Update e2fsprogs to 1.45.6 Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/cmake: update to 3.17.0Rosen Penev2020-04-066-74/+37
| | | | | | | | | | | Remove libressl patches; they are no longer needed as LibreSSl adde support Replace qt tests patch with one that disables all of them. Refresh remaining one. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* firmware-utils: ptgen: add GPT support李国2020-03-312-24/+319
| | | | | | | | | | | | | | | | Add GPT support to ptgen, so we can generate EFI bootable images. Introduced two options: -g generate GPT partition table -G GUID use GUID for disk and increase last bit for all partitions We drop The alternate partition table to reduce size, This may cause problems when generate vmdk images or vdi images. We have to pad enough sectors when generate these images. Signed-off-by: 李国 <uxgood.org@gmail.com> [fixed compilation on macOS] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* tplink-safeloader: update soft_ver for TP-Link Archer C6 v2 (EU)Georgi Vlaev2020-03-301-1/+1
| | | | | | | | | | | | The last couple of TP-Link firmware releases for Archer C6 v2 (EU) have switched to version 1.2.x. Bump the soft_ver to "1.2.1" to allow firmware updates from the vendor web interface. TP-Link vendor firmware releases supported by this change: * Archer C6(EU)_V2_200110: soft_ver:1.2.1 Build 20200110 rel.60119 * Archer C6(EU)_V2_191014: soft_ver:1.2.0 Build 20191014 rel.33289 Signed-off-by: Georgi Vlaev <georgi.vlaev@gmail.com>
* tools: squashfskit4: fix build with GCC10Robert Marko2020-03-222-1/+44
| | | | | | | | In order to build squashfskit with GCC10, this backport from upstream is needed. Signed-off-by: Robert Marko <robert.marko@sartura.hr> [increase PKG_RELEASE] Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* squashfskit4/Makefile: introduce PKG_RELEASE=1Alexander Couzens2020-03-221-1/+1
| | | | | | When adding patches, the PKG_RELEASE should be increased. Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* ath79: add support for TP-Link Archer C60 v3Adrian Schmutzler2020-03-181-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TP-Link Archer C60 v3 is a dual-band AC1350 router, based on Qualcomm/Atheros QCA9561 + QCA9886. It seems to be identical to the v2 revision, except that it lacks a WPS LED and has different GPIO for amber WAN LED. 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, 2x button - UART header on PCB Flash instruction (WebUI): Download *-factory.bin image and upload it via the firmwary upgrade function of the stock firmware WebUI. Flash instruction (TFTP): 1. Set PC to fixed IP address 192.168.0.66 2. Download *-factory.bin image 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 While TFTP works for OpenWrt images, my device didn't accept the only available official firmware "Archer C60(EU)_V3.0_190115.bin". In contrast to earlier revisions (v2), the v3 contains the (same) MAC address twice, once in 0x1fa08 and again in 0x1fb08. While the partition-table on the device refers to the latter, the firmware image contains a different partition-table for that region: name device firmware factory-boot 0x00000-0x1fb00 0x00000-0x1fa00 default-mac 0x1fb00-0x1fd00 0x1fa00-0x1fc00 pin 0x1fd00-0x1fe00 0x1fc00-0x1fd00 product-info 0x1fe00-0x1ff00 0x1fd00-0x1ff00 device-id 0x1ff00-0x20000 0x1ff00-0x20000 While the MAC address is present twice, other data like the PIN isn't, so with the partitioning from the firmware image the PIN on the device would actually be outside of its partition. Consequently, the patch uses the MAC location from the device (which is the same as for the v2). Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* pkgconf: always retain -I and -L flagsJo-Philipp Wich2020-03-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | The pkgconf fork filters -I and -L flag values from .pc files which match pkgconf's builtin system directory value. During configure, pkgconf derives the default system include and library search path values from exec_prefix, which is set to staging_dir/host in the host tool build phase. Due to that, pkgconf will drop all -I and -L flags pointing to staging_dir/host/include or staging_dir/host/lib, unless invoked with --keep-system-cflags and --keep-system-libs respectively, breaking our kernel libelf discovery / stack validation workarounds. In order to inhibit the filtering, add --keep-system-cflags and --keep-system-libs to our pkg-config shell wrapper. Fixes: GH#2832 Fixes: 867298cf47 ("tools/pkg-config: Replace with pkgconf") Ref: https://lists.infradead.org/pipermail/openwrt-devel/2020-March/022182.html Ref: https://git.openwrt.org/fe43969336201f2cc7d103b68fd6e65989bee184 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Acked-by: Petr Štetiar <ynezz@true.cz>
* build: fix kernel 5.4 on macosKevin Darbyshire-Bryant2020-03-142-0/+28
| | | | | | | | | | As part of the kernel build process there are utilities built to run on the host system that expect linux kernel headers to be available. Unfortunately macos/darwin doesn't have these headers. vdso2c requires types.h so provide a minimal stub to satisfy it. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* tools/cmake: Update to 3.16.5Yufei Miao2020-03-121-2/+2
| | | | | | Update cmake to 3.16.5 Signed-off-by: Yufei Miao <myf@myf.cloud>
* mkrasimage: fix segmentation faultMichael T Farnworth2020-03-011-9/+10
| | | | | | | | | | | | | Code was attempting to determine the size of the file before it was actually known and allocating insufficient memory space. Images above a certain size caused a segmentation fault. Moving the calloc() ensured ensured that large images didn't result in a buffer overflow on memcpy(). Signed-off-by: Michael T Farnworth <michael@turf.org> [fixed name in From to match one in SoB] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* tools/pkgconf: Run pkg-config wrapper through shellcheckRosen Penev2020-03-011-1/+4
| | | | | | | | Mainly quoting fixes. Separated parameters by \ for easier readability. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* tools/pkg-config: Replace with pkgconfRosen Penev2020-03-014-16/+46
| | | | | | | | | | | | | | | | | | | | | | pkgconf is a newer, actively maintained implementation of pkg-config that supports more aspects of the pkg-config file specification and provides a library interface that applications can use to incorporate intelligent handling of pkg-config files into themselves (such as build file generators, IDEs, and compilers). Through its pkg-config compatibility interface (activated when it is run as "pkg-config"), it also can completely replace the original implementation. It is also lighterweight and does not require glib2, as pkg-config does. On other distros, pkgconf is symlinked to pkg-config. For simplicity here, it is renamed to pkg-config.real, as in the original package. Initial results have been positive. As before, pkgconf works as long as the pkg-config files point to the proper paths. Signed-off-by: Rosen Penev <rosenp@gmail.com> [backported upstream fix for Meson] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* tools: Fix "lib" symlink created inside $(STAGING_DIR_HOST)/libJeffery To2020-03-011-1/+1
| | | | | | | | | | | | | | | | | | | Currently, if "make tools/install" is called after tools have already been installed, a symbolic link named "lib" will be created inside $(STAGING_DIR_HOST)/lib, pointing to "lib" (i.e. itself). During tools/prepare, a "lib64" symlink is created inside $(STAGING_DIR_HOST) that points to "lib" (also inside $(STAGING_DIR_HOST)). If tools/prepare is called and the "lib64" symlink already exists, then ln will treat it as a directory and instead create a symlink named "lib" inside of that directory. This adds the -n option for ln so that $(STAGING_DIR_HOST)/lib64 is always treated as a normal file (the link name), not as a directory. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* tools/bison: Update to 3.5.1Daniel Engberg2020-02-191-3/+3
| | | | | | | | Update bison to 3.5.1 Use POSIX threads as the previous option is no longer valid Disable NLS support to be consistent with other tools such as e2fsprogs and sed Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/e2fsprogs: Update to 1.45.5Daniel Engberg2020-02-181-3/+4
| | | | | | | Update e2fsprogs to 1.45.5 Enable pthreads support Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/gmp: Remove obsolete optionsDaniel Engberg2020-02-181-2/+1
| | | | | | Remove mpbsd argument Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/sed: Update to 4.8Daniel Engberg2020-02-181-3/+5
| | | | | | | | Update sed to 4.8 Use POSIX threads Disable i18n and selinux support Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/patchelf: Update to 0.10Daniel Engberg2020-02-181-2/+2
| | | | | | Update patchelf to 0.10 Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* tools/libressl: Update to 3.0.2Daniel Engberg2020-02-182-25/+2
| | | | | | Update libressl to 3.0.2 and remove 010-avoid-glibc.patch as fix is added by upstream Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
* firmware-utils: add lxlfw tool for generating Luxul firmwaresDan Haab2020-02-072-0/+283
| | | | | | It's a simple tool prepending image with a Luxul header. Signed-off-by: Dan Haab <dan.haab@legrand.com>
* ramips: add support for TP-Link RE200 v2Andreas Böhler2020-02-011-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TP-Link RE200 v2 is a wireless range extender with Ethernet and 2.4G and 5G WiFi with internal antennas. It's based on MediaTek MT7628AN+MT7610EN. Specifications -------------- - MediaTek MT7628AN (580 Mhz) - 64 MB of RAM - 8 MB of FLASH - 2T2R 2.4 GHz and 1T1R 5 GHz - 1x 10/100 Mbps Ethernet - UART header on PCB (57600 8n1) - 8x LED (GPIO-controlled), 2x button There are 2.4G and 5G LEDs in red and green which are controlled separately. MAC addresses ------------- The MAC address assignment matches stock firmware, i.e.: LAN : *:0D 2.4G: *:0E 5G : *:0F Installation ------------ Web Interface ------------- It is possible to upgrade to OpenWrt via the web interface. Simply flash the -factory.bin from OEM. In contrast to a stock firmware, this will not overwrite U-Boot. Serial console -------------- Opening the case is quite hard, since it is welded together. Rename the OpenWrt factory image to "test.bin", then plug in the device and quickly press "2" to enter flash mode (no line feed). Follow the prompts until OpenWrt is installed. Unfortunately, this devices does not offer a recovery mode or a tftp installation method. If the web interface upgrade fails, you have to open your device and attach serial console. Additonal notes --------------- It is possible to flash back to stock by using tplink-safeloader to create a sysupgrade image based on a stock update. After the first boot, it is necessary upgrade to another stock image, otherwise subsequent boots fail with LZMA ERROR 1 and you have to attach serial to recover the device. Signed-off-by: Andreas Böhler <dev@aboehler.at> [remove DEVICE_VARS change] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* tools/gmp: update to 6.2.0Hannu Nyman2020-01-251-2/+2
| | | | | | | | Update GNU gmp to version 6.2.0 Release notes: https://gmplib.org/gmp6.2.html Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
* ar71xx: use dynamic partitioning for TP-Link TL-WA850RE v2Adrian Schmutzler2020-01-221-2/+1
| | | | | | | This moves the TP-Link TL-WA850RE v2 to dynamic partitioning and will allow to use this for ath79 as well. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* tools/bison: update to 3.5Hannu Nyman2020-01-212-3/+3
| | | | | | | | | | | | | | | Update bison to 3.5 Release notes: https://lists.gnu.org/archive/html/info-gnu/2019-12/msg00002.html Note for future: release notes mention that YYPRINT macro is declared deprecated, but apparently still works for now. I found one possible use of that in scripts/config/zconf.tab.c_shipped That might be modernized at some point, but as the file is synced with the one from upstream Linux, it might get fixed there. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
* tools: tplink-safeloader: update soft_ver for TP-Link Archer C6 v2 (EU)Anderson Vulczak2020-01-191-1/+1
| | | | | | | | | | | | | | | | This patch updates "soft_ver" for TP-Link Archer C6 v2 (EU). It makes possible to upload OpenWrt on lastest vendor's firmware as the web-based updater checks for major.minor version during upload. Due to that on next major/minor version update TP-Link will stop us from using the web-based firmware update tool, so it will require a new patch on soft_ver to match major and minor version. Up to today's latest stock firmware the patch (major.minor.patch) version does not matters, that allows downgrade from 1.1.4 to 1.1.1 but do not allow downgrade from 1.1.X to 1.0.X. Signed-off-by: Anderson Vulczak <andi@andi.com.br>
* ramips: add support for TP-Link RE305 v1Steffen Förster2020-01-181-0/+36
| | | | | | | | | | | | | | | | | | | | | | Specification: SoC: MediaTek MT7628AN RAM: 64MiB Flash: 8MiB Wifi: - 2.4GHz: MT7628AN - 5GHz: MT7612EN LAN: 1x 10/100 Mbps Flash instructions: Flash factory image through stock firmware WEB UI. Back to stock is possible by using TFTP and stripping down the Firmware provided by TP-Link to a initramfs. The flash space between 0x650000 and 0x7f0000 is blank in the stock firmware so I left it out as well. Signed-off-by: Steffen Förster <nemesis@chemnitz.freifunk.net>
* tools/cmake: update to 3.16.2Hannu Nyman2020-01-184-9/+9
| | | | | | | | | Update cmake to 3.16.2 and refresh patches. Release notes: https://cmake.org/cmake/help/v3.16/release/3.16.html Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
* ccache: update to 3.7.7DENG Qingfang2020-01-162-3/+3
| | | | | | | | | Update ccache to 3.7.7 Release notes: https://ccache.dev/releasenotes.html#_ccache_3_7_7 Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
* wrt350nv2-builder: Fix memory leakAndrea Dalla Costa2020-01-141-0/+1
| | | | | | | Add missing call to `free` for variable `buffer` in function `create_bin_file`. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
* firmware-utils/mktitanimg: fix possible resource leakAndrea Dalla Costa2020-01-141-0/+1
| | | | | | Add missing call to `fclose` for file pointer `nsp_image`. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
* firmware-utils/mksenaofw: fix possible memory leakAndrea Dalla Costa2020-01-141-0/+2
| | | | | | Add missing calls to `free` for variable `pmodel`. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
* firmware-utils/mkfwimage: fix possible memory and resource leakAndrea Dalla Costa2020-01-142-0/+6
| | | | | | | | | Add missing calls to `free` for variable `mem`. Add missing call to `fclose` for variable `f`. The same changes were made in both `mkfwimage.c` and `mkfwimage2.c`. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
* firmware-utils/mkchkimg: fix possible resource leaksAndrea Dalla Costa2020-01-141-0/+8
| | | | | | | | Add missing `fclose` calls for file pointers `kern_fp`, `fs_fp` and `out_fp`. Not closing files could lead to resource leaks. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
* firmware-utils: fix possible memory leak and resource leakAndrea Dalla Costa2020-01-141-0/+3
| | | | | | | | | | Add missing calls to `free` for variable `buffer`. This could lead to a memory leak. Add missing call to `close` for file pointer `fdin`. This could lead to a resource leak. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
* firmware-utils/dgfirmare: fix possible resource leakAndrea Dalla Costa2020-01-141-0/+6
| | | | | | | | Add missing calls to `fclose` in functions `write_img`, `write_rootfs` and `write_kernel`. The not-closed files could lead to resource leaks. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
* firmware-utils: mkfwimage: add support for Ubiquiti SW devicesTobias Schramm2020-01-121-0/+9
| | | | | | | | This commit adds support for Ubiquiti ToughSwitch XP (and probably also EdgeSwitch XP) devices. They are mostly based on the same hardware as MX devices. Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
* make_ext4fs: Update to version 2020-01-05Hauke Mehrtens2020-01-052-14/+3
| | | | | | | 5c201be Add LDFLAGS when building libsparse.a ec17045 make_ext4fs: fix build on musl systems Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* ramips: add support for TP-Link RE200 v1Andreas Böhler2019-12-311-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TP-Link RE200 v1 is a wireless range extender with Ethernet and 2.4G and 5G WiFi with internal antennas. It's based on MediaTek MT7620A+MT7610EN. Specifications -------------- - MediaTek MT7620A (580 Mhz) - 64 MB of RAM - 8 MB of FLASH - 2T2R 2.4 GHz and 1T1R 5 GHz - 1x 10/100 Mbps Ethernet - UART header on PCB (57600 8n1) - 8x LED (GPIO-controlled; only 6 supported), 2x button There are 2.4G and 5G LEDs in red and green which are controlled separately. The 5G LED is currently not supported, since the GPIOs couldn't be determined. Installation ------------ Web Interface ------------- It is possible to upgrade to OpenWrt via the web interface. However, the OEM firmware upgrade file is required and a tool to fix the MD5 sum of the header. This procedure overwrites U-Boot and there is not failsafe / recovery mode present! To prepare an image, you need to take the header and U-Boot (i.e. 0x200 + 0x20000 bytes) from an OEM firmware file and attach the factory image to it. Then fix the header MD5Sum1. Serial console -------------- Opening the case is quite hard, since it is welded together. Rename the OpenWrt factory image to "test.bin", then plug in the device and quickly press "2" to enter flash mode (no line feed). Follow the prompts until OpenWrt is installed. Unfortunately, this devices does not offer a recovery mode or a tftp installation method. If the web interface upgrade fails, you have to open your device and attach serial console. Since the web upgrade overwrites the boot loader, you might also brick your device. Additional notes ---------------- MAC address assignment is based on stock-firmware. For me, the device assigns the MAC on the label to Ethernet and the 2.4G WiFi, while the 5G WiFi has a separate MAC with +2. *:88 Ethernet/2.4G label, uboot 0x1fc00, userconfig 0x0158 *:89 unused userconfig 0x0160 *:8A 5G not present in flash This seems to be the first ramips device with a TP-Link v1 header. The original firmware has the string "EU" embedded, there might be some region- checking going on during the firmware upgrade process. The original firmware also contains U-Boot and thus overwrites the boot loader during upgrade. In order to flash back to stock, the first header and U-Boot need to be stripped from the original firmware. Signed-off-by: Andreas Böhler <dev@aboehler.at>
* ath79: generate firmware image for aircube-ispChristian Mauderer2019-12-311-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a "factory" image for the aircube-isp devices. Note that the firmware can't be uploaded without prior special preparation. For the most recent instructions on how to do that, visit the OpenWRT wiki page of the Ubiquiti airCube ISP for details: https://openwrt.org/toh/ubiquiti/ubiquiti_aircube_isp Current procedure: With the original firmware 2.5.0 it is possible to upload and execute a script via the configuration. To do that download and unpack the original configuration, adapt uhttpd config to execute another lua handler (placed in the config directory) and pack and upload it again. The lua handler can call a script that mounts an overlayfs and modifies the "fwupdate.real" binary so that an unsigned image is accepted. The overlayfs is necessary because a security system (called tomoyo) doesn't allow binaries in other locations than /sbin/fwupdate.real (and maybe some more) to access the flash when executed via network. A big thanks to Torvald Menningen (Snap) from the OpenWRT forum for finding out how to patch the binary so that it accepts an unsigned image. The current step-by-step procedure is: - Use a version 2.5.0 of the original firmware. This is important because a binary file will be modified. - Download a configuration. - Unpack it (it's just a tar gz file without an ending). - Add the following to uhttpd: `````` config 'uhttpd' 'other' list listen_http 0.0.0.0:8080 list listen_http [::]:8080 option 'home' '/tmp/persistent/config/patch/www' option lua_prefix '/lua' option lua_handler '/tmp/persistent/config/patch/handler.lua' `````` - Create a `patch` subfolder. - Create a `patch/www` subfolder. - Create a `patch/handler.lua` with the following content: `````` function handle_request(env) uhttpd.send("Status: 200 OK\r\n") uhttpd.send("Content-Type: text/plain\r\n\r\n") local command = "/bin/sh /tmp/persistent/config/patch/patch.sh 2>&1" local proc = assert(io.popen(command)) for line in proc:lines() do uhttpd.send(line.."\r\n") end proc:close() end `````` - Create a `patch/patch.sh` with the following content: `````` #!/bin/sh -x set -e set -u set -x UBNTBOX_PATCHED="/tmp/fwupdate.real" MD5FILE="/tmp/patchmd5" cat <<EOF > ${MD5FILE} c33235322da5baca5a7b237c09bc8df1 /sbin/fwupdate.real EOF # check md5 of files that will be patched if ! md5sum -c ${MD5FILE} then echo "******** Error when checking files. Refuse to do anything. ********" exit 0 fi # prepare some overlay functionality LOWERDIR="/tmp/lower_root" mkdir -p ${LOWERDIR} mount -t squashfs -oro /dev/mtdblock3 ${LOWERDIR} overlay_some_path() { PATH_TO_OVERLAY=$1 ALIAS=$2 UPPERDIR="/tmp/over_${ALIAS}" WORKDIR="/tmp/over_${ALIAS}_work" mkdir -p ${UPPERDIR} mkdir -p ${WORKDIR} mount -t overlay -o lowerdir=${LOWERDIR}${PATH_TO_OVERLAY},upperdir=${UPPERDIR},workdir=${WORKDIR} overlay ${PATH_TO_OVERLAY} } # patch the ubntbox binary. overlay_some_path "/sbin" "sbin" echo -en '\x10' | dd of=/sbin/fwupdate.real conv=notrunc bs=1 count=1 seek=24598 echo "******** Done ********" `````` - Repack the configuration. - Upload it via the normal web interface. - Wait about a minute. The webserver should restart. - Now there is a second web server at port 8080 which can call the lua script. Visit the page with a web browser. Link is for example http://192.168.1.1:8080/lua - You should see the output of the script with a "*** Done ***" at the end. Note that the patches are not permanent. If you restart the router you have to re-visit the link (but not re-upload the config). - Now you can upload an unsigned binary via the normal web interface. Signed-off-by: Christian Mauderer <oss@c-mauderer.de>
* tools: qemu: Add patches to support adapter_type and monolithicFlatBrett Mastbergen2019-12-2312-0/+2340
| | | | | | | Its way more trouble to update this to a newer version of qemu than it is to backport the two additional features we need. Signed-off-by: Brett Mastbergen <bmastbergen@untangle.com>
* tools: tplink-safeloader: fix whitespace issuesAdrian Schmutzler2019-11-271-42/+42
| | | | | | | | | This replaces tabs by spaces when preceding an equal sign. This improves consistency in the file and makes the indent look correct on all platforms. While at it, also fix one case of inconsistent leading spaces. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ath79: add support for TP-Link Archer C6 v2 (US) and A6 (US/TW)Anderson Vulczak2019-11-271-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is based on #1689 and adds support for TP-Link Archer C6 v2 (US) and A6 (US/TW). The hardware is the same as EU and RU variant, except for GPIOs (LEDS/Buttons), flash(chip/partitions) and UART being available on the board. - SOC: Qualcomm QCA9563 @ 775MHz - Flash: GigaDevice GD25Q127CS1G (16MiB) - 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: 115200, 8n1 (header available on board) Known issues: - Wireless: 5GHz is known to have lower RSSI signal, it affects speed and range. Flash instructions: Upload openwrt-ath79-generic-tplink_archer-c6-v2-us-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 ArcherA6v2_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 Flash partitioning: I've followed #1689 for defining the partition layout for this patch. The partition named as "tplink" @ 0xfd0000 is marked as read only as it is where some config for stock firmware are stored. On stock firmware those stock partitions starts at 0xfd9400 however I had not been able to make it functional starting on the same address as on stock fw, so it has been partitioned following #1689 and not the stock partition layout for this specific partition. Due to that firmware/rootfs partition lenght is 0xf80000 and not 0xf89400 as stock. According to the GPL code, the EU/RU/JP variant does have different GPIO pins assignment to LEDs and buttons, also the flash memory layout is different. GPL Source Code: https://static.tp-link.com/resources/gpl/gpl-A6v2_us.tar.gz Signed-off-by: Anderson Vulczak <andi@andi.com.br> [wrap commit message, remove soft_ver change for C6 v2 EU, move LED aliases to DTS files, remove dts-v1 in DTSI, node/property reorder in DTSI] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>