openwrt/openwrt.git
4 years agowireguard-tools: bump to 1.0.20200102
Jason A. Donenfeld [Wed, 8 Jan 2020 22:37:41 +0000 (17:37 -0500)]
wireguard-tools: bump to 1.0.20200102

* systemd: update documentation URL
* global: bump copyright

Usual house keeping.

* Makefile: DEBUG_TOOLS -> DEBUG and document
* Makefile: port static analysis check
* dns-hatchet: adjust path for new repo layout
* Makefile: rework automatic version.h mangling

These are some important-ish cleanups for downstream package maintainers that
should make packaging this a lot smoother.

* man: add documentation about removing explicit listen-port

Documentation improvement.

* wg-quick: linux: quote ifname for nft

This should fix issues with weirdly named ifnames and odd versions of nft(8).

* fuzz: find bugs in the config syntax parser
* fuzz: find bugs when parsing uapi input

These are two fuzzers that have been laying around without a repo for a while.
Perhaps somebody with enough compute power will find bugs with them.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
4 years agowireguard: bump to 0.0.20200105
Jason A. Donenfeld [Wed, 8 Jan 2020 22:37:40 +0000 (17:37 -0500)]
wireguard: bump to 0.0.20200105

* socket: mark skbs as not on list when receiving via gro

Certain drivers will pass gro skbs to udp, at which point the udp driver
simply iterates through them and passes them off to encap_rcv, which is
where we pick up. At the moment, we're not attempting to coalesce these
into bundles, but we also don't want to wind up having cascaded lists of
skbs treated separately. The right behavior here, then, is to just mark
each incoming one as not on a list. This can be seen in practice, for
example, with Qualcomm's rmnet_perf driver. This lead to crashes on
OnePlus devices and possibly other Qualcomm 4.14 devices. But I fear
that it could lead to issues on other drivers on weird OpenWRT routers.

This commit is upstream in net-next as:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=736775d06bac60d7a353e405398b48b2bd8b1e54

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
4 years agoramips: add support for TP-Link Archer C20 v5
Maxim Anisimov [Wed, 18 Dec 2019 06:52:44 +0000 (09:52 +0300)]
ramips: add support for TP-Link Archer C20 v5

TP-Link Archer C20 v5 is a router with 5-port FE switch and
non-detachable antennas. It's based on MediaTek MT7628N+MT7610EN.

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

* 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 green part of the LED.

Create Factory image
--------------------
As all installation methods require a U-Boot to be integrated into the
Image (and we do not ship one with the image) we are not able to create
an image in the OpenWRT build-process.

Download a TP-Link image from their Website and a OpenWRT sysupgrade
image for the device and build yourself a factory image like following:

TP-Link image:             tpl.bin
OpenWRT sysupgrade image:  owrt.bin

 > dd if=tpl.bin of=boot.bin bs=131584 count=1
 > cat owrt.bin >> boot.bin

Installing via Web-UI
---------------------
Upload the boot.bin via TP-Links firmware upgrade tool in the
web-interface.

Installing via Recovery
-----------------------
Activate Web-Recovery by beginning the upgrade Process with a
Firmware-Image from TP-Link. After starting the Firmware Upgrade,
wait ~3 seconds (When update status is switching to 0%), then
disconnect the power supply from the device. Upgrade flag (which
activates Web-Recovery) is written before the OS-image is touched and
removed after write is succesfull, so this procedure should be safe.

Plug the power back in. It will come up in Recovery-Mode on 192.168.0.1.
When active, all LEDs but the WPS LED are off.
Remeber to assign yourself a static IP-address as DHCP is not active in
this mode.

The boot.bin can now be uploaded and flashed using the web-recovery.

Installing via TFTP
-------------------
Prepare an image like following (Filenames from factory image steps
apply here)

 > dd if=/dev/zero of=tp_recovery.bin bs=196608 count=1
 > dd if=tpl.bin of=tmp.bin bs=131584 count=1
 > dd if=tmp.bin of=boot.bin bs=512 skip=1
 > cat boot.bin >> tp_recovery.bin
 > cat owrt.bin >> tp_recovery.bin

Place tp_recovery.bin in root directory of TFTP server and listen on
192.168.0.66/24.

Connect router LAN ports with your computer and power up the router
while pressing the reset button. The router will download the image via
tftp and after ~1 Minute reboot into OpenWRT.

U-Boot CLI
----------
U-Boot CLI can be activated by holding down '4' on bootup.

Dual U-Boot
-----------
This is TP-Link MediaTek device with a split-uboot feature design like
a TP-Link Archer C50 v4. The first (factory-uboot) provides recovery via
TFTP and HTTP, jumping straight into the second (firmware-uboot) if no
recovery needs to be performed. The firmware-uboot unpacks and executed
the kernel.

Web-Recovery
------------
TP-Link integrated a new Web-Recovery like the one on the Archer C7v4 /
TL-WR1043v5 / Archer C50v4. Stock-firmware sets a flag in the "romfile"
partition before beginning to write and removes it afterwards. If the
router boots with this flag set, bootloader will automatically start
Web-recovery and listens on 192.168.0.1. This way, the vendor-firmware
or an OpenWRT factory image can be written.

By doing the same while performing sysupgrade, we can take advantage of
the Web-recovery in OpenWRT.

It is important to note that Web-Recovery is only based on this flag. It
can't detect e.g. a crashing kernel or other means. Once activated it
won't boot the OS before a recovery action (either via TFTP or HTTP) is
performed. This recovery-mode is indicated by an illuminated WPS-LED on
boot.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
[adjust some node names for LEDs in DTS]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoramips: fix leds for TP-Link Archer C20 v4
Maxim Anisimov [Wed, 18 Dec 2019 06:48:38 +0000 (09:48 +0300)]
ramips: fix leds for TP-Link Archer C20 v4

- add "gpio" group for wan_orange led
- use tpt triggers for wifi led indication
- add wifi 5 GHz led support

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
[slight commit message adjustment]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agodnsmasq: add uci-defaults script for config migration
Daniel Golle [Thu, 9 Jan 2020 13:32:12 +0000 (15:32 +0200)]
dnsmasq: add uci-defaults script for config migration

When running sysupgrade from an existing configuration, UCI option
dhcp.@dnsmasq[0].resolvfile needs to be modified in case it has not
been changed from it's original value.
Accomplish that using a uci-defaults script.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agoramips: disable image build for HiWiFi HC5962
David Bauer [Thu, 9 Jan 2020 11:32:16 +0000 (12:32 +0100)]
ramips: disable image build for HiWiFi HC5962

Image builds for the ramips-mt7621 target currently fail with:
> WARNING: Image file ./hiwifi_hc5962-kernel.bin is too big
Disable this board for now. It can still be built using the SDK.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years agohostapd: disable ft_psk_generate_local for non-PSK networks
David Bauer [Sun, 5 Jan 2020 23:13:58 +0000 (00:13 +0100)]
hostapd: disable ft_psk_generate_local for non-PSK networks

Without this commit, ft_psk_generate_local is enabled for non-PSK
networks by default. This breaks 802.11r for EAP networks.

Disable ft_psk_generate_local by default for non-PSK networks resolves
this misbehavior.

Reported-by: Martin Weinelt <martin@darmstadt.freifunk.net>
Signed-off-by: David Bauer <mail@david-bauer.net>
Tested-by: Martin Weinelt <martin@darmstadt.freifunk.net>
4 years agokernel: remove support for kernel 4.9
Adrian Schmutzler [Sun, 5 Jan 2020 13:15:44 +0000 (14:15 +0100)]
kernel: remove support for kernel 4.9

No target uses kernel 4.9 anymore.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoixp4xx: remove unmaintained target
Adrian Schmutzler [Sun, 5 Jan 2020 12:57:48 +0000 (13:57 +0100)]
ixp4xx: remove unmaintained target

This target is still on kernel 4.9, and it looks like there is no
active maintainer for this target anymore.
Remove the code and all the packages which are only used by this target.

To add this target to OpenWrt again port it to a recent and supported
kernel version.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoorion: remove unmaintained target
Adrian Schmutzler [Sun, 5 Jan 2020 13:06:30 +0000 (14:06 +0100)]
orion: remove unmaintained target

This target seems to have been unmaintained for quite a while, and not a
single tester for the (now outdated) kernel 4.14 patches has been found.
Remove the code and all the packages which are only used by this target.

To add this target to OpenWrt again port it to a recent and supported
kernel version.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoar7: remove unmaintained target
Adrian Schmutzler [Sun, 5 Jan 2020 12:49:38 +0000 (13:49 +0100)]
ar7: remove unmaintained target

This target seems to have been unmaintained for quite a while, and not a
single tester for the (now outdated) kernel 4.14 patches has been found.
Remove the code and all the packages which are only used by this target.

To add this target to OpenWrt again port it to a recent and supported
kernel version.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoorion: update kernel to version 4.14
Hauke Mehrtens [Sat, 11 May 2019 11:51:08 +0000 (13:51 +0200)]
orion: update kernel to version 4.14

This adds support for kernel 4.14 to the target and directly make it the
default kernel version to use.

This patch is build-tested only, but has never been device-tested. It is
only added to preserve the changes in Git history prior to removing this
target. Use it with care.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
[rebased and extended commit message, refreshed patches for 4.14.162]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoorion: refresh kernel configuration
Hauke Mehrtens [Sat, 11 May 2019 11:51:07 +0000 (13:51 +0200)]
orion: refresh kernel configuration

The configuration of the generic subtarget was used as the default
configuration and then the subtarget configurations were adapted.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agoar7: update kernel to version 4.14
Hauke Mehrtens [Sat, 11 May 2019 11:47:37 +0000 (13:47 +0200)]
ar7: update kernel to version 4.14

This adds support for kernel 4.14 to the target and directly make it the
default kernel version to use.

This patch is build-tested only, but has never been device-tested. It is
only added to preserve the changes in Git history prior to removing this
target. Use it with care.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
[rebased and extended commit message, refreshed patches for 4.14.162]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoar7: refresh kernel configuration
Hauke Mehrtens [Sat, 11 May 2019 11:47:36 +0000 (13:47 +0200)]
ar7: refresh kernel configuration

The configuration of the generic subtarget was used as the default
configuration and then the subtarget configurations were adapted.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agoramips: add label MAC address for Xiaomi MIR3G
Adrian Schmutzler [Wed, 8 Jan 2020 15:27:52 +0000 (16:27 +0100)]
ramips: add label MAC address for Xiaomi MIR3G

The device label shows the address currently assigned to the OpenWrt
LAN interface.

Current setup is:
LAN  *:b8  factory 0xe006  label
WAN  *:b7  factory 0xe000

For vendor FW bootlog we get (manually removed parts of the address):
[    7.520000] set LAN/WAN LWLLL
[    7.530000] GMAC1_MAC_ADRH -- : 0x00004031
[    7.530000] GMAC1_MAC_ADRL -- : 0x3c****b7
[    7.530000] GDMA2_MAC_ADRH -- : 0x00004031
[    7.540000] GDMA2_MAC_ADRL -- : 0x3c****b8
[    7.540000] eth1: ===> VirtualIF_open

Without further information, this does not allow verification of
the currently unexpected LAN/WAN assignment (we would expect 0xe000
to be LAN).

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoath79: remove unused Build/mktplinkfw-combined
Adrian Schmutzler [Tue, 31 Dec 2019 13:03:57 +0000 (14:03 +0100)]
ath79: remove unused Build/mktplinkfw-combined

Build/mktplinkfw-combined is not used anywhere, so remove it.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agotreewide: move mktplinkfw to tplink-v1-image in image-commands.mk
Adrian Schmutzler [Tue, 31 Dec 2019 12:57:50 +0000 (13:57 +0100)]
treewide: move mktplinkfw to tplink-v1-image in image-commands.mk

This move the slightly different target-specific implementations of
mktplinkfw from the targets to include/image-commands.mk and renames
it to tplink-v1-image. Having a common version will increase
consistency between implementation and will complete the
tplink build command already present in the new location.

Due to the slight differences of the original implementations, this
also does some adjustments to the device build commands/variables.

This also moves rootfs_align as this is required as dependency.

Tested on:
- TL-WDR4300 v1 (ath79, factory)
- TL-WDR4900 v1 (mpc85xx, sysupgrade)
- RE210 v1 (ramips, see Tested-by)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Christoph Krapp <achterin@googlemail.com>
4 years agoipq806x: refresh kernel patches
Álvaro Fernández Rojas [Wed, 8 Jan 2020 13:33:03 +0000 (14:33 +0100)]
ipq806x: refresh kernel patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years agoipq806x: add fab scaling support
Ansuel Smith [Sat, 28 Dec 2019 16:34:36 +0000 (17:34 +0100)]
ipq806x: add fab scaling support

Add fab scaling support and dtsi definition

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
4 years agoipq806x: refactor l2 freq scaling patch
Ansuel Smith [Sun, 5 Jan 2020 17:15:22 +0000 (18:15 +0100)]
ipq806x: refactor l2 freq scaling patch

Refactor l2 freq scaling patch to support voltage
scaling and add support to base cache scaling on
cpu freq scaling. Update the dtsi files with the new
definition used in the new code.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
4 years agoipq806x: reorganize nand_pins mux definition
Ansuel Smith [Wed, 25 Dec 2019 19:44:06 +0000 (20:44 +0100)]
ipq806x: reorganize nand_pins mux definition

It's wrong set the mux to bias-disable. The best way to
do this is by creating a separate group and disable the
specific pins.

By documentation, any subgroup with no bias definition
is ignored so the mux definition is useless.
Rework the definition by sremoving the mux subgroup and
set the remaining subgroup with the mux function and
drive-strength

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
4 years agoipq806x: opp/core: fix broken patch Handle opp voltage adjust
Ansuel Smith [Wed, 25 Dec 2019 18:42:08 +0000 (19:42 +0100)]
ipq806x: opp/core: fix broken patch Handle opp voltage adjust

The opp_notifier introduced with patch 0054-Handle-OPP-voltage adjust
for some reason missed the actual registration in the opp struct,
resulting in never being registred.
This was present in kernel 4.9 patchset but dropped in the transition
 to 4.14. Reintroduce this and fix patch 0055 about L2 cache scaling.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
4 years agoethtool: fix PKG_CONFIG_DEPENDS
Matthias Schiffer [Tue, 7 Jan 2020 19:53:31 +0000 (20:53 +0100)]
ethtool: fix PKG_CONFIG_DEPENDS

Add missing CONFIG_ prefix.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
4 years agoiperf: fix PKG_CONFIG_DEPENDS
Matthias Schiffer [Tue, 7 Jan 2020 19:52:23 +0000 (20:52 +0100)]
iperf: fix PKG_CONFIG_DEPENDS

Fix typo in PKG_CONFIG_DEPENDS and missing CONFIG_ prefix.

Fixes: e98e046f06f3 ("iperf: Allow enabling multicast support")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
4 years agodnsmasq: bump PKG_RELEASE
Daniel Golle [Tue, 7 Jan 2020 13:42:42 +0000 (15:42 +0200)]
dnsmasq: bump PKG_RELEASE

Previous commit should have bumped PKG_RELEASE, but git add was
forgotten... Add it now.

Fixes: cd48d8d342 ("dnsmasq: switch to /tmp/resolv.conf.d/resolv.conf.auto")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agodnsmasq: switch to /tmp/resolv.conf.d/resolv.conf.auto
Daniel Golle [Fri, 3 Jan 2020 11:39:06 +0000 (13:39 +0200)]
dnsmasq: switch to /tmp/resolv.conf.d/resolv.conf.auto

Mount-bind directory instead of resolv.conf.auto file in jail to
avoid problems when the file is deleted/replaced.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agonetifd: move /tmp/resolv.conf.auto to /tmp/resolv.conf.d/
Daniel Golle [Tue, 7 Jan 2020 13:33:47 +0000 (15:33 +0200)]
netifd: move /tmp/resolv.conf.auto to /tmp/resolv.conf.d/

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agobase-files: move /tmp/resolv.conf.auto to /tmp/resolv.conf.d/
Daniel Golle [Wed, 1 Jan 2020 02:11:54 +0000 (04:11 +0200)]
base-files: move /tmp/resolv.conf.auto to /tmp/resolv.conf.d/

Having it in a directory it more friendly for mount-bind.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agodnsmasq: Fix potential dnsmasq crash with TCP
Hauke Mehrtens [Mon, 6 Jan 2020 15:21:25 +0000 (16:21 +0100)]
dnsmasq: Fix potential dnsmasq crash with TCP

This is a backport from the dnsmasq master which should fix a bug which
could cause a crash in dnsmasq.

I saw the following crashes in my log:
[522413.117215] do_page_fault(): sending SIGSEGV to dnsmasq for invalid read access from 2a001450
[522413.124464] epc = 004197f1 in dnsmasq[400000+23000]
[522413.129459] ra  = 004197ef in dnsmasq[400000+23000]
This is happening in blockdata_write() when block->next is
dereferenced, but I am not sure if this is related to this problem or if
this is a different problem. I am unable to reproduce this problem.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agoramips: add support for ipTIME A8004T
Yong-hyu Ban [Sun, 6 Oct 2019 20:06:31 +0000 (05:06 +0900)]
ramips: add support for ipTIME A8004T

ipTIME A8004T is a 2.4/5GHz band AC2600 router, based on Mediatek
MT7621A.

Specifications:
- SoC: MT7621A
- RAM: DDR3 256M
- Flash: SPI NOR 16MB
- WiFi:
  - 2.4GHz: MT7615E
  - 5GHz: MT7615E
- Ethernet: 5x 10/100/1000Mbps
  - Switch: SoC internal
- USB: 1 * USB3.0 port
- UART:
  - J4: 3.3V, TX, RX, GND (3.3V is the square pad) / 57600 8N1
- Other info:
  - J9: Unknown unpopulated header.

Installation via web interface:
1.  Flash **initramfs** image through the stock web interface.
2.  Boot into OpenWrt and perform sysupgrade with sysupgrade image.

Revert to stock firmware:
1.  Perform sysupgrade with stock image.

Signed-off-by: Yong-hyu Ban <perillamint@quendi.moe>
[do not enable xhci node in DTS which is already enabled in DTSI]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoramips: add label MAC address for Netgear EX6130
Adrian Schmutzler [Sun, 5 Jan 2020 22:19:45 +0000 (23:19 +0100)]
ramips: add label MAC address for Netgear EX6130

The MAC address on the label of this device corresponds to the
2.4 GHz and ethernet MAC address.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agorpcd: Update to version 2020-01-05
Hauke Mehrtens [Sun, 5 Jan 2020 19:21:48 +0000 (20:21 +0100)]
rpcd: Update to version 2020-01-05

efe51f4 iwinfo: add current hw and ht mode to info call

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agoiwinfo: Update to version 2020-01-05
Hauke Mehrtens [Sun, 5 Jan 2020 19:19:37 +0000 (20:19 +0100)]
iwinfo: Update to version 2020-01-05

bf2c106 nl80211: add htmode to iwinfo_ops

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agouclient: Update to version 2020-01-05
Hauke Mehrtens [Sun, 5 Jan 2020 18:54:27 +0000 (19:54 +0100)]
uclient: Update to version 2020-01-05

fef6d3d uclient: Add string error function

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agoustream-ssl: Update to version 2020-01-05
Hauke Mehrtens [Sun, 5 Jan 2020 18:51:19 +0000 (19:51 +0100)]
ustream-ssl: Update to version 2020-01-05

30cebb4 ustream-ssl: mbedtls: fix ssl client verification
77de09f ustream-ssl: mbedtls: fix net_sockets.h include warning

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agoubus: Update to version 2020-01-05
Hauke Mehrtens [Sun, 5 Jan 2020 18:48:28 +0000 (19:48 +0100)]
ubus: Update to version 2020-01-05

d35df8a ubus: make libubus ready for linking into C++

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agomake_ext4fs: Update to version 2020-01-05
Hauke Mehrtens [Sun, 5 Jan 2020 18:40:37 +0000 (19:40 +0100)]
make_ext4fs: Update to version 2020-01-05

5c201be Add LDFLAGS when building libsparse.a
ec17045 make_ext4fs: fix build on musl systems

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agoramips: remove duplicate dts nodes of MediaTek LinkIt Smart 7688
Jack Chen [Sun, 5 Jan 2020 16:43:57 +0000 (00:43 +0800)]
ramips: remove duplicate dts nodes of MediaTek LinkIt Smart 7688

There are two identical wmac nodes in the dts file of MediaTek
LinkIt Smart 7688, so delete one of them.

Signed-off-by: Jack Chen <redchenjs@live.com>
4 years agoead: fix resource leak in tinysrp
Andrea Dalla Costa [Sat, 28 Dec 2019 20:05:16 +0000 (21:05 +0100)]
ead: fix resource leak in tinysrp

Add call to fclose for file pointer fp in function t_openpw.
The resource leak could happen during an error handling.

Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
4 years agoramips: reduce lzma dictionary size for D-Link DIR-645
Mason Clarke [Sun, 29 Dec 2019 18:03:00 +0000 (19:03 +0100)]
ramips: reduce lzma dictionary size for D-Link DIR-645

Currently this device fails to boot with the OpenWrt snapshot images
(release images are unaffected). The error message is:
"LZMA ERROR 1 - must RESET board to recover".

This happens because the kernel image is too big for the bootloader
to boot. This commit works around this by decreasing the lzma dictionary
size option from the default 23 to 10.

Before this change the current OpenWrt snapshot image (uncompressed
kernel size 4875139 bytes) failed to boot, while now an even bigger
image (kernel 4.19 with snapshot default config; uncompressed kernel
size 5162833 bytes) boots just fine.

The highest lzma dictionary size option this image booted with was 11.
10 was chosen to have a bit more room for growth.

An unavoidable side-effect of this change is that the compressed kernel
image will take up more space.

Total image size with different dictionary size options:
D23 - 3973903 bytes (base)
D16 - 4113167 bytes (+3.5%  - +139264 bytes)
D12 - 4317967 bytes (+8.7%  - +344064‬ bytes)
D11 - 4383503 bytes (+10.3% - +409600 bytes)
D10 - 4461327 bytes (+12.3% - +487424 bytes)

Fixes: FS#1484
Signed-off-by: Mason Clarke <mclarke2355@gmail.com>
4 years agopppd: update to 2.4.8
DENG Qingfang [Wed, 1 Jan 2020 07:23:32 +0000 (15:23 +0800)]
pppd: update to 2.4.8

78cd384 Update README and patchlevel.h for 2.4.8 release
5d03403 pppd: Avoid use of strnlen (and strlen) in vslprintf
a1e950a pppd: Fix IPv6 default route code for Solaris
ca5e61b plugins/rp-pppoe: Make tag parsing loop condition more accurate
c10c3c7 pppd: Make sure word read from options file is null-terminated
b311e98 pppd: Limit memory accessed by string formats with max length specified
3ea9de9 pppd: Eliminate some more compiler warnings
57edb1a pppd: Include time.h header before using time_t
09f695f pppd: Don't free static string
03104ba pppd.h: Add missing headers
388597e pppd: Add defaultroute6 and related options
66ce4ba pppd: Avoid declarations within statements in main.c
5637180 pppd: Fix `ifname` option in case of multilink (#105)
d00f8a0 pppd: Fix variable reference syntax in Makefile.linux
b6b4d28 pppd: Check tdb pointer before closing

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years agodropbear: add missing zlib dependency for dropbearconvert
Matt Merhar [Wed, 1 Jan 2020 07:58:34 +0000 (02:58 -0500)]
dropbear: add missing zlib dependency for dropbearconvert

If CONFIG_DROPBEAR_ZLIB is set, building fails at the packaging stage
due to an undeclared dependency on libz.so.1.

As is already done for the main dropbear package, conditionally add a
dependency on zlib.

Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
4 years agoath79: use ath10k-ct-smallbuffers for TP-Link RE355/RE450 v1
Christoph Krapp [Thu, 2 Jan 2020 09:30:37 +0000 (10:30 +0100)]
ath79: use ath10k-ct-smallbuffers for TP-Link RE355/RE450 v1

Both devices are available in 64M and 128M RAM configurations but there
is no visial indication which configuration one might get.
So just to be sure we properly support both configurations switch to
kmod-atk10k-ct-smallbuffers.

Signed-off-by: Christoph Krapp <achterin@googlemail.com>
4 years agonettle: Disable ARMEB assembly
Rosen Penev [Sat, 28 Dec 2019 06:51:42 +0000 (22:51 -0800)]
nettle: Disable ARMEB assembly

It's broken for ARMv5, which is the only armeb target in OpenWrt.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoath79: drop obsolete ehci hacks
Bjørn Mork [Mon, 30 Dec 2019 21:10:27 +0000 (22:10 +0100)]
ath79: drop obsolete ehci hacks

There's nothing enabling these hacks in ath79, so drop the redundant
patches.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
4 years agotrace-cmd: Fix compilation without fortify-headers
Rosen Penev [Tue, 31 Dec 2019 03:24:01 +0000 (19:24 -0800)]
trace-cmd: Fix compilation without fortify-headers

Upstream backport.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agolldpd: Fix compilation without fortify-headers
Rosen Penev [Tue, 31 Dec 2019 03:26:55 +0000 (19:26 -0800)]
lldpd: Fix compilation without fortify-headers

Upstream backport.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoe2fsprogs: update to version 1.45.4
Josef Schlehofer [Wed, 1 Jan 2020 16:22:01 +0000 (17:22 +0100)]
e2fsprogs: update to version 1.45.4

Removed backported patch

Release notes: http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.45.4

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
4 years agolibcxx: Remove -flto from LDFLAGS
Rosen Penev [Sat, 4 Jan 2020 02:31:01 +0000 (18:31 -0800)]
libcxx: Remove -flto from LDFLAGS

It seems the buildbots can't handle it.

Added a cmake option to find the cxxabi files as they are part of the
toolchain and not in the normal path. It doesn't seem to make a
difference, just gets rid of cmake warnings.

Added another small GCC warning fix. It's fairly minor.

This has no change in compiled size, and most likely no change in
behavior. Bumped the PKG_RELEASE anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agostrace: update to version 5.4
Josef Schlehofer [Sat, 4 Jan 2020 09:18:50 +0000 (10:18 +0100)]
strace: update to version 5.4

Changelog: https://strace.io/files/5.4/

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
4 years agoath79: Remove mtd cfi_cmdset_0002 status check patches
Tokunori Ikegami [Sun, 5 Jan 2020 08:13:03 +0000 (17:13 +0900)]
ath79: Remove mtd cfi_cmdset_0002 status check patches

Currently the patch only changes break to use goto statement instead.
But not necessary acutually since the ret value checked after the for loop.
So it is okay for the break case before changed by the patch also.

This patch only reverts the following commit partially.
  https://github.com/openwrt/openwrt/commit/ddc11c3932c7b7b7df7d5fbd48f207e7
    Note: The changes are mainly applied into the linux kernel upstream.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Cc: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years agoar71xx: Remove mtd cfi_cmdset_0002 status check patch
Tokunori Ikegami [Sun, 5 Jan 2020 08:13:02 +0000 (17:13 +0900)]
ar71xx: Remove mtd cfi_cmdset_0002 status check patch

Currently the patch only changes break to use goto statement instead.
But not necessary acutually since the ret value checked after the for loop.
So it is okay for the break case before changed by the patch also.

This patch only reverts the following commit partially.
  https://github.com/openwrt/openwrt/commit/ddc11c3932c7b7b7df7d5fbd48f207e77619eaa7
    Note: The changes are mainly applied into the linux kernel upstream.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Cc: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years agomac80211: remove ath10k_pci memory hacks
Christian Lamparter [Tue, 24 Dec 2019 11:11:59 +0000 (12:11 +0100)]
mac80211: remove ath10k_pci memory hacks

These two hacks are no longer necessary as they've
been moved to a special variant of kmod-ath10k-ct.

So, if you have a device suffering from low-memory
situation and getting applications crashes due to
the OOM reaper or kernel panics with ath10k, please
use the "kmod-ath10k-ct-smallbuffers" package from
now on.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
4 years agoipq806x: remove CONFIG_MDIO_IPQ8064 symbol
Christian Lamparter [Sat, 21 Dec 2019 16:39:19 +0000 (17:39 +0100)]
ipq806x: remove CONFIG_MDIO_IPQ8064 symbol

This driver is not available on upstream.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
4 years agofstools: update to latest Git HEAD
Jo-Philipp Wich [Sun, 5 Jan 2020 17:40:22 +0000 (18:40 +0100)]
fstools: update to latest Git HEAD

823faa0 block: re-discover mtd devices on extroot mount retry

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
4 years agoprocd: update to version 2020-01-04
Petr Štetiar [Wed, 1 Jan 2020 11:43:45 +0000 (12:43 +0100)]
procd: update to version 2020-01-04

a5af33ce9a16 instance: strdup string attributes
d2e8bf6ef7cf system: watchdog_set: fix misleading indentation
9814807bd71c system: sysupgrade: fix possibly misleading error
c7a2db3c1eb6 system: sysupgrade: rework firmware validation
ea45c4a0f07c system: fix failing image validation due to EINTR
4fde95506243 cmake: fix lookup of external libraries

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agobase-files: sysupgrade: exit if the firmware download failed
Petr Štetiar [Tue, 31 Dec 2019 09:34:29 +0000 (10:34 +0100)]
base-files: sysupgrade: exit if the firmware download failed

Sysupgrade process shouldn't continue if the firmware image couldn't be
downloaded.

Ref: http://lists.infradead.org/pipermail/openwrt-devel/2019-December/020940.html
Reported-by: Petr Novák <petrn@me.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years agoramips: fix sysupgrade image for TP-Link RE200v1
Andreas Böhler [Sun, 5 Jan 2020 10:13:55 +0000 (11:13 +0100)]
ramips: fix sysupgrade image for TP-Link RE200v1

Images generated for the TP-Link RE200v1 cannot be updated using
sysupgrade, because a necessary call to append-metadata was missing.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
4 years agokernel: bump 4.9 to 4.9.208
Hauke Mehrtens [Sat, 4 Jan 2020 23:47:25 +0000 (00:47 +0100)]
kernel: bump 4.9 to 4.9.208

Refreshed all patches.

Compile-tested on: none
Runtime-tested on: none

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agokernel: bump 4.19 to 4.19.93
Hauke Mehrtens [Sat, 4 Jan 2020 22:45:20 +0000 (23:45 +0100)]
kernel: bump 4.19 to 4.19.93

Refreshed all patches.

The patch hack-4.19/550-loop-better-discard-for-block-devices.patch was
replaced with an new version of the patch from:
https://lore.kernel.org/patchwork/patch/1153625/
https://lore.kernel.org/patchwork/patch/1153626/

Compile-tested on: ipq40xx, lantiq
Runtime-tested on: ipq40xx, lantiq

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agokernel: bump 4.14 to 4.14.162
Hauke Mehrtens [Sat, 4 Jan 2020 22:52:01 +0000 (23:52 +0100)]
kernel: bump 4.14 to 4.14.162

Refreshed all patches.

Compile-tested on: ramips
Runtime-tested on: ramips

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agoramips: add support for Edimax RA21S
Maksym Medvedev [Fri, 15 Nov 2019 22:21:22 +0000 (23:21 +0100)]
ramips: add support for Edimax RA21S

Edimax RA21S is a dual band 11ac router,
based on MediaTek MT7621A and MT7615N chips.

Specification:
- SoC: MediaTek MT7621A dual-core @ 880MHz
- RAM: 256M (Nanya NT5CC128M16IP)
- FLASH: 16MB (Macronix MX25L12835F)
- WiFi: 2.4/5 GHz 4T4R
  - 2.4GHz MediaTek MT7615N bgn
  - 5GHz MediaTek MT7615N nac
- Switch: SoC integrated Gigabit Switch (4 x LAN, 1 x WAN)
- USB: No
- BTN: Reset, WPS
- LED: 4 red LEDs, indistinguishable when case closed
- UART:  through-hole on PCB.
   J1: 3.3V - RX - GND - TX / 57600-8N1.  3.3V is the square pad

Installation:
Update the factory image via the OEM web-interface
(by default: http://192.168.2.1/)
User: admin
Password: 1234

The sysupgrade image can be installed via TFTP
from the U-Boot bootloader. Connect via ethernet port 2.

Tested on device by @UAb5eSMn

Signed-off-by: Maksym Medvedev <redrathnure@gmail.com>
[split DTS and take over improvements from RG21S, extend commit
message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agogeneric: fix compiler error in OpenWrt's kexec patch
Daniel Golle [Sat, 4 Jan 2020 09:47:50 +0000 (11:47 +0200)]
generic: fix compiler error in OpenWrt's kexec patch

330-MIPS-kexec-Accept-command-line-parameters-from-users.patch causes
problems when building with -Werror=unused-result.

arch/mips/kernel/machine_kexec.c: In function 'machine_kexec_init_argv':
arch/mips/kernel/machine_kexec.c:76:2: error: ignoring return value of 'copy_from_user', declared with attribute warn_unused_result [-Werror=unused-result]
  copy_from_user(kexec_argv_buf, buf, size);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Fix this by handling the return value in an appropriate way.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agoiperf: Allow enabling multicast support
Florian Fainelli [Sat, 4 Jan 2020 04:29:05 +0000 (20:29 -0800)]
iperf: Allow enabling multicast support

iperf2 is useful for testing UDP over multicast, add an option to permit
the enabling/disabling of multicast support.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
4 years agokernel: bump 4.14 to 4.14.161
Hauke Mehrtens [Thu, 2 Jan 2020 19:27:55 +0000 (20:27 +0100)]
kernel: bump 4.14 to 4.14.161

Refreshed all patches.

Compile-tested on: ipq40xx, ramips
Runtime-tested on: ipq40xx

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years agosunxi: Turn on CONFIG_PINCTRL_SUN4I_A10 for A20
Florian Fainelli [Fri, 3 Jan 2020 22:58:58 +0000 (14:58 -0800)]
sunxi: Turn on CONFIG_PINCTRL_SUN4I_A10 for A20

CONFIG_PINCTRL_SUN4I_A10 controls both the A10 and the A20 enablong of
the pinctrl driver, this is necessary since upstream commit
5d8d349618a9464714c07414c5888bfd9416638f ("pinctrl: sunxi: add A20
support to A10 driver") which has been included in v4.13 and onwards.

Fixes: ad2b3bf310f7 ("sunxi: Add support for kernel 4.14")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
4 years agomt76: update to the latest version
David Bauer [Fri, 3 Jan 2020 16:22:40 +0000 (17:22 +0100)]
mt76: update to the latest version

38f4c57 mt76: mt76x0: fix default mac address overwrite

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years agoramips: fix inverted reset button for Ravpower WD03
Moritz Warning [Tue, 3 Dec 2019 22:36:13 +0000 (23:36 +0100)]
ramips: fix inverted reset button for Ravpower WD03

The button events "pressed" and "released" were switched. Tested with v18.06.4.

Signed-off-by: Moritz Warning <moritzwarning@web.de>
4 years agoramips: move set-irq-affinity script to mt7621 subtarget
DENG Qingfang [Fri, 13 Dec 2019 16:24:39 +0000 (00:24 +0800)]
ramips: move set-irq-affinity script to mt7621 subtarget

Move the set-irq-affinity script to mt7621 because it is the only
SMP subtarget.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years agolantiq: use shared code for LED migration
Adrian Schmutzler [Tue, 17 Dec 2019 00:30:22 +0000 (01:30 +0100)]
lantiq: use shared code for LED migration

Shared base-files package contains functions for LED migration that
are already used by several targets. Apply those also to lantiq and
drop the (redundant) local code.

While at it, reorder board names in file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agolantiq: remove includes of non-existent /lib/functions/lantiq.sh
Adrian Schmutzler [Tue, 17 Dec 2019 16:50:58 +0000 (17:50 +0100)]
lantiq: remove includes of non-existent /lib/functions/lantiq.sh

lantiq.sh is still included in files which do not use it anymore.
Remove the includes.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agosamsung: add subtarget condition for device
Adrian Schmutzler [Sat, 28 Dec 2019 15:08:38 +0000 (16:08 +0100)]
samsung: add subtarget condition for device

The only device in samsung target is meant to be built with s5pv210
subtarget. Thus, though this won't make a difference for a
one-subtarget target, already add the condition to the Makefile to
make the assignment obvious.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agosamsung: use soc_vendor_model scheme for DTS file name
Adrian Schmutzler [Sat, 28 Dec 2019 15:04:48 +0000 (16:04 +0100)]
samsung: use soc_vendor_model scheme for DTS file name

This patch changes the samsung target to calculate the DTS file name
from vendor and device name and the SOC (i.e. subtarget) following
the common scheme:

soc_vendor_model.dts

This also updates the device definition name to make compatible,
image name, menuconfig name and DTS name consistent.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoscripts/arm-magic.sh: switch to /bin/sh
Rosen Penev [Wed, 1 Jan 2020 02:07:05 +0000 (18:07 -0800)]
scripts/arm-magic.sh: switch to /bin/sh

This does not use any special bash stuff.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/env: replace -a and -o with &&/||
Rosen Penev [Wed, 1 Jan 2020 02:01:43 +0000 (18:01 -0800)]
scripts/env: replace -a and -o with &&/||

The former are not well defined.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/env: use explicit find location
Rosen Penev [Wed, 1 Jan 2020 02:01:42 +0000 (18:01 -0800)]
scripts/env: use explicit find location

Some find binaries do not imply the current directory.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoramips: fix Archer C20i wireless MAC address
David Bauer [Thu, 2 Jan 2020 18:27:54 +0000 (19:27 +0100)]
ramips: fix Archer C20i wireless MAC address

The TP-Link Archer C20i previously had a generic Ralink MAC address set
for both radios, as the caldata does only contain a generic MAC address.

Set the MAC address from the vendor firmware for both radios to assign
unique MAC addresses to every device.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years agoramips: fix Archer C2 v1 5GHz MAC address
David Bauer [Thu, 2 Jan 2020 18:25:26 +0000 (19:25 +0100)]
ramips: fix Archer C2 v1 5GHz MAC address

The TP-Link Archer C2 v1 previously had a generic Ralink MAC address set
for the 5GHz radio (MT7610), as the caldata does only contain a generic
MAC address.

Set the MAC address from the vendor firmware for the 5GHz radio to
assign unique MAC addresses to every device.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years agoramips: add system LED indicators for TP-Link C20i
David Bauer [Thu, 2 Jan 2020 18:10:50 +0000 (19:10 +0100)]
ramips: add system LED indicators for TP-Link C20i

Use the WPS LED to indicate system status like it is done for the
TP-Link Archer C2 v1 and many other boards.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years agoramips: convert TP-Link MT7620 boards to tpt trigger
David Bauer [Thu, 2 Jan 2020 02:11:39 +0000 (03:11 +0100)]
ramips: convert TP-Link MT7620 boards to tpt trigger

This converts all MediaTek MT7620 boards from TP-Link to use the now
supported WiFi throughput LED trigger. This way, the LED state now
covers all VAPs regardless of their name.

Also align all single-WiFi LEDs to represent the state of the 2.4GHz
radio. This was not always the case previously, as later-added support
for the MT7610 altered the phy probing order.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years agoscripts/gen-dependencies.sh: use /bin/sh
Rosen Penev [Wed, 1 Jan 2020 02:06:28 +0000 (18:06 -0800)]
scripts/gen-dependencies.sh: use /bin/sh

This uses no special bash stuff.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/gen-dependencies.sh: replace backticks with $()
Rosen Penev [Wed, 1 Jan 2020 02:06:27 +0000 (18:06 -0800)]
scripts/gen-dependencies.sh: replace backticks with $()

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agolibcxx: Add size optimizations
Rosen Penev [Wed, 1 Jan 2020 03:37:35 +0000 (19:37 -0800)]
libcxx: Add size optimizations

Changed standard to 2a. 2a (as well as 17) contain more constexpr
functions, which are evaluated at compile time. This saves space.

Added --gc-sections. With the CXXABI change, this now makes the package
smaller.

With these, size went down to 210845 on mipsel_24kc.

Also fixed two small compiler warnings. No real change in behavior.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agolibcxx: Build with the libsupc++ ABI
Rosen Penev [Wed, 1 Jan 2020 03:37:34 +0000 (19:37 -0800)]
libcxx: Build with the libsupc++ ABI

Allows proper exception handling. This includes removing unimplemented
warnings.

File size increased as a result:

Before:

182874

After:

211006

On mipsel_24kc.

Note that this requires libsupc++ anyway. It's specified in g++-libcxx.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoramips: mt7620: use throughput trigger on HiWiFi HC5x61
DENG Qingfang [Tue, 31 Dec 2019 14:35:41 +0000 (22:35 +0800)]
ramips: mt7620: use throughput trigger on HiWiFi HC5x61

Throughput trigger support for MT7620 has been added, so switch to it

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years agoramips: remove HiWiFi HC5661 non-existent 5GHz LED
DENG Qingfang [Tue, 31 Dec 2019 14:30:44 +0000 (22:30 +0800)]
ramips: remove HiWiFi HC5661 non-existent 5GHz LED

HC5661 does not have 5GHz WiFi or LED.

Fixes: e6e373d3480e ("ramips: Add DTS files for HiWiFi HC5x61 models")
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years agoubox: update to version 2019-12-31
Hans Dedecker [Tue, 31 Dec 2019 13:33:01 +0000 (14:33 +0100)]
ubox: update to version 2019-12-31

0e34af1 kmodloader: added -a arg to modprobe

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
4 years agoramips: add support for TP-Link RE200 v1
Andreas Böhler [Thu, 19 Dec 2019 09:29:14 +0000 (10:29 +0100)]
ramips: add support for TP-Link RE200 v1

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>
4 years agoramips: fix switch setup for Xiaomi MiWiFi Nano
Sungbo Eo [Sun, 22 Dec 2019 16:25:39 +0000 (01:25 +0900)]
ramips: fix switch setup for Xiaomi MiWiFi Nano

MiWiFi Nano has two LAN ports, which are in reverse order. Add port numbers
to them, and disable unused ports.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years agoscripts/mkits.sh: replace legacy backticks with $()
Rosen Penev [Tue, 31 Dec 2019 02:21:36 +0000 (18:21 -0800)]
scripts/mkits.sh: replace legacy backticks with $()

This replaces deprecated backticks by more versatile $(...) syntax.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[adjust commit title and message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoscripts/symlink-tree.sh: use /bin/sh
Rosen Penev [Tue, 31 Dec 2019 02:19:29 +0000 (18:19 -0800)]
scripts/symlink-tree.sh: use /bin/sh

This uses nothing bash specific.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/strip-kmod.sh: harmonize leading whitespaces
Adrian Schmutzler [Tue, 31 Dec 2019 10:41:07 +0000 (11:41 +0100)]
scripts/strip-kmod.sh: harmonize leading whitespaces

Convert leading spaces to tabs for consistency in the file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoscripts/strip-kmod.sh: use sh instead of bash
Rosen Penev [Tue, 31 Dec 2019 02:18:04 +0000 (18:18 -0800)]
scripts/strip-kmod.sh: use sh instead of bash

There's nothing bash specific here.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoscripts/strip-kmod.sh: replace legacy backticks with $()
Rosen Penev [Tue, 31 Dec 2019 02:18:03 +0000 (18:18 -0800)]
scripts/strip-kmod.sh: replace legacy backticks with $()

This replaces deprecated backticks by more versatile $(...) syntax.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[slightly adjusted commit title, added commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agomvebu: split interface configuration for clearfog pro and base
Josua Mayer [Thu, 26 Dec 2019 14:25:04 +0000 (15:25 +0100)]
mvebu: split interface configuration for clearfog pro and base

Handle both variants separately. This removes the need for calling
swconfig to detect the switch, and simplifies future changes.

Signed-off-by: Josua Mayer <josua.mayer@jm0.eu>
4 years agoath79: generate firmware image for aircube-isp
Christian Mauderer [Wed, 11 Dec 2019 13:40:24 +0000 (14:40 +0100)]
ath79: generate firmware image for aircube-isp

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>
4 years agotoolchain: wrapper.sh: harmonize leading whitespaces
Adrian Schmutzler [Tue, 31 Dec 2019 00:33:28 +0000 (01:33 +0100)]
toolchain: wrapper.sh: harmonize leading whitespaces

Convert leading spaces to tabs and generally harmonize leading
whitespace indent in the file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agotoolchain: wrapper.sh: use /bin/sh instead of bash
Rosen Penev [Mon, 30 Dec 2019 03:41:18 +0000 (19:41 -0800)]
toolchain: wrapper.sh: use /bin/sh instead of bash

No bash features are actually used here.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[slightly adjust commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years agoapm821xx: mbl_gen_hdd_img.sh: switch to /bin/sh
Rosen Penev [Mon, 25 Nov 2019 22:45:02 +0000 (14:45 -0800)]
apm821xx: mbl_gen_hdd_img.sh: switch to /bin/sh

Nothing here needs bash.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[add prefix to commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>