Commit Graph

50646 Commits

Author SHA1 Message Date
Paul Spooren 2e157714a8 build,json: fix generation with empty profiles
If the image generation doesn't add any profiles to the output the
*profile merge* will fail. To avoid that set an empty profile as
fallback.

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit fd0d9909bf)
2021-06-21 09:43:21 -10:00
Moritz Warning 8add3e139c build: preserve profiles.json between builds
Keep other profiles.json content if the data belongs to the current
build version.

Also useful for the ImageBuilder, which builds for a single model each
time. Without this commit the profiles.json would only contain the
latest build profile information.

Signed-off-by: Moritz Warning <moritzwarning@web.de>
[improve commit message]
Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit a463b96241)
2021-06-21 09:43:21 -10:00
Perry Melange b2a3df91fa qos-scripts: add ifbN device before setting the link up
commit 50413e1ec8 replaced ifconfig
with ip.  In order to set a link state to up, the interface needs
to be added first.

Fixes: FS#3754

Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
[Add Fixes tag]
Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
(cherry picked from commit 23c3bab920)
2021-06-21 09:28:23 +02:00
Felix Fietkau 3d0ed7d763 mac80211: fix an issue with wds links on 802.11ax devices
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry-picked from commit 89c9ccc3b2)
2021-06-19 12:17:54 +02:00
Michael Pratt 7a4bd9cc51 ath79: use dynamic partitioning for TP-Link CPE series
CPExxx and WBSxxx boards with AR9344 SOC
use the OKLI lzma kernel loader
with the offset of 3 blocks of length 4k (0x3000)
in order to have a fake "kernel" that cannot grow larger
than how it is defined in the now static OEM partition table.

Before recent changes to the mtdsplit driver,
the uImage parser for OKLI only supported images
that started exactly on an eraseblock boundary.

The mtdsplit parser for uImage now supports identifying images
with any magic number value
and at any offset from the eraseblock boundary
using DTS properties to define those values.

So, it is no longer necessary to use fixed sizes
for kernel and rootfs

Tested-by: Andrew Cameron <apcameron@softhome.net>  [CPE510 v2]
Tested-by: Bernhard Geier <freifunk@geierb.de>      [WBS210 v2]
Tested-by: Petrov <d7c48mWsPKx67w2@gmail.com>       [CPE210 v1]
Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 7b9a0c264c)
2021-06-18 08:39:14 +02:00
Felix Fietkau 3839a4c7e9 mac80211: fix minstrel sample time check
We need to skip sampling if the next sample time is after jiffies, not before.
This patch fixes an issue where in some cases only very little sampling (or none
at all) is performed, leading to really bad data rates

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-17 12:45:08 +02:00
Andre Heider 3921f213e5 iw: update to 8fab0c9e
This fixes `iw dev wlan0-mesh station dump`.

8fab0c9 iw: fix ftm_request missing arguments segfault
e816fbc iw: fix mgmt dump missing arguments segfault
5d9d1b8 iw: Fix timestamp output on 32-bit architectures
4b25ae3 iw: fix pointer arithmetic in __print_he_capa
c3df363 iw: add option to print human readable event time
cd64525 iw: print ctrl port tx status event
0ba98b9 iw: use correct type in policy check for mesh
9e38dee iw: scan: fixup HE caps whitespace
17e8564 iw: scan: parse HE capabilities
5735e58 iw: util: factor out HE capability parser
6d8d507 iw: scan: add extension tag parsing
b4e1ec4 man: update wikipage URL, reformat SEE ALSO section
c56036a iw: enable 80MHz support for 6GHz band 11s mesh
fa72728 iw: handle positive error codes gracefully
7ba9093 iw: scan: add flag for scanning colocated ap
5ec60ed iw: Add 'coloc' and 'flush' options to sched_scan
f8ade75 iw: update wikipage URL
b6f2dac iw: Add support for specifying the 160MHz bandwidth when setting the channel/frequency

Signed-off-by: Andre Heider <a.heider@gmail.com>
(cherry-picked from commit b5420dd710)
2021-06-17 12:44:58 +02:00
Felix Fietkau 20f66649dd mt76: update to the latest version
bddc1db76d0f mt76: mt7915: drop the use of repeater entries for station interfaces
3c90f35dddac mt76: mt7915: add thermal sensor device support
afab0e8202ff mt76: mt7915: add thermal cooling device support
41cf02184699 mt76: mt7615: add thermal sensor device support
2ac6b8762565 mt76: connac: update BA win size in Rx direction
ddb301127291 mt76: mt7921: fix reset under the deep sleep is enabled
e4cbefd1d69a mt76: mt7921: avoid unnecessary consecutive WiFi resets
393eea2034d7 mt76: mt7921: fix invalid register access in wake_work
a15d46407ffa mt76: mt7921: fix OMAC idx usage
e4d267d8e900 mt76: mt7921: enable runtime pm by default
50fd8ce2412a mt76: connac: add bss color support for sta mode
e29058c3c860 mt76: mt7921: return proper error value in mt7921_mac_init
c89c8c347b1e mt76: mt7921: do not schedule hw reset if the device is not running
9f7bb428e587 mt76: mt7921: reset wfsys during hw probe
22ea365913b5 mt76: mt7915: add .offset_tsf callback
ad91f8e8e494 mt76: mt7615: add .offset_tsf callback
6f871f35e3c1 mt76: mt7915: use mt7915_mcu_get_txpower_sku() to get per-rate txpower
597b68b7daa3 mt76: mt7615: remove useless if condition in mt7615_add_interface()
3945264468eb mt76: testmode: fix memory leak in mt76_testmode_alloc_skb
bdcc57a11606 mt76: testmode: remove unnecessary function calls in mt76_testmode_free_skb
a9763452601d mt76: testmode: remove undefined behaviour in mt76_testmode_alloc_skb
4aef2a2be464 mt76: mt7615: fix potential overflow on large shift
d9dd7635b055 mt76: mt7915: use mt7915_mcu_get_mib_info() to get survey data
d740e921758a mt76: mt7921: introduce mac tx done handling
259ddfc7cb73 mt76: mt7921: update statistic in active mode only
757b93f4b179 mt76: mt7921: remove leftover 80+80 HE capability
1fcff599b2e1 mt76: allow hw driver code to overwrite wiphy interface_modes
c55c22e39b7d mt7915: update firmware to 2020110522
10548aef1f45 mt76: mt7915: improve error recovery reliability
ed6b0c79820c mt76: mt7921: set MT76_RESET during mac reset
321443258bea mt76: move mt76_rates in mt76 module
d1652e8af9e1 Revert "mt76: connac: do not schedule wake_work if the runtime-pm is disabled"
4f4cab39ed9f mt76: mt7915: read all eeprom fields from fw in efuse mode
71450535f164 mt76: mt7921: enable hw offloading for wep keys
833d577e430c mt76: mt7921: remove mt7921_get_wtbl_info routine
67b7a22d2b99 mt76: mt7921: enable random mac address during sched_scan
cf1ff7bf4f1b mt76: mt7915: setup drr group for peers
ef2f7aa8745f mt76: mt7615: update radar parameters
b9f09f530223 mt76: mt7915: fix MT_EE_CAL_GROUP_SIZE
22b690334c0f mt76: mt7915: do not fail if the cooling device could not be registered

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry-picked from commit 3c46ba053d)
2021-06-17 12:44:58 +02:00
Felix Fietkau 05a8bf04ec mac80211: sync nl80211.h with upstream and backport a WPA3 related commit
Fixes compatibility issues with the latest hostapd update

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry-picked from commit 91abeebd3b)
2021-06-17 12:44:57 +02:00
Daniel Golle 072d0afb8f ugps: start also in case device is absent
Don't bail out from init script in case the GPS device is missing.
Some modems take time to come up, and some people may use things like
'kplex' to feed ugpsd. Hence it is better to always start ugpsd
unconditionally and let procd's respawn take care of retrying.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit 3d026d2425)
2021-06-15 12:16:10 +01:00
Daniel Golle 25c75424e7 ugps: update to git HEAD
86ee86e nmea: parse $GPZDA sentences for date/time
 8e12414 nmea: parse $GPGLL sentences for position
 5e88403 ubus: display only available information

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit 3a8b75b569)
2021-06-15 12:16:10 +01:00
Hauke Mehrtens aeb7b57798 OpenWrt v21.02.0-rc3: revert to branch defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-06-14 20:33:17 +02:00
Hauke Mehrtens 2bc192c3f4 OpenWrt v21.02.0-rc3: adjust config defaults
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-06-14 20:33:04 +02:00
Hauke Mehrtens 2aba3e9784 opkg: update to git HEAD
1bf042d libopkg: pkg_hash: print unresolved dependencies

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit da86064611)
2021-06-14 00:02:19 +02:00
Hannu Nyman ea308e2f38 treewide: mark selected packages nonshared
Mark uci, ubus, libubox, lua, libnl-tiny and libjson-c
as nonshared packages. This helps to keep coherent dependencies
if these ABI versioned packages are later updated.

Before this commit it is possible to get missing dependencies
in target-specific nonshared packages (like iwinfo) that depend
on these shared ABI versioned packages. If these are later updated
and rebuilt, only the new ABI version will be available for download,
while the target-specific packages in releases continue to depend on
the old ABI version.

After this commit the packages are built along the other nonshared
packages by the phase1 images buildbot and will be available at the
target/ download directories instead of packages/base dir. That will
help to keep a coherent set available.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
(cherry picked from commit 72cc44958e)
2021-06-14 00:02:13 +02:00
Paul Spooren 144bf23e5a README: switch from freenode to oftc
We recently switched from freenode.net to oftc.net, reflect that in the
README and update the links.

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 5a66165cb1)
2021-06-12 12:41:29 -10:00
Paul Spooren 78a2aef8d6 README: update routing.git URL
The routing packages feed moved from `openwrt-routing/packages` to
`openwrt/routing`, reflect that in the README.

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 0371f40193)
2021-06-12 12:41:29 -10:00
Pawel Dembicki 1562613077 ramips: mt7620: add kernel size for Jboot devices
Since few months multiple users reported problems with various JBoot
devices. [0][1][2][3] All of them was bricked.

On my Lava LR-25G001 it freezes with current snapshot:

CDW57CAM_003 Jboot B695
Giga Switch AR8327 init
AR8327/AR8337 id   ==> 0x1302
JRecovery Version R1.2 2014/04/01 18:25
SPI FLASH: MX25l12805d 16M
.
.
(freeze)

The kernel size is >2048k.

I built current master with minimal config and it boots well:

CDW57CAM_003 Jboot B695
Giga Switch AR8327 init
AR8327/AR8337 id   ==> 0x1302
JRecovery Version R1.2 2014/04/01 18:25
SPI FLASH: MX25l12805d 16M
.
...........................
Starting kernel @80000000...
[    0.000000] Linux version 5.4.124

Kernel size is <2048k.

Jboot bootloader isn't open source, so it's impossible to find
solution in code. It looks, that some buffer for kernel have 2MB size.

To avoid bricked devices, this commit introduces 2048k limit kernel
size for all jboot routers.

[0] https://bugs.openwrt.org/index.php?do=details&task_id=3539
[1] https://eko.one.pl/forum/viewtopic.php?pid=254344
[2] https://eko.one.pl/forum/viewtopic.php?id=20930
[3] https://eko.one.pl/forum/viewtopic.php?pid=241376#p241376

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[remove Fixes:]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit e1d8a14cd0)
2021-06-12 11:01:43 +02:00
Adam Elyas 8078d953b8 ramips: fix LAN LED trigger assignment for Xiaomi Router 3 Pro
The default trigger for the amber lights on lan1 and lan3 were
mistakenly swapped after the device's migration to DSA. This
caused activity on one port to trigger the amber light on the
other port. Swapping their default trigger in the DTS file
fixes that.

Signed-off-by: Adam Elyas <adamelyas@outlook.com>
[minor commit title adjustment, wrap commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit edaf432bf4)
2021-06-12 11:01:43 +02:00
Liu Yu e422a3af69 ramips: fix Ethernet random MAC address for HILINK HLK-7628N
Set the ethernet address from flash.

MAC addresses as verified by OEM firmware:

  use   interface  source
  2g    wlan0      factory 0x04 (label)
  LAN   eth0.1     factory 0x28 (label+1)
  WAN   eth0.2     factory 0x2e (label+2)

Fixes: 671c9d16e3 ("ramips: add support for HILINK HLK-7628N")

Signed-off-by: Liu Yu <f78fk@live.com>
[drop old MAC address setup from 02_network, cut out state_default
changes, face-lift commit message, add Fixes:]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit ae9c5cd37b)
2021-06-12 11:01:43 +02:00
Jonathan A. Kollasch 0794a784e9 ath79: fix eth0 PLL registers on WD My Net Wi-Fi Range Extender
This replaces the register bits for RGMII delay on the MAC side in favor
of having the RGMII delay on the PHY side by setting the phy-mode
property to rgmii-id (RGMII internal delay), which is supported by the
at803x driver.  Speed 1000 is fixed as a result, so now all ethernet
speeds function.

Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Reviewed-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit f36990eae7)
2021-06-12 11:01:43 +02:00
Petr Štetiar 1a8de9cbf9 Revert "ci: build test ath79/generic"
This reverts commit 16d6288c63 which was
accidentally commited.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-06-11 09:05:13 +02:00
Petr Štetiar 16d6288c63 ci: build test ath79/generic
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-06-11 07:22:19 +02:00
Michael Pratt 02b7b77332 ath79: set lzma-loader variables to null by default
This fixes a small regression where the lzma-loader variable values
are being shared between boards that require different configurations.

If not set to "" globally, a device without these settings will just take
the last values another device has set before in the queue.

Fixes: 1b8bd17c2d ("ath79: lzma-loader: allow setting custom kernel magic")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
[add detailed explanation to the commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit bf8c16dfa2)
2021-06-11 07:20:31 +02:00
Michael Pratt 349a4f4531 ath79: move pcie node to DTSI for qca955x Senao APs
pcie0 is the same for this generation of Senao APs
while eth0, eth1, and wmac can differ

the qca,no-eeprom property has no effect
for the ath10k drivers

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 15c599c9df)
2021-06-11 07:20:31 +02:00
Michael Pratt 518adcfe77 ath79: cleanup DTS for ALLNET ALL-WAP02860AC
use qca955x_senao_loader.dtsi
because it is the same hardware / partitioning
and some cleanup

Effects:

nodes to match similar boards
 - keys
 - eth0
 - pcie0

bumps SPI frequency to 40 MHz

removes &pll node:
the property is defined in qca955x.dtsi

removes qca,no-eeprom:
has no effect with mtd-cal-data property
(also spelling)

Tested-by: Tomasz Maciej Nowak <tmn505@gmail.com>
Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit e800da9d5c)
2021-06-11 07:20:31 +02:00
Michael Pratt a97f4f3b29 ath79: add factory.bin for ALLNET ALL-WAP02860AC
This device is a Senao-based product
using hardware and software from Senao
with the tar-gz platform for factory.bin
and checksum verification at boot time
using variables stored in uboot environment
and a 'failsafe' image when it fails.

Extremely similar hardware/software to Engenius EAP1200H
and other Engenius APs with qca955x

Tested-by: Tomasz Maciej Nowak <tmn505@gmail.com>
Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 37ea5d9a65)
2021-06-11 07:20:31 +02:00
Michael Pratt e823fb1763 ath79: add Senao 'failsafe' sysupgrade procedure
Use a similar upgrade method for sysupgrade.bin, like factory.bin,
for Senao boards with the tar.gz OEM upgrade platform,
and 'failsafe' image which is loaded on checksum failure.

This is inspired by the OEM upgrade script /etc/fwupgrade.sh
and the existing platforms for dual-boot Senao boards.

Previously, if the real kernel was damaged or missing
the only way to recover was with UART serial console,
because the OKLI lzma-loader is programmed to halt.

uboot did not detect cases where kernel or rootfs is damaged
and boots OKLI instead of the failsafe image,
because the checksums stored in uboot environment
did not include the real kernel and rootfs space.

Now, the stored checksums include the space for both
the lzma-loader, kernel, and rootfs.
Therefore, these boards are now practically unbrickable.

Also, the factory.bin and sysupgrade.bin are now the same,
except for image metadata.
This allows for flashing OEM image directly from openwrt
as well as flashing openwrt image directly from OEM.

Make 'loader' partition writable so that it can be updated
during a sysupgrade.

tested with
ENS202EXT v1
EAP1200H
EAP350 v1
EAP600
ECB350 v1
ECB600
ENH202 v1

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit d5035f0d26)
2021-06-11 07:20:31 +02:00
Michael Pratt 642c88714c ath79: adjust ath79/tiny Senao APs to 4k blocksize
ath79/tiny kernel config has
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
from commit
05d35403b2

Because of this, these changes are required for 2 reasons:

1.

Senao devices in ath79/tiny
with a 'failsafe' partition and the tar.gz sysupgrade platform
and a flash chip that supports 4k sectors
will fail to reboot to openwrt after a sysupgrade.

the stored checksum is made with the 64k blocksize length
of the image to be flashed,
and the actual checksum changes after flashing due to JFFS2 space
being formatted within the length of the rootfs from the image

example:
0x440000 length of kernel + rootfs (from sysupgrade.bin)
0x439000 offset of rootfs_data (from kernel log)

2.

for boards with flash chips that support 4k sectors:
saving configuration over sysupgrade is not possible
because sysupgrade.tgz is appended at a 64k boundary
and the mtd parser starts JFFS2 at a 4k boundary.

for boards with flash chips that do not support 4k sectors:
partitioning with 4k boundaries causes a boot loop
from the mtd parser not finding kernel and rootfs.

Also:

Some of the Senao boards that belong in ath79/tiny,
for example ENH202,
have a flash chip that does not support 4k sectors
(no SECT_4K symbol in upstream source).

Because of this, partitioning must be different for these devices
depending on the flash chip model detected by the kernel.

Therefore:

this creates 2 DTSI files
to replace the single one with 64k partitioning
for 4k and 64k partitioning respectively.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit a58cb22bbe)
2021-06-11 07:20:31 +02:00
Michael Pratt 64d845ef02 ath79: remove 'fakeroot' for Senao devices
By using the same custom kernel header magic
in both OKLI lzma-loader, DTS, and makefile
this hack is not necessary anymore

However, "rootfs" size and checksum
must now be supplied by the factory.bin image
through a script that is accepted by the OEM upgrade script.

This is because Senao OEM scripts assume a squashfs header exists
at the offset for the original "rootfs" partition
which is actually the kernel + rootfs in this implementation,
and takes size value from the header that would be there with hexdump,
but this offset is now the uImage header instead.

This frees up 1 eraseblock
previously used by the "fakeroot" partition
for bypassing the OEM image verification.

Also, these Senao devices with a 'failsafe' partition
and the tar-gz factory.bin platform would otherwise require
flashing the new tar-gz sysupgrade.bin afterward.
So this also prevents having to flash both images
when starting from OEM or 'failsafe'

the OEM upgrade script verifies the header magic numbers,
but only the first two bytes.
Example:

    [ "${magic_word_kernel}" = "2705" ] &&
    [ "${magic_word_rootfs}" = "7371" -o "${magic_word_rootfs}" = "6873" ] &&
    errcode="0"

therefore picked the magic number
0x73714f4b
which is
'sqOK'

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 4a0cc5d4ef)
2021-06-11 07:20:31 +02:00
Michael Pratt 1f6ec4b29e ath79: lzma-loader: allow setting custom kernel magic
...and max flash offset

The mtdsplit parser was recently refactored
to allow the kernel to have custom image header magic.

Let's also do this for the lzma-loader

For example:
When implemented together,
this allows the kernel to "appear" to be a rootfs
by OEM software in order to write an image
that is actually kernel + rootfs.

At the same time,
it would boot to openwrt normally
by setting the same magic in DTS.

Both of the variables
have a default value that is unchanged
when not defined in the makefiles

This has no effect on the size of the loader
when lzma compressed.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 1b8bd17c2d)
2021-06-11 07:20:31 +02:00
Adrian Schmutzler 08ec7acbc3 ath79: create common DTSI for Senao qca955x APs
This creates a shared DTSI for qca955x Senao/Engenius APs with
concatenated firmware partition/okli loader:

 - EAP1200H
 - EnstationAC v1

To make this usable for future boards with 32 MB flash as well,
split the partitions node already.

Suggested-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 9b37db5caa)
2021-06-11 07:20:31 +02:00
Adrian Schmutzler 7850f5071a ath79: create common DTSI for Senao ar934x APs
This creates a shared DTSI for ar934x Senao/Engenius APs:

 - EAP300 v2
 - ENS202EXT v1
 - EAP600
 - ECB600

Since ar9341/ar9344 have different configuration, this new file
mostly contains the partitioning.

Suggested-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit ce8b535ed3)
2021-06-11 07:20:31 +02:00
Adrian Schmutzler a49686c948 ath79: create common DTSI for Senao ar724x APs
This creates a shared DTSI for ar724x Senao/Engenius APs:

 - ENH202 v1
 - EAP350 v1
 - ECB350 v1

Since ar7240/ar7242 have different configuration, this new file
mostly contains the partitioning.

Suggested-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 4204d70d7a)
2021-06-11 07:20:31 +02:00
Michael Pratt a1b2815b52 ath79: rename 'engenius' Makefile definitions to 'senao'
These recipes and definitions can apply
to devices from other vendors
with PCB boards or SDK produced by Senao
not only the brand Engenius

possible examples:
Extreme Networks, WatchGuard, OpenMesh,
Fortinet, ALLNET, OCEDO, Plasma Cloud, devolo, etc.

so rename all of these items
and move DEVICE_VENDOR from common to generic/tiny.mk

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 70bf4a979c)
2021-06-11 07:20:31 +02:00
Andreas Böhler 46b53ce83b ramips: Add support for SERCOMM NA502
The SERCOMM NA502 is a smart home gateway manufactured by SERCOMM and sold
under different brands (among others, A1 Telekom Austria SmartHome
Gateway). It has multi-protocol radio support in addition to LAN and WiFi.

Note: BLE is currently unsupported.

Specifications
--------------

  - MT7621ST 880MHz, Single-Core, Dual-Thread
  - MT7603EN 2.4GHz WiFi
  - MT7662EN 5GHz WiFi + BLE
  - 128MiB NAND
  - 256MiB DDR3 RAM
  - SD3503 ZWave Controller
  - EM357 Zigbee Coordinator

MAC address assignment
----------------------

LAN MAC is read from the config partition, WiFi 2.4GHz is LAN+2 and matches
the OEM firmware. WiFi 5GHz with LAN+1 is an educated guess since the
OEM firmware does not enable 5GHz WiFi.

Installation
------------
Attach serial console, then boot the initramfs image via TFTP.
Once inside OpenWrt, run sysupgrade -n with the sysupgrade file.

Attention: The device has a dual-firmware design. We overwrite kernel2,
since kernel1 contains an automatic recovery image.

If you get NAND ECC errors and are stuck with bad eraseblocks, try to
erase the mtd partition first with

mtd unlock ubi
mtd erase ubi

This should only be needed once.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
[use kiB for IMAGE_SIZE]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

(cherry picked from commit a3d8c1295e)
2021-06-10 17:09:35 +02:00
Tee Hao Wei 97df795b78 ramips: add support for Linksys EA8100 v1
Specifications:
- SoC: MT7621AT
- RAM: 256MB
- Flash: 128MB NAND
- Ethernet: 5 Gigabit ports
- WiFi: 2.4G/5G MT7615N
- USB: 1 USB 3.0, 1 USB 2.0

This device is very similar to the EA7300 v1/v2 and EA7500 v2.

Installation:

Upload the generated factory image through the factory web interface.

(following part taken from EA7300 v2 commit message:)

This might fail due to the A/B nature of this device. When flashing, OEM
firmware writes over the non-booted partition. If booted from 'A',
flashing over 'B' won't work. To get around this, you should flash the
OEM image over itself. This will then boot the router from 'B' and
allow you to flash OpenWRT without problems.

Reverting to factory firmware:

Hard-reset the router three times to force it to boot from 'B.' This is
where the stock firmware resides. To remove any traces of OpenWRT from
your router simply flash the OEM image at this point.

With thanks to Leon Poon (@LeonPoon) for the initial bringup.

Signed-off-by: Tee Hao Wei <angelsl@in04.sg>
[add missing entry in 10_fix_wifi_mac]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit b232680f84)
2021-06-10 17:09:35 +02:00
Jonathan Sturges 5e6837cf8f ramips: add support for Amped Wireless ALLY router and extender
Amped Wireless ALLY is a whole-home WiFi kit, with a router (model
ALLY-R1900K) and an Extender (model ALLY-00X19K).  Both are devices are
11ac and based on MediaTek MT7621AT and MT7615N chips.  The units are
nearly identical, except the Extender lacks a USB port and has a single
Ethernet port.

Specification:
- SoC: MediaTek MT7621AT (2C/4T) @ 880MHz
- RAM: 128MB DDR3 (Nanya NT5CC64M16GP-DI)
- FLASH: 128MB NAND (Winbond W29N01GVSIAA)
- WiFi: 2.4/5 GHz 4T4R
  - 2.4GHz MediaTek MT7615N bgn
  - 5GHz MediaTek MT7615N nac
- Switch: SoC integrated Gigabit Switch
- USB: 1x USB3 (Router only)
- BTN: Reset, WPS
- LED: single RGB
- UART:  through-hole on PCB.
   J1: pin1 (square pad, towards rear)=3.3V, pin2=RX,
   pin3=GND, pin4=TX.  Settings: 57600/8N1.

Note regarding dual system partitions
-------------------------------------

The vendor firmware and boot loader use a dual partition scheme.  The boot
partition is decided by the bootImage U-boot environment variable: 0 for
the 1st partition, 1 for the 2nd.

OpenWrt does not support this scheme and will always use the first OS
partition.  It will set bootImage to 0 during installation, making sure
the first partition is selected by the boot loader.

Also, because we can't be sure which partition is active to begin with, a
2-step flash process is used.  We first flash an initramfs image, then
follow with a regular sysupgrade.

Installation:

Router (ALLY-R1900K)
1) Install the flashable initramfs image via the OEM web-interface.
  (Alternatively, you can use the TFTP recovery method below.)
  You can use WiFi or Ethernet.
  The direct URL is:  http://192.168.3.1/07_06_00_firmware.html
  a. No login is needed, and you'll be in their setup wizard.
  b. You might get a warning about not being connected to the Internet.
  c. Towards the bottom of the page will be a section entitled "Or
  Manually Upgrade Firmware from a File:" where you can manually choose
  and upload a firmware file.
  d: Click "Choose File", select the OpenWRT "initramfs" image and click
  "Upload."
2) The Router will flash the OpenWrt initramfs image and reboot.  After
  booting, LuCI will be available on 192.168.1.1.
3) Log into LuCI as root; there is no password.
4) Optional (but recommended) is to backup the OEM firmware before
  continuing; see process below.
5) Complete the Installation by flashing a full OpenWRT image.  Note:
  you may use the sysupgrade command line tool in lieu of the UI if
  you prefer.
  a.  Choose System -> Backup/Flash Firmware.
  b.  Click "Flash Image..." under "Flash new firmware image"
  c.  Click "Browse..." and then select the sysupgrade file.
  d.  Click Upload to upload the sysupgrade file.
  e.  Important:  uncheck "Keep settings and retain the current
      configuration" for this initial installation.
  f.  Click "Continue" to flash the firmware.
  g.  The device will reboot and OpenWRT is installed.

Extender (ALLY-00X19K)
1) This device requires a TFTP recovery procedure to do an initial load
  of OpenWRT.  Start by configuring a computer as a TFTP client:
  a. Install a TFTP client (server not necessary)
  b. Configure an Ethernet interface to 192.168.1.x/24; don't use .1 or .6
  c. Connect the Ethernet to the sole Ethernet port on the X19K.
2) Put the ALLY Extender in TFTP recovery mode.
  a. Do this by pressing and holding the reset button on the bottom while
  connecting the power.
  b. As soon as the LED lights up green (roughly 2-3 seconds), release
  the button.
3) Start the TFTP transfer of the Initramfs image from your setup machine.
For example, from Linux:
tftp -v -m binary 192.168.1.6 69 -c put initramfs.bin
4) The Extender will flash the OpenWrt initramfs image and reboot.  After
booting, LuCI will be available on 192.168.1.1.
5) Log into LuCI as root; there is no password.
6) Optional (but recommended) is to backup the OEM firmware before
  continuing; see process below.
7) Complete the Installation by flashing a full OpenWRT image.  Note: you
may use the sysupgrade command line tool in lieu of the UI if you prefer.
  a.  Choose System -> Backup/Flash Firmware.
  b.  Click "Flash Image..." under "Flash new firmware image"
  c.  Click "Browse..." and then select the sysupgrade file.
  d.  Click Upload to upload the sysupgrade file.
  e.  Important:  uncheck "Keep settings and retain the current
      configuration" for this initial installation.
  f.  Click "Continue" to flash the firmware.
  g.  The device will reboot and OpenWRT is installed.

Backup the OEM Firmware:
-----------------------

There isn't any downloadable firmware for the ALLY devices on the Amped
Wireless web site. Reverting back to the OEM firmware is not possible
unless we have a backup of the original OEM firmware.

The OEM firmware may be stored on either /dev/mtd3 ("firmware") or
/dev/mtd6 ("oem").  We can't be sure which was overwritten with the
initramfs image, so backup both partitions to be safe.

  1) Once logged into LuCI, navigate to System -> Backup/Flash Firmware.
  2) Under "Save mtdblock contents," first select "firmware" and click
  "Save mtdblock" to download the image.
  3) Repeat the process, but select "oem" from the pull-down menu.

Revert to the OEM Firmware:
--------------------------
* U-boot TFTP:
  Follow the TFTP recovery steps for the Extender, and use the
  backup image.

* OpenWrt "Flash Firmware" interface:
  Upload the backup image and select "Force update"
  before continuing.

Signed-off-by: Jonathan Sturges <jsturges@redhat.com>

(cherry picked from commit 6d23e474ad)
2021-06-10 17:09:35 +02:00
Aashish Kulkarni 7cdddfb266 ramips: add support for Linksys E5600
This submission relied heavily on the work of Linksys EA7300 v1/ v2.

Specifications:

* SoC: MediaTek MT7621A (880 MHz 2c/4t)
* RAM: 128M DDR3-1600
* Flash: 128M NAND
* Eth: MediaTek MT7621A (10/100/1000 Mbps x5)
* Radio: MT7603E/MT7613BE (2.4 GHz & 5 GHz)
* Antennae: 2 internal fixed in the casing and 2 on the PCB
* LEDs: Blue (x4 Ethernet)
  Blue+Orange (x2 Power + WPS and Internet)
* Buttons: Reset (x1)
  WPS (x1)

Installation:

Flash factory image through GUI.

This device has 2 partitions for the firmware called firmware and
alt_firmware. To successfully flash and boot the device, the device
should have been running from alt_firmware partition. To get the device
booted through alt_firmware partition, download the OEM firmware from
Linksys website and upgrade the firmware from web GUI. Once this is done,
flash the OpenWrt Factory firmware from web GUI.

Reverting to factory firmware:

1. Boot to 'alt_firmware'(where stock firmware resides) by doing one of
   the following:
   Press the "wps" button as soon as power LED turns on when booting.
   (OR) Hard-reset the router consecutively three times to force it to
   boot from 'alt_firmware'.
2. To remove any traces of OpenWRT from your router simply flash the OEM
   image at this point.

Signed-off-by: Aashish Kulkarni <aashishkul@gmail.com>

[fix hanging indents and wrap to 74 characters per line,
 add kmod-mt7663-firmware-sta package for 5GHz STA mode to work,
 remove sysupgrade.bin and concatenate IMAGES instead in mt7621.mk,
 set default-state "on" for power LED]
Signed-off-by: Sannihith Kinnera <digislayer@protonmail.com>

[move check-size before append-metadata, remove trailing whitespace]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Sannihith Kinnera <digislayer@protonmail.com>
(cherry picked from commit 251c995cbb)
2021-06-10 17:09:35 +02:00
Chukun Pan 9fa5b3afc9 ramips: add support for JCG Q20
JCG Q20 is an AX 1800M router.

Hardware specs:
  SoC: MediaTek MT7621AT
  Flash: Winbond W29N01HV 128 MiB
  RAM: Winbond W632GU6NB-11 256 MiB
  WiFi: MT7915 2.4/5 GHz 2T2R
  Ethernet: 10/100/1000 Mbps x3
  LED: Status (red / blue)
  Button: Reset, WPS
  Power: DC 12V,1A

Flash instructions:
  Upload factory.bin in stock firmware's upgrade page,
  do not preserve settings.

MAC addresses map:
  0x00004 *:3e wlan2g/wlan5g
  0x3fff4 *:3c lan/label
  0x3fffa *:3c wan

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
(cherry picked from commit 57cb387cfe)
2021-06-10 17:09:35 +02:00
Leon M. George d11f40a0f7 ramips: add support for cudy WR2100
Specifications

  SoC:       MT7621
  CPU:       880 MHz
  Flash:     16 MiB
  RAM:       128 MiB
  WLAN:      2.4 GHz b/g/n, 5 GHz a/n/ac
             MT7603E / MT7615E
  Ethernet:  5x Gbit ports

Installation

There are two known options:
1) The Luci-based UI.
2) Press and hold the reset button during power up.
   The router will request 'recovery.bin' from a TFTP server at
   192.168.1.88.

Both options require a signed firmware binary.
The openwrt image supplied by cudy is signed and can be used to
install unsigned images.

R4 & R5 need to be shorted (0-100Ω) for the UART to work.

Signed-off-by: Leon M. George <leon@georgemail.eu>
[remove non-required switch-port node - remove trgmii phy-mode]
Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 3501db9b9b)
2021-06-10 17:09:35 +02:00
Georgi Vlaev 31be361269 ramips: add support for TP-Link Archer C6U v1 (EU)
This patch adds support for TP-Link Archer C6U v1 (EU).
The device is also known in some market as Archer C6 v3.
This patch supports only Archer C6U v1 (EU).

Specifications:
--------------

* SoC: Mediatek MT7621AT 2C2T, 880MHz
* RAM: 128MB DDR3
* Flash: 16MB SPI NOR flash (Winbond 25Q128)
* WiFi 5GHz: Mediatek MT7613BEN (2x2:2)
* WiFi 2.4GHz: Mediatek MT7603EN (2x2:2)
* Ethernet: MT7630, 5x 1000Base-T.
* LED: Power, WAN, LAN, WiFi 2GHz and 5GHz, USB
* Buttons: Reset, WPS.
* UART: Serial console (115200 8n1), J1(GND:3)
* USB: One USB2 port.

Installation:
------------

Install the OpenWrt factory image for C6U is from the
TP-Link web interface.

1) Go to "Advanced/System Tools/Firmware Update".
2) Click "Browse" and upload the OpenWrt factory image:
openwrt-ramips-mt7621-tplink_archer-c6u-v1-squashfs-factory.bin.
3) Click the "Upgrade" button, and select "Yes" when prompted.

Recovery to stock firmware:
--------------------------

The C6U bootloader has a failsafe mode that provides a web
interface (running at 192.168.0.1) for reverting back to the
stock TP-Link firmware. The failsafe interface is triggered
from the serial console or on failed kernel boot. Unfortunately,
there's no key combination that enables the failsafe mode. This
gives us two options for recovery:

1) Recover using the serial console (J1 header).
The recovery interface can be selected by hitting 'x' when
prompted on boot.

2) Trigger the bootloader failsafe mode.
A more dangerous option is force the bootloader into
recovery mode by erasing the OpenWrt partition from the
OpenWrt's shell - e.g "mtd erase firmware". Please be
careful, since erasing the wrong partition can brick
your device.

MAC addresses:
-------------

OEM firmware configuration:
D8:07:B6:xx:xx:83 : 5G
D8:07:B6:xx:xx:84 : LAN (label)
D8:07:B6:xx:xx:84 : 2.4G
D8:07:B6:xx:xx:85 : WAN

Signed-off-by: Georgi Vlaev <georgi.vlaev@konsulko.com>
(cherry picked from commit a46ad596a3)
2021-06-10 17:09:35 +02:00
Vinay Patil 30915e5a70 ramips: add support for TP-Link Archer A6 v3
The patch adds support for the TP-Link Archer A6 v3
The router is sold in US and India with FCC ID TE7A6V3

Specification
-------------
MediaTek MT7621 SOC
RAM:         128MB DDR3
SPI Flash:   W25Q128 (16MB)
Ethernet:    MT7530 5x 1000Base-T
WiFi 5GHz:   Mediatek MT7613BE
WiFi 2.4GHz: Mediatek MT7603E
UART/Serial: 115200 8n1

Device Configuration & Serial Port Pins
---------------------------------------
ETH Ports:    LAN4 LAN3 LAN2 LAN1 WAN
             _______________________
             |                     |
Serial Pins: |   VCC GND TXD RXD   |
             |_____________________|

LEDs:         Power Wifi2G Wifi5G LAN WAN

Build Output
------------
The build will generate following set of files
[1] openwrt-ramips-mt7621-tplink_archer-a6-v3-initramfs-kernel.bin
[2] openwrt-ramips-mt7621-tplink_archer-a6-v3-squashfs-factory.bin
[3] openwrt-ramips-mt7621-tplink_archer-a6-v3-squashfs-sysupgrade.bin

How to Use - Flashing from TP-Link Web Interface
------------------------------------------------
* Go to "Advanced/System Tools/Firmware Update".
* Click "Browse" and upload the OpenWrt factory image: factory.bin[2]
* Click the "Upgrade" button, and select "Yes" when prompted.

TFTP Booting
------------
Setup a TFTP boot server with address 192.168.0.5.
While starting U-boot press '4' key to stop autoboot.
Copy the initramfs-kernel.bin[1] to TFTP server folder, rename as test.bin
From u-boot command prompt run tftpboot followed by bootm.

Recovery
--------
Archer A6 V3 has recovery page activated if SPI booting from flash fails.
Recovery page can be activated from serial console only.
Press 'x' while u-boot is starting
Note: TFTP boot can be activated only from u-boot serial console.
Device recovery address: 192.168.0.1

Thanks to: Frankis for Randmon MAC address fix.

Signed-off-by: Vinay Patil <post2vinay@gmail.com>
[remove superfluous factory image definition, whitespacing]
Signed-off-by: David Bauer <mail@david-bauer.net>

(cherry picked from commit f8f8935adb)
2021-06-10 17:09:35 +02:00
Bjørn Mork 8c986d2ab9 ramips: mt7621: Add support for ZyXEL NR7101
The ZyXEL NR7101 is an 802.3at PoE powered 5G outdoor (IP68) CPE
with integrated directional 5G/LTE antennas.

Specifications:

 - SoC: MediaTek MT7621AT
 - RAM: 256 MB
 - Flash: 128 MB MB NAND (MX30LF1G18AC)
 - WiFi: MediaTek MT7603E
 - Switch: 1 LAN port (Gigabiti)
 - 5G/LTE: Quectel RG502Q-EA connected by USB3 to SoC
 - SIM: 2 micro-SIM slots under transparent cover
 - Buttons: Reset, WLAN under same cover
 - LEDs: Multicolour green/red/yellow under same cover (visible)
 - Power: 802.3at PoE via LAN port

The device is built as an outdoor ethernet to 5G/LTE bridge or
router. The Wifi interface is intended for installation and/or
temporary management purposes only.

UART Serial:

57600N1
Located on populated 5 pin header J5:

 [o] GND
 [ ] key - no pin
 [o] RX
 [o] TX
 [o] 3.3V Vcc

Remove the SIM/button/LED cover, the WLAN button and 12 screws
holding the back plate and antenna cover together. The GPS antenna
is fixed to the cover, so be careful with the cable.  Remove 4
screws fixing the antenna board to the main board, again being
careful with the cables.

A bluetooth TTL adapter is recommended for permanent console
access, to keep the router water and dustproof. The 3.3V pin is
able to power such an adapter.

MAC addresses:

OpenWrt OEM   Address          Found as
lan     eth2  08:26:97:*:*:BC  Factory 0xe000 (hex), label
wlan0   ra0   08:26:97:*:*:BD  Factory 0x4 (hex)
wwan0   usb0  random

WARNING!!

ISP managed firmware might at any time update itself to a version
where all known workarounds have been disabled.  Never boot an ISP
managed firmware with a SIM in any of the slots if you intend to use
the router with OpenWrt. The bootloader lock can only be disabled with
root access to running firmware. The flash chip is physically
inaccessible without soldering.

Installation from OEM web GUI:

- Log in as "supervisor" on https://172.17.1.1/
- Upload OpenWrt initramfs-recovery.bin image on the
  Maintenance -> Firmware page
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- (optional) Copy OpenWrt to the recovery partition. See below
- Sysupgrade to the OpenWrt sysupgrade image and reboot

Installation from OEM ssh:

- Log in as "root" on 172.17.1.1 port 22022
- scp OpenWrt initramfs-recovery.bin image to 172.17.1.1:/tmp
- Prepare bootloader config by running:
    nvram setro uboot DebugFlag 0x1
    nvram setro uboot CheckBypass 0
    nvram commit
- Run "mtd_write -w write initramfs-recovery.bin Kernel" and reboot
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- (optional) Copy OpenWrt to the recovery partition. See below
- Sysupgrade to the OpenWrt sysupgrade image and reboot

Copying OpenWrt to the recovery partition:

- Verify that you are running a working OpenWrt recovery image
  from flash
- ssh to root@192.168.1.1 and run:
    fw_setenv CheckBypass 0
    mtd -r erase Kernel2
- Wait while the bootloader mirrors Image1 to Image2

NOTE: This should only be done after successfully booting the OpenWrt
  recovery image from the primary partition during installation.  Do
  not do this after having sysupgraded OpenWrt!  Reinstalling the
  recovery image on normal upgrades is not required or recommended.

Installation from Z-Loader:

- Halt boot by pressing Escape on console
- Set up a tftp server to serve the OpenWrt initramfs-recovery.bin
  image at 10.10.10.3
- Type "ATNR 1,initramfs-recovery.bin" at the "ZLB>" prompt
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- Sysupgrade to the OpenWrt sysupgrade image

NOTE: ATNR will write the recovery image to both primary and recovery
  partitions in one go.

Booting from RAM:

- Halt boot by pressing Escape on console
- Type "ATGU" at the "ZLB>" prompt to enter the U-Boot menu
- Press "4" to select "4: Entr boot command line interface."
- Set up a tftp server to serve the OpenWrt initramfs-recovery.bin
  image at 10.10.10.3
- Load it using "tftpboot 0x88000000 initramfs-recovery.bin"
- Boot with "bootm  0x8800017C" to skip the 380 (0x17C) bytes ZyXEL
  header

This method can also be used to RAM boot OEM firmware. The warning
regarding OEM applies!  Never boot an unknown OEM firmware, or any OEM
firmware with a SIM in any slot.

NOTE: U-Boot configuration is incomplete (on some devices?). You may
  have to configure a working mac address before running tftp using
   "setenv eth0addr <mac>"

Unlocking the bootloader:

If you are unebale to halt boot, then the bootloader is locked.

The OEM firmware locks the bootloader on every boot by setting
DebugFlag to 0.  Setting it to 1 is therefore only temporary
when OEM firmware is installed.

- Run "nvram setro uboot DebugFlag 0x1; nvram commit" in OEM firmware
- Run "fw_setenv DebugFlag 0x1" in OpenWrt

  NOTE:
    OpenWrt does this automatically on first boot if necessary

  NOTE2:
    Setting the flag to 0x1 avoids the reset to 0 in known OEM
    versions, but this might change.

  WARNING:
    Writing anything to flash while the bootloader is locked is
    considered extremely risky. Errors might cause a permanent
    brick!

Enabling management access from LAN:

Temporary workaround to allow installing OpenWrt if OEM firmware
has disabled LAN management:

- Connect to console
- Log in as "root"
- Run "iptables -I INPUT -i br0 -j ACCEPT"

Notes on the OEM/bootloader dual partition scheme

The dual partition scheme on this device uses Image2 as a recovery
image only. The device will always boot from Image1, but the
bootloader might copy Image2 to Image1 under specific conditions. This
scheme prevents repurposing of the space occupied by Image2 in any
useful way.

Validation of primary and recovery images is controlled by the
variables CheckBypass, Image1Stable, and Image1Try.

The bootloader sets CheckBypass to 0 and reboots if Image1 fails
validation.

If CheckBypass is 0 and Image1 is invalid then Image2 is copied to
Image1.

If CheckBypass is 0 and Image2 is invalid, then Image1 is copied to
Image2.

If CheckBypass is 1 then all tests are skipped and Image1 is booted
unconditionally.  CheckBypass is set to 1 after each successful
validation of Image1.

Image1Try is incremented if Image1Stable is 0, and Image2 is copied to
Image1 if Image1Try is 3 or larger.  But the bootloader only tests
Image1Try if CheckBypass is 0, which is impossible unless the booted
image sets it to 0 before failing.

The system is therefore not resilient against runtime errors like
failure to mount the rootfs, unless the kernel image sets CheckBypass
to 0 before failing. This is not yet implemented in OpenWrt.

Setting Image1Stable to 1 prevents the bootloader from updating
Image1Try on every boot, saving unnecessary writes to the environment
partition.

Keeping an OpenWrt initramfs recovery as Image2 is recommended
primarily to avoid unwanted OEM firmware boots on failure. Ref the
warning above. It enables console-less recovery in case of some
failures to boot from Image1.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Tested-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 2449a63208)
2021-06-10 17:09:35 +02:00
Kevin Darbyshire-Bryant 27f4559281 firmware-utils: fix coverity zytrx.c resource leak
fix coverity resource leak warning:

    	*len = stat.st_size;
    	mapped = mmap(NULL, stat.st_size, PROT_READ, MAP_SHARED, fd, 0);
    	if (close(fd) < 0)
CID 1484880:  Resource leaks  (RESOURCE_LEAK)
Variable "mapped" going out of scope leaks the storage it points to.
    		return NULL;
    	return mapped;
    }

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit baf2a50ef3)
2021-06-10 17:09:35 +02:00
Bjørn Mork dd6f02a3f4 firmware-utils: zytrx: Add util for ZyXEL specific header
The ZyXEL NR7101 prepend an additional header to U-Boot images. This
header use the TRX magic 0x30524448 (HDR0), but is incompatible with
TRX images.

This code is reverse-engineered based on matching 32 bit numbers
found in the header with lengths and different checksum
calculations of the vendor images found on the device.  The result
was matched against the validation output produced by the
bootloader to name the associated header fields.

Example bootloader validation output:

 Zyxel TRX Image 1 --> Found!  Header Checksum OK
 ============ZyXEL header information==================
         chipId             : MT7621A
         boardId            : NR7101
         modelId            : 07 01 00 01
         kernel_len         : (14177560)
         kernelChksum       : (0x8DD31F69)
         swVersionInt       : 1.00(ABUV.0)D1
         swVersionExt       : 1.00(ABUV.0)D1

 Zyxel TRX Image 2 --> Found!  Header Checksum OK
 ============ZyXEL header information==================
         chipId             : MT7621A
         boardId            : NR7101
         modelId            : 07 01 00 01
         kernel_len         : (14176660)
         kernelChksum       : (0x951A7637)
         swVersionInt       : 1.00(ABUV.0)D0
         swVersionExt       : 1.00(ABUV.0)D0

 =================================================
 Check image validation:
 Image1 Header Magic Number --> OK
 Image2 Header Magic Number --> OK
 Image1 Header Checksum --> OK
 Image2 Header Checksum --> OK
 Image1 Data Checksum --> OK
 Image2 Data Checksum --> OK
 Image1 Stable Flag --> Stable
 Image1 Try Counter --> 0
 Image1: OK
 Image2: OK

The coverage and algorithm for the kernelChksum field is unknown.
This field is not validated by the bootloader or the OEM firmware
upgrade tool. It is therefore set to a static value for now.

The swVersion fields contain free form string values.  The OEM firmware
use ZyXEL structured version numbers as shown above.  The strings are
not interpreted or validated on boot, so they can be repurposed for
anything we want the bootloader to display to the user.  But the OEM
web GUI fails to flash images with freeform strings.

The purpose of the other strings in the header is not known.  The
values appear to be static.  We assume they are fixed for now, until
we have other examples.  One of these strings is the platform name,
which is taken as an input parameter for support other members of
the device family.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Tested-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 48cad07a55)
2021-06-10 17:09:35 +02:00
Adrian Schmutzler ec8fe0a189 treewide: make AddDepends/usb-serial selective
Make packages depending on usb-serial selective, so we do not have
to add kmod-usb-serial manually for every device.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 9397b22df1)
2021-06-08 22:50:32 +02:00
Felix Fietkau 4aae7eb3c0 wireless-regdb: update to version 2021.04.21
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit d76535c45e)
2021-06-08 20:44:12 +02:00
Hans Dedecker 3b4aac76b4 glibc: update to latest 2.33 HEAD (BZ #27892)
0ef0e6de7f powerpc: Fix handling of scv return error codes [BZ #27892]

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
(cherry picked from commit 507257778c)
2021-06-08 20:44:08 +02:00
Adrian Schmutzler 0eaff67b2a umbim: fix return value of proto_mbim_setup()
The variable name appears to be mistyped.

Suggested-by: Howard Chu <hyc@symas.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 6bc4c0ae3e)
2021-06-08 20:44:04 +02:00