openwrt/target/linux
Davide Fioravanti 31b49f02ca ramips: add support for Linksys EA7500 v2
The Linksys EA7500 v2 is advertised as AC1900, but its internal
hardware is AC2600 capable.

Hardware
--------
SoC:   Mediatek MT7621AT (880 MHz, 2 cores 4 threads)
RAM:   256M (Nanya NT5CC128M16IP-DI)
FLASH: 128MB NAND (Macronix MX30LF1G18AC-TI)
ETH:   5x 10/100/1000 Mbps Ethernet (MT7530)
WIFI:
  - 2.4GHz: 1x MT7615N (4x4:4)
  - 5GHz:   1x MT7615N (4x4:4)
  - 4 antennas: 3 external detachable antennas and 1 internal
USB:
  - 1x USB 3.0
  - 1x USB 2.0
BTN:
  - 1x Reset button
  - 1x WPS button
LEDS:
  - 1x White led (Power)
  - 6x Green leds (link lan1-lan4, link wan, wps)
  - 5x Orange leds (act lan1-lan4, act wan) (working but unmodifiable)

Everything works correctly.

Installation
------------
The “factory” openwrt image can be flashed directly from OEM stock
firmware. After the flash the router will reboot automatically.

However, due to the dual boot system, the first installation could fail
(if you want to know why, read the footnotes).
If the flash succeed and you can reach OpenWrt through the web
interface or ssh, you are done.
Otherwise the router will try to boot 3 times and then will
automatically boot the OEM firmware (don’t turn off the router.
Simply wait and try to reach the router through the web interface
every now and then, it will take few minutes).

After this, you should be back in the OEM firmware.

Now you have to flash the OEM Firmware over itself using the OEM web
interface (I tested it using the FW_EA7500v2_2.0.8.194281_prod.img
downloaded from the Linksys website).

When the router reboots flash the “factory” OpenWrt image and this
time it should work.

After the OpenWrt installation you have to use the sysupgrade image
for future updates.

Restore OEM Firmware
--------------------
After the OpenWrt flash, the OEM firmware is still stored in the
second partition thanks to the dual boot system.
You can switch from OpenWrt to OEM firmware and vice-versa failing
the boot 3 times in a row:
 1) power on the router
 2) wait 15 seconds
 3) power off the router
 4) repeat steps 1-2-3 twice more.
 5) power on the router and you should be in the “other” firmware

If you want to completely remove OpenWrt from your router, switch to
the OEM firmware and then flash OEM firmware from the web interface
as a normal update.
This procedure will overwrite the OpenWrt partition.

Footnotes
---------
The Linksys EA7500-v2 has a dual boot system to avoid bricks.
This system works using 2 pair of partitions:
 1) "kernel" and "rootfs"
 2) "alt_kernel" and "alt_rootfs".
After 3 failed boot attempts, the bootloader tries to boot the other
pair of partitions and so on.

This system is managed by the bootloader, which writes a bootcount in
the s_env partition, and if successfully booted, the system add a
"zero-bootcount" after the previous value.

A system update performed from OEM firmware, writes the firmware on the
other pair of partitions and sets the bootloader to boot the new pair
of partitions editing the “boot_part” variable in the bootloader vars.
Effectively it's a quick and safe system to switch the selected boot
partition.

Another way to switch the boot partition is:
 1) power on the router
 2) wait 15 seconds
 3) power off the router
 4) repeat steps 1-2-3 twice more.
 5) power on the router and you should be in the “other” firmware

In this OpenWrt port, this dual boot system is partially working
because the bootloader sets the right rootfs partition in the cmdline
but unfortunately OpenWrt for ramips platform overwrites the cmdline
so is not possible to detect the right rootfs partition.

Because all of this, I preferred to simply use the first pair of
partitions and set read-only the other pair.

However this solution is not optimal because is not possible to know
without opening the case which is the current booted partition.
Let’s take for example a router booting the OEM firmware from the first
pair of partitions. If we flash the OpenWrt image, it will be written
on the second pair. In this situation the router will bootloop 3 times
and then will automatically come back to the first pair of partitions
containg the OEM firmware.
In this situation, to flash OpenWrt correctly is necessary to switch
the booting partition, flashing again the OEM firmware over itself.
At this point the OEM firmware is on both pair of partitions but the
current booted pair is the second one.
Now, flashing the OpenWrt factory image will write the firmware on
the first pair and then will boot correctly.

If this limitation in the ramips platform about the cmdline will be
fixed, the dual boot system can also be implemented in OpenWrt with
almost no effort.

Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
Co-Developed-by: Jackson Lim <jackcolentern@gmail.com>
Signed-off-by: Jackson Lim <jackcolentern@gmail.com>
2020-05-17 18:44:28 +02:00
..
apm821xx kernel: bump 5.4 to 5.4.36 2020-04-30 00:52:04 +02:00
ar71xx ar71xx: mikrotik: mach-rbspi.c remove wlan id 2020-05-12 12:41:12 +02:00
arc770 treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
archs38 archs38: switch to kernel 5.4 by default 2020-03-29 16:23:57 +02:00
armvirt kernel: remove non-existant symbols 2020-04-13 22:40:19 +02:00
at91 treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
ath25 treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
ath79 ath79: increase spi frequency on tp-link tl-wr1043nd v2 2020-05-15 10:00:32 +08:00
bcm27xx bcm27xx: drop outdated kernel version switches from patches-5.4 2020-05-17 18:36:10 +02:00
bcm47xx kernel: bump 4.19 to 4.19.122 2020-05-12 12:36:28 +02:00
bcm53xx kernel: bump 5.4 to 5.4.36 2020-04-30 00:52:04 +02:00
bcm63xx bcm63xx: periph_intc: report effective affinity 2020-05-14 18:10:12 +02:00
cns3xxx cns3xx: remove support for kernel 4.14 2020-04-12 13:43:52 +02:00
gemini samba36: Remove 2020-05-08 03:32:52 +03:00
generic generic: drop outdated kernel version switches in local drivers 2020-05-17 18:35:59 +02:00
imx6 imx6: add back perf monitor related config symbol 2020-04-25 13:22:28 +02:00
ipq40xx ipq40xx: replace "ok" with "okay" for status in DTS files 2020-05-12 19:16:41 +02:00
ipq806x ipq806x: switch to 5.4 kernel 2020-04-09 00:12:46 +02:00
ipq807x treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
kirkwood kirkwood: disable image for Linksys EA3500 (Audi) 2020-04-29 18:04:16 +02:00
lantiq lantiq: drop outdated kernel version switches from patches-5.4 2020-05-17 18:36:21 +02:00
layerscape kernel: bump 5.4 to 5.4.40 2020-05-12 12:36:28 +02:00
malta malta: Remove kernel 4.14 support 2020-03-12 09:28:23 +01:00
mediatek kernel: bump 5.4 to 5.4.39 2020-05-07 12:53:06 +02:00
mpc85xx treewide: Don't diverge from upstream default HZ settings on 4.19 2020-03-29 17:27:54 +01:00
mvebu mvebu: uDPU: switch default kernel and U-Boot PHY mode 2020-05-09 14:34:23 +02:00
mxs kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
octeon octeon: use kernel version 5.4 for testing 2020-04-23 18:38:54 +02:00
octeontx kernel: bump 5.4 to 5.4.38 2020-05-04 21:09:12 +02:00
omap omap: remove support for kernel 4.14 2020-04-28 01:10:48 +02:00
oxnas oxnas: move service file to correct place 2020-04-26 21:05:15 +02:00
pistachio treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
ramips ramips: add support for Linksys EA7500 v2 2020-05-17 18:44:28 +02:00
rb532 treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
rockchip rockchip: add support for Pine64 RockPro64 2020-04-20 16:37:56 +02:00
samsung treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
sunxi sunxi: remove unneeded shebang for preinit files 2020-05-05 13:09:19 +02:00
tegra tegra: correct cpu subtype 2020-03-28 22:58:36 +01:00
uml treewide: Remove self from MAINTAINER entries 2019-12-23 13:18:04 -08:00
x86 x86: fix unusable squashfs images by adding missing padding 2020-04-26 12:53:27 +02:00
zynq zynq: switch to kernel 5.4 2020-03-17 00:51:48 +01:00
Makefile