EA7300 installing

Hello, i've seen instructions on the forum on how to flash one of the two partitions (and worked) but cant find how to flash the second one, or how can switch between them, assuming I can repeat the steps below. Is there some "not complex" method for booting the other partition? Will the same steps work?
I've read also in the forum that I can determine current part with /usr/sbin/fw_printenv -n boot_part and change the boot preference with /usr/sbin/fw_setenv boot_part 1 && reboot
or /usr/sbin/fw_setenv boot_part 2 && reboot
BUT i'm getting error:

 OpenWrt 22.03.0, r19685-512e76967f
 -----------------------------------------------------
root@OpenWrt:~# /usr/sbin/fw_printenv -n boot_part 1
root@OpenWrt:~# /usr/sbin/fw_setenv boot_part 2
Can't open /dev/mtd1: Permission denied
Error: can't write fw_env to flash

Thanks in advance

"Flash factory image through GUI. 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."

The u-boot (environment) partitions are read-only by default on most devices. You need to use kmod-mtd-rw to make it writeable if it's read-only.

# opkg install kmod-mtd-rw
# insmod mtd-rw i_want_a_brick=1

Or, if you don't like the above, modify your DTS to make the u-boot environment partition writable, and compile an image yourself.

Thanks for the answer.
Can you confirm I need to repeat the procedure as for the first partition, I mean is exactly the same steps (update stock FW with OEM fw and then the openwrt factory)?
Thanks again

Hi.
I have flashed a EA7300v2 last week.
You will boot from partition A with Linksys. Than Flash Linksys firmware again, than you will boot partition B with Linksys. Than flash OpenWrt, it will be on partition A. OpenWrt won't boot if on partition B.
The SET_ENV trick erases the bootcount, so that next partition boot will still be A.

There is a PR on master trunk to fix this, and to allow the use of luci-advanced-reboot, but it's sill not validated.

1 Like

Hello, and thanks for the info. I've successfully installed on "A". Not sure if I understood correctly "OpenWrt won't boot if on partition B." this means there is no point in installing it on both partitions right?
Thankyou

By default it does not, that's probably what luci-advanced-reboot is meant to work around.

The bootloader has a bootcounter. If the boot partition is not valid, it tries to boot it again. After three attempts, it switches to the "other", assuming it is still safe.
Problem is: after you've flashed OpenWrt from the Linksys GUI flash OpenWrt, it is not recognized as a valid partition by the bootloader.

If you install Openwrt on B, from Linksys on A, it won't boot. Partition B won't be find as valid by the bootloader. So after three attemps to boot B, the bootloader will switch back to A, hence Linksys.

If you install OpenWrt on A (from Linksys on B), it will boot, despite the bootloader declaring the partition not valid. The bootcounter will be increased. After the third boot on A, it will not boot anymore, and partition B (Linksys) will be booted instead.

The SET_ENV trick erases the bootcounter at each boot. So the router still boots A (Openwrt).
It took me a whole afternoon of tests to understand the whole process.

I'm looking forward to the PR to be approved, so the next major release will boot properly.

Yes, I have not dare to do this, the risk is that both partitions are declared unvalid. So I keep Linksys on partition B.
In order to flash a newer version, I use the power button override to manually switch to partition B. than I flash a factory image on A. After the first boot I restore the settings, which includes the SET_ENV trick.
That is not so tough as it looks like, I only flash each newer version one time.

Unfortunatly Luci-advanced-reboot doesn't work for this device. There is a PR for a patch that make it working properly. See also this.

1 Like

Thankyou very much, now is clear also to me. btw I actually didnt understand this when I flashed Openwrt, now the router is on, but it's not connected to the internet (only to my pc) if i turn it off for connecting it to the internet I risk to be on >= 3 reboots. So I will not have a chance anymore to install kmod-mtd-rw package then? I think I should have understood better the process before but is not much documented... Any idea for this situation?

A clean reboot doesn't increment the counter AFAIK. Only power failures, or you unplugging it mid-operation etc.

This sound good, I did only 1 "hard reboot" (with the power switch) I think if I remeber well.. Tonight I will try installing

kmod-mtd-rw

thanks for support

You don't need to turn off the router to connect the WAN, just plug.

Being connected to the internet or not doesn't matter. It just involves the boot process.If you boot more than three times, than the partition swap will occur. When I installed 22.03, I have willingly test this again, in order to confirm that the SET_ENV tweak is still necessary. Sadly it is.
.
I have not installed kmod-mtd-rw. Instead, I use this in /etc/local.rc

/rom/sbin/mtd unlock s_env
/rom/sbin/mtd erase s_env
exit 0

This is the SET_ENV tweak, it erases the s_env partition that stores the bootcounter. Sure this is a harsh method, but at least it works.

2 Likes

The bootloader boots the OpenWrt partition, so the user thinks that everything is alright. But the bootcounter is still incremented. After three reboots/poweroffs, the partition swap occurs. So the bootloader may declare the OpenWrt partition as non valid, but strangely still boots on it. In such case, I would expect the bootloader to reboot immediatly.

Yes I'm sorry I've read the post you shared in the thread late. I gave the commands while ssh connected:

> /rom/sbin/mtd unlock s_env
> /rom/sbin/mtd erase s_env

then I modified /etc/local.rc adding the 2 lines and after that I've chmod rc.local +x
so now should work...

Btw I also read luci-advanced-reboot and ea7300v2 seems supported the bug you are refferring is for V1, V2 or both?

(I cant bring the router to the internet cable because is in another room, too far)
Many thanks

1 Like

With this, you are trying to manually sets the boot partition ? To definitivly boots on OpenWrt ?
Try this by flashing OpenWrt on partition 1.
In case of you suceed, try to reboot several time (let say 4) just to be sure.
And let me know if it works :wink: I haven't try this method.

I can't tell. I remember trying when I setup the router for the first time (a few months ago) and didn't succeed. I also assume that if there is a PR for a patch to luci-advanced-reboot, that it is needed. Hence it's doesn't work without the patch.
BTW I don't own the router, I manage it, from a relative's home. I flashed 22.03 last week.

Ok I will do some tests tonight connecting it to internet. I've bought it yesterday on marketplace for 33€ seemed a good price to me.
Now is running with OpenWrt 22.03.0 and the /etc/local.rc "patch".
I plan to update it to snapshot if I see some commits for that specific model/architecture.
Will give updates here.
Thanks to all for support.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.