Web UI to reboot to another partition (for Linksys/ZyXEL dual-partition routers) and to power off/power down

Yes, if you can, please provide relevant dumps of mtd3 (with various states of failed boot counts) as well as the information requested for new devices in the README in a single post.

I don't know, is it?

Thanks, what state is that in (how many failed boot counts)? Where's the rest of the partition?

Yes, that's enough.
U-boot is just changing boot_part variable after 3 failed boots.

This is the 3rd failed boot.
And the system must write the following data (reset counter) after each successful boot:

Code to reset counter: https://github.com/openwrt/openwrt/blob/main/package/system/mtd/src/linksys_bootcount.c

1 Like

Thanks to the information provided by @lytr, the luci-app-advanced-reboot 1.0.1-14 from my repo has support for Linksys EA6350v4. Since I either didn't see or missed dumps from the kernel to figure out where the label would be, I've used offset 32 as with some other Linksys devices where the kernels are in the mtd5/mtd7. It's possible that the offset would need to be changed to 192 to match the Linksys EA6350v3 tho.

@lytr @Seraphin please try the version 1.0.1-14 on Linksys EA6350v4 and let me know if it works. I'll create PR for snapshots/23.05 if it does.

PS. I'd like to credit you for info/testing in the PR, please let me know your github usernames if you have them.

1 Like

Unfortunately I am not able to test this, I do not have the device :slight_smile:
What is labelOffset used for?

edit:
I downloaded the package onto my pc and uploaded it via the Web UI, then following error is shown:

Not downgrading package luci-app-advanced-reboot on root from 1.0.1-r10 to 1.0.1-14.

1 Like

you'd have to use CLI and use --force-downgrade parameter for opkg, like this:

opkg install --force-downgrade /tmp/luci-app-advanced-reboot*.ipk

So I did it via the terminal ...

wget https://github.com/stangri/repo.openwrt.melmac.net/raw/master/luci-app-advanced-reboot_1.0.1-14_all.ipk
opkg install --force-downgrade /tmp/luci-app-advanced-reboot_1.0.1-14_all.ipk

... after a reboot, the Web UI software page shows 1.0.1-14 as installed but wenn I open the advanced reboot page it still says, that my EA6350 v4 is unsupported.

Warning: Device (linksys,ea6350-v4) is unknown or isn't a dual-firmware device!

On my actual partition is OpenWrt running ... on the second partition is still the stock Linksys firmware, do I need to flash it first?

My bad, didn't notice the dash before the version in the model name, fixed in 1.0.1-15.

Yeah, looks fine on a first sight now.

The advanced reboot page shows the correct OpenWrt version to reboot into the current partition, while it shows Linksys for the alternate partition. I can boot from OpenWrt back to OpenWrt as also to Linksys. I can boot from Linksys back to Linksys as also to OpenWrt.

Next I'll look into replacing stock Linksys with OpenWrt too, for booting between each other OpenWrt partitions ...

... do you still need any dumps for further optimizations?

As you asked about github for crediting, I'm not using it actively, but made an account once:
https://github.com/Seraphin84 ... thank you for appreciating my request, as also my help.

1 Like

Just in case, you are waiting for my further test ... I didn't manage to get OpenWrt on both partitions. A look into the source by slh, he thinks it's not possible to flash onto the second partition anyway.

The advanced reboot itself worked fine, everytime I used it to switch between Linksys and OpenWrt.

Just to be clear here, it would be possible - if someone with the device would spent some time on developing this. Probably 15-40 lines of actual code, but quite a lot of time necessary for the detailed investigation what needs to be done. It is reasonable (and should be done), but can only be accomplished by someone with the device, some experience (or willing to master a medium steep learning curve) and serial console access.

--
It's not so much doing new/ unique fundamental development, but investigating what the OEM firmware is doing, how that correlates to the provided target capabilities, intelligently documenting what needs doing and then hooking up the bits and pieces.

Thanks for clarification, slh ... that's the way I understood*, but shortened it as it's the actual situation. From my experience I think I'm not used to programming enough, to dig so deep into it ... at least not on my own in self-studying with the risk to brick it in total.

*) .... that's why I didn't mark your answer as solution yet. :wink:

Anyway, I linked/quoted your answer in my own topic about dual partition installation of OpenWrt on the EA6350v4, as I don't want to hijack stangris thread. :slight_smile:

I'll try to find and read the correct source, maybe there will be some way to get the hang of it.

I have a MX5500 and here are the results.

root@LinksysOpenWrt:/tmp# ubus call system board
{
        "kernel": "6.6.54",
        "hostname": "LinksysOpenWrt",
        "system": "ARMv8 Processor rev 4",
        "model": "Linksys MX5500",
        "board_name": "linksys,mx5500",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "revision": "r27686-6b82823c9b",
                "target": "qualcommax/ipq50xx",
                "description": "OpenWrt SNAPSHOT r27686-6b82823c9b"
        }
}
root@LinksysOpenWrt:/tmp# cat /tmp/sysinfo/board_name
linksys,mx5500

root@LinksysOpenWrt:/tmp# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "0:SBL1"
mtd1: 00020000 00020000 "0:MIBIB"
mtd2: 00100000 00020000 "0:QSEE"
mtd3: 00040000 00020000 "0:DEVCFG"
mtd4: 00040000 00020000 "0:CDT"
mtd5: 00020000 00020000 "0:APPSBLENV"
mtd6: 00140000 00020000 "0:APPSBL"
mtd7: 00100000 00020000 "0:ART"
mtd8: 00080000 00020000 "0:TRAINING"
mtd9: 00080000 00020000 "u_env"
mtd10: 00040000 00020000 "s_env"
mtd11: 00040000 00020000 "devinfo"
mtd12: 05200000 00020000 "kernel"
mtd13: 04a00000 00020000 "rootfs"
mtd14: 05200000 00020000 "alt_kernel"
mtd15: 04a00000 00020000 "alt_rootfs"
mtd16: 00200000 00020000 "sysdiag"
mtd17: 04400000 00020000 "syscfg"
root@LinksysOpenWrt:/tmp# fw_printenv
altkern=58c0000
auto_recovery=yes
baudrate=115200
boot_part_ready=3
boot_ver=3.1.02
bootargs=console=ttyMSM0,115200n8
bootcmd=if test $auto_recovery = no; then bootipq; elif test $boot_part = 1; then run bootpart1; else run bootpart2; fi
bootdelay=3
bootpart1=setenv bootargs $partbootargs && nand read $loadaddr $prikern $kernsize && bootm $loadaddr
bootpart2=setenv bootargs $partbootargs2 && nand read $loadaddr $altkern $kernsize && bootm $loadaddr
dload_dis=1
ethaddr=00:03:7f:ba:db:ad
fdt_high=0x4A400000
fdtcontroladdr=4a9c4004
flash_type=11
flashimg=tftp $loadaddr $image && nand erase $prikern $imgsize && nand write $loadaddr $prikern $filesize
flashimg2=tftp $loadaddr $image && nand erase $altkern $imgsize && nand write $loadaddr $altkern $filesize
image=MX5500.img
imgsize=5200000
ipaddr=192.168.1.1
kernsize=800000
loadaddr=44000000
machid=8040001
mtddevname=fs
mtddevnum=0
mtdids=nand0=nand0
mtdparts=mtdparts=nand0:0x4a00000@0xec0000(fs),
netmask=255.255.255.0
partbootargs=init=/sbin/init rootfstype=squashfs ubi.mtd=rootfs root=mtd:squashfs rootwait
partbootargs2=init=/sbin/init rootfstype=squashfs ubi.mtd=alt_rootfs root=mtd:squashfs rootwait
prikern=6c0000
serverip=192.168.1.254
soc_hw_version=20180101
soc_version_major=1
soc_version_minor=1
stderr=serial@78AF000
stdin=serial@78AF000
stdout=serial@78AF000
boot_part=1
root@LinksysOpenWrt:/tmp#

So have you tried rebooting to another partition thru CLI commands?

Sorry, I should have included more information. I updated the advance boot on my snapshot router and that's when I broke advance boot.

I defaulted back to the snapshot and the advance boot is working again.

Are you saying that when you've upgraded with luci-app-advanced-reboot from 1.0.1-13 to 1.0.1-15 it stopped working for Linksys MX5500? What was happening after an upgrade?

This is the snapshot I used for my MX5500.

This is what I see when I press update list and yes, if I upgrade the luci-app-advanced-reboot, it shops working.

Thanks for your reply. Please reach out to whoever's provided that MX5500 build you're using and ask them to send me a PR for MX5500 support for luci-app-advanced-reboot.

You seem to be using a custom build with a custom/hacked package and once you upgrade to an official one, the MX5500 support is gone.

Linksys MX5300. Added in 24.10rc2

ubus call system board

{
        "kernel": "6.6.63",
        "hostname": "WifiAP",
        "system": "ARMv8 Processor rev 4",
        "model": "Linksys MX5300",
        "board_name": "linksys,mx5300",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "24.10.0-rc2",
                "revision": "r28161-ea17e958b9",
                "target": "qualcommax/ipq807x",
                "description": "OpenWrt 24.10.0-rc2 r28161-ea17e958b9",
                "builddate": "1733226068"
        }
}

cat /tmp/sysinfo/board_name

linksys,mx5300

cat /proc/mtd

dev:    size   erasesize  name
mtd0: 00100000 00020000 "0:sbl1"
mtd1: 00100000 00020000 "0:mibib"
mtd2: 00080000 00020000 "0:bootconfig"
mtd3: 00080000 00020000 "0:bootconfig1"
mtd4: 00300000 00020000 "0:qsee"
mtd5: 00300000 00020000 "0:qsee_1"
mtd6: 00080000 00020000 "0:devcfg"
mtd7: 00080000 00020000 "0:devcfg_1"
mtd8: 00080000 00020000 "0:apdp"
mtd9: 00080000 00020000 "0:apdp_1"
mtd10: 00080000 00020000 "0:rpm"
mtd11: 00080000 00020000 "0:rpm_1"
mtd12: 00080000 00020000 "0:cdt"
mtd13: 00080000 00020000 "0:cdt_1"
mtd14: 00080000 00020000 "0:appsblenv"
mtd15: 00100000 00020000 "0:appsbl"
mtd16: 00100000 00020000 "0:appsbl_1"
mtd17: 00080000 00020000 "0:art"
mtd18: 00040000 00020000 "u_env"
mtd19: 00020000 00020000 "s_env"
mtd20: 00020000 00020000 "devinfo"
mtd21: 09600000 00020000 "kernel"
mtd22: 09000000 00020000 "rootfs"
mtd23: 09600000 00020000 "alt_kernel"
mtd24: 09000000 00020000 "alt_rootfs"
mtd25: 00200000 00020000 "sysdiag"
mtd26: 00080000 00020000 "0:ethphyfw"
mtd27: 0b800000 00020000 "syscfg"
mtd28: 00900000 00020000 "0:wififw"

fw_printenv

FwSize=0x9600000
altKernAddr=0xa680000
auto_recovery=yes
baudrate=115200
boot_part=2
boot_part_ready=3
bootargs=console=ttyMSM0,115200n8
bootcmd=aq_load_fw && if test $auto_recovery = no; then bootipq; elif test $boot_part = 1; then run bootpart1; else run bootpart2; fi
bootdelay=2
bootpart1=setenv bootargs $partbootargs1 && nand read $loadaddr $priKernAddr $kernsize && bootm $loadaddr
bootpart2=setenv bootargs $partbootargs2 && nand read $loadaddr $altKernAddr $kernsize && bootm $loadaddr
dumpipq_data=0
eth1addr=E8:9F:80:61:99:00
eth2addr=E8:9F:80:61:99:00
eth3addr=E8:9F:80:61:99:00
eth4addr=E8:9F:80:61:99:00
eth5addr=E8:9F:80:61:99:00
ethact=eth0
ethaddr=E8:9F:80:61:99:00
fdt_high=0x4A400000
fdtcontroladdr=4a97b130
firmwareName=bronx.img
flash_alt_image=tftpboot $loadaddr $firmwareName && nand erase $altKernAddr $FwSize && nand write $loadaddr $altKernAddr $filesize
flash_both_images=run flash_pri_image && nand erase $altKernAddr $FwSize && nand write $loadaddr $altKernAddr $filesize
flash_pri_image=tftpboot $loadaddr $firmwareName && nand erase $priKernAddr $FwSize && nand write $loadaddr $priKernAddr $filesize
flash_type=2
ipaddr=192.168.1.1
kernsize=0x600000
loadaddr=0x44000000
machid=8010008
mtdids=nand0=nand0
netmask=255.255.255.0
partbootargs1=console=ttyMSM0,115200n8 ubi.mtd=rootfs root=ubi0:ubifs rootfstype=ubifs rootwait swiotlb=1
partbootargs2=console=ttyMSM0,115200n8 ubi.mtd=alt_rootfs root=ubi0:ubifs rootfstype=ubifs rootwait swiotlb=1
priKernAddr=0x1080000
sdk_ver=es2
serverip=192.168.1.254
soc_version_major=2
soc_version_minor=0
stderr=serial@78B3000
stdin=serial@78B3000
stdout=serial@78B3000
wan_phy=1G
1 Like

Thank you for all the information, the implementation commit doesn't explicitly say if dual-booting of OpenWrt is supported or not, so version 1.0.1-r16 from my repo has support for MX5300, please test and report back so I could create the PR for snapshots/24.10 trees of OpenWrt repo.