OpenWrt Support for Linksys EA8100-AH

Hi, I am trying to add support for Linksys EA8100-AH and EA7500v2.
Everything seems to went well, but I am facing a problem.

These Linksys routers are using some sort of A/B partitioning
When updating, if it is on partition A, it writes the new firmware to partition B, and vice versa
And it seems like they boots randomly to partition A and B.
So, when Openwrt is flashed onto the router, half the time when the router is booted we get Openwrt, another time we get Linksys firmware instead.

I am thinking about using a script to flash Openwrt to another partition when it booted.
Are there other solutions to this?

First of all, thanks for doing this. Second, when you send PR for these routers to be supported, please tag me, so I'd add support to luci-app-advanced-reboot.
Thirdly, have you checked the sysupgrade code for existing dual-partition routers? It may be of some help.

1 Like

Thanks for the quick reply,
other dual partition routers i am aware of only boots to the second partition when they detect a problem in the first partition, so they generally only use partition A for everything. I think only Linksys switch between them randomly

If this is really the case, you should always flash both partitions.
But i can not believe that it´s implemented randomly.

now i took a closer look at it, yea it is not really random
i cant find a way to limit it to for example partition A only

What if partition b hasn´t a valid uImage/fit image in it?
If this will force the usage of partition a, then it would be the best to use everything behind partition a for your rootfs.

if there partition B is empty / broken, the router will keep restarting until it switches to partition A and it will boot.

But I doesn't feel too good for deliberately "breaking" partition B, mainly because the router lacks a failsafe mode, if we broke partition B and anything wrong happened to partition A, we will need a serial adapter to recover from brick

Another hint...
Probably you need to set a uboot env var after a successful boot to keep the current partition active.

Here are some examples:

$ find target/linux/ -iname "bootcount" | sort

That contradicts my knowledge of majority of dual-boot routers with OpenWrt support.

Thanks! I found it on EA8300. I should look more deeper.

I found something interesting on the uboot env


I will take a closer look at it thanks!

using the EA8300 way does not seem to work, EA8300 uses a script to reset the boot counter everytime openwrt is booted to prevent it from witching to partition B. Bot boot_count is not an environment variable in EA8100's Uboot

run strings on factory uboot (partition) dump... should give you something notable... ( as would diffing u-env with both back on factory... then flash factory... the reboot a few times etc. etc. best to dump the env pre-load and post-load too )

1 Like

I found out that EA8300 are resetting the boot counter using mtd resetbc, which is provided by package/system/mtd/src/linksys_bootcount.c. But how I actually build this c file into my built?

EDIT: Nevermind i found it

Now I am facing a new problem, the Mac address in the factory partition for both wifi radio is not the same as in the original firmware.

I can confirm that the wifi driver is reading the correct mac address from the factory partition by using a hex editor to examine the factory partition.
I suspect that the original firmware patch the mac addresses during boot, how can I do the same on openwrt?

I tried using a script to do ip link set dev wlan0 address, but the mac is resetting every time wifi is re-enabled.

Which hardware are they using? MT7621 soc with dual MT7615N wifi?

Depends on hardware and from where you wanna derive it...
It´s a de-/incremented one of the lan/wan mac?

Yes, MT7621 soc with dual MT7615N for both EA8100AH an EA7500v2

Yes, bgn wifi is wan mac + 1, and ac is wan mac + 2

The solution on QCA devices for this problem is just dumping the factory partition and patch the dump file, and tell the driver to load the patched file instaed of loading the factory partition directly.
However, i cant find similar thing for mt76 driver.

I found this: seems like this feature is work in progress? But i am not sure

I successfully flashed the EA8100 with OpenWRT. Anybody else using the same? It is largely stable but will need to see overtime. There is an issue when you hardboot, it randomly picks up the original linksys firmware from boot partition. But couple of restarts and it comes back.

That indicates a wrongly configured bootcount script.

Anyway, can you test the ac wifi performance? It is not too good in my testing....

i also tring to flash EA8100 with OpenWRT but it was fail. can you teach me how to flash it?