Got it installed and it shows both partitions.
However it only ever reboots to the first partition. I tried setting the partition via cli:
fw_setenv boot_part 2
that doesnt work either.
Got it installed and it shows both partitions.
However it only ever reboots to the first partition. I tried setting the partition via cli:
fw_setenv boot_part 2
that doesnt work either.
Maybe reach out to whoever authored the support commit for this device and ask for clarification how to switch between boot partitions.
Ok everything seems to be working now. My issue was self-inflicted. The image I used was custom-built using the firmware selector and when I flashed the other partition it wasn't right. It would try to boot to the other partition then fail and boot back to the other partition. I have since gone to the default rc2 images on both partitions and can switch back and forth just fine.
Thanks, PRs created, I'll merge them after CI is done.
Hi there!
I have Beeline SmartBox GIGA (https://openwrt.org/ru/toh/beeline/smartbox_giga)
ubus call system board
{
"kernel": "5.15.167",
"hostname": "router",
"system": "MediaTek MT7621 ver:1 eco:3",
"model": "Beeline SmartBox GIGA",
"board_name": "beeline,smartbox-giga",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "23.05.5",
"revision": "r24106-10cc5fcd00",
"target": "ramips/mt7621",
"description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
}
}
cat /tmp/sysinfo/board_name
beeline,smartbox-giga
root@router:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00100000 00020000 "dynamic partition map"
mtd2: 00100000 00020000 "Factory"
mtd3: 00100000 00020000 "Boot Flag"
mtd4: 00600000 00020000 "kernel"
mtd5: 00600000 00020000 "Kernel 2"
mtd6: 01800000 00020000 "File System 1"
mtd7: 01800000 00020000 "File System 2"
mtd8: 00800000 00020000 "Configuration/log"
mtd9: 00c00000 00020000 "application tmp buffer (Ftool)"
mtd10: 02800000 00020000 "container"
mtd11: 00380000 00020000 "bad block reserved"
mtd12: 05400000 00020000 "ubi"
fw_printenv
Warning: Bad CRC, using default environment
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
baudrate=115200
I've created a device JSON to add support in luci-app-advanced-reboot
for changing the boot partition on my Linksys E7350 (which only supports OpenWrt on partition 1).
Changing the bootimage
variable does successfully change the boot partition, but the only way for me to switch back to OpenWrt (partition 1) from the Linksys OEM firmware (partition 2) is by using the 3 failed boots method (each boot failure increments a counter until bootimage
is changed to the other partition) or via serial console.
I assume this is also the case for switching back to an OpenWrt partition on other (at least Linksys) routers as well, but please correct me if I'm wrong.
EDIT: Already addressed here and here
Here's my device JSON and a screenshot of the Advanced Reboot page, let me know if it looks good/if I should submit a PR (to openwrt/luci
or stangri/luci-app-advanced-reboot
):
{
"vendorName": "Linksys",
"deviceName": "E7350",
"boardNames": [ "linksys,e7350" ],
"partition1MTD": "mtd3",
"partition2MTD": "mtd6",
"labelOffset": 192,
"bootEnv1": "bootimage",
"bootEnv1Partition1Value": 1,
"bootEnv1Partition2Value": 2,
"bootEnv2": null,
"bootEnv2Partition1Value": null,
"bootEnv2Partition2Value": null
}
(These changes may also work on the Belkin RT1800 as it's the exact same hardware, but I don't have one to test on.)
I think my labelOffset
is correct (the firmware names in the screenshot above are correct), but here are the first 2K of both my mtd3 & mtd6 partitions if you want to check.
Here are the outputs of ubus call system board
, cat /tmp/sysinfo/board_name
, cat /proc/mtd
, and fw_printenv
as well:
root@OpenWrt:~# ubus call system board
{
"kernel": "6.6.69",
"hostname": "OpenWrt",
"system": "MediaTek MT7621 ver:1 eco:3",
"model": "Linksys E7350",
"board_name": "linksys,e7350",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "24.10.0-rc5",
"revision": "r28304-6dacba30a7",
"target": "ramips/mt7621",
"description": "OpenWrt 24.10.0-rc5 r28304-6dacba30a7",
"builddate": "1736026537"
}
}
root@OpenWrt:~# cat /tmp/sysinfo/board_name
linksys,e7350
root@OpenWrt:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00020000 "Boot"
mtd1: 00080000 00020000 "Config"
mtd2: 00080000 00020000 "Factory"
mtd3: 03000000 00020000 "firmware"
mtd4: 00400000 00020000 "kernel"
mtd5: 02c00000 00020000 "ubi"
mtd6: 03000000 00020000 "alt_firmware"
mtd7: 00080000 00020000 "cbtinfo"
root@OpenWrt:~# fw_printenv
baudrate=115200
boot_ver=V0.2
bootcmd=mtkautoboot
bootdelay=0
bootimage=1
bootmenu_0=Startup system (Default)=mtkboardboot
bootmenu_1=Upgrade firmware=mtkupgrade fw
bootmenu_2=Upgrade bootloader=mtkupgrade bl
bootmenu_3=Upgrade bootloader (advanced mode)=mtkupgrade bladv
bootmenu_4=Load image=mtkload
bootmenu_5=Upgrade firmware with code pattern=mtkupgrade pfw
fdtcontroladdr=8ffece60
ipaddr=192.168.1.1
netmask=255.255.255.0
serverip=192.168.1.2
stderr=uartlite0@1e000c00
stdin=uartlite0@1e000c00
stdout=uartlite0@1e000c00
bootcount=0
Also, just to confirm, is bootEnv2
in a device JSON for devices that require manually setting two U-Boot variables instead of one in order to change the boot partition?
Hi! I have a Linksys E8450 [OpenWrt Wiki] Linksys E8450 (aka. Belkin RT3200) with UBI layout and ARM Trusted Firmware v2024.01.17~bacca82a-3 (v.1.1.3) which does not seem to be yet supported (MTD Layout is)
ubus call system board
cat /tmp/sysinfo/board_name
cat /proc/mtd
fw_printenv
root@OpenWrt:~# cat /tmp/sysinfo/board_name
linksys,e8450-ubi
root@OpenWrt:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00020000 "bl2"
mtd1: 07f80000 00020000 "ubi"
root@OpenWrt:~# fw_printenv
boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
boot_recovery=led $bootled_rec on ; run ubi_read_recovery ; bootm $loadaddr#$bootconf ; ubi remove recovery ; led $bootled_rec off
boot_serial_write_bl2=loadx $loadaddr 115200 && run snand_write_bl2
boot_serial_write_fip=loadx $loadaddr 115200 && run ubi_write_fip
boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
boot_tftp_production=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && ubi part ubi && run ubi_write_production ubi_prepare_rootfs ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && ubi part ubi && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2
boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip
boot_ubi=ubi part ubi && run boot_production ; run boot_recovery
bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
bootconf=config-1
bootdelay=3
bootfile=openwrt-mediatek-mt7622-linksys_e8450-ubi-initramfs-recovery.itb
bootfile_bl2=openwrt-mediatek-mt7622-linksys_e8450-ubi-preloader.bin
bootfile_fip=openwrt-mediatek-mt7622-linksys_e8450-ubi-bl31-uboot.fip
bootfile_upg=openwrt-mediatek-mt7622-linksys_e8450-ubi-squashfs-sysupgrade.itb
bootled_pwr=power:blue
bootled_rec=inet:orange on
bootmenu_0=Run default boot command.=run boot_default
bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return
bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return
bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to flash.=run boot_tftp_write_fip ; run bootmenu_confirm_return
bootmenu_7=Load BL2 preloader via TFTP then write to flash.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
bootmenu_8=Reboot.=reset
bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
bootmenu_default=0
bootmenu_delay=3
bootmenu_title= ( ( ( OpenWrt ) ) ) U-Boot 2024.07-OpenWrt-r27137-f51cb74473 (Aug 12 2024 - 22:48:06 +0000)
ethaddr=d8:ec:5e:95:8e:20
filesize=80000
ipaddr=192.168.1.1
loadaddr=0x48000000
reset_factory=mw $loadaddr 0xff 0x1f000 ; ubi part ubi ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data
serverip=192.168.1.254
snand_write_bl2=mtd erase bl2 && mtd write spi-nand0 $loadaddr 0x0 0x20000 && mtd write spi-nand0 $loadaddr 0x20000 0x20000 && mtd write spi-nand0 $loadaddr 0x40000 0x20000 && mtd write spi-nand0 $loadaddr 0x60000 0x20000
ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
ubi_write_production=ubi check fit && env exists replacevol && ubi remove fit ; if ubi check fit ; then else run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ; fi
ubi_write_recovery=ubi check recovery && env exists replacevol && ubi remove recovery ; if ubi check recovery ; then else run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ; fi
ver=U-Boot 2024.07-OpenWrt-r27137-f51cb74473 (Aug 12 2024 - 22:48:06 +0000)
Correct! Thank you for the contribution, I've added your json file to luci-app-advanced-reboot 1.0.1-r17
available from both OPKG and APK versions of my repo and will create a PR and merge changes to the OpenWrt luci repo before the end of the week.
From that output I don't see the dual-boot support in OpenWrt on this device. Support commit description may shed some light.
PRs created for snapshots and 24.10 for support for:
Hi. I'm not sure if NETGEAR WAX630 is dual-firmware device as I was not able to find this information anywhere but from what I've witnessed it most likely is.
Device info:
https://openwrt.org/toh/hwdata/netgear/netgear_wax630
Commit to add support:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=5e33fdfc47eeb3620536baaa1de13fbd2e6b5d62
~# ubus call system board
{
"kernel": "6.6.73",
"hostname": "ufo",
"system": "ARMv8 Processor rev 4",
"model": "Netgear WAX630",
"board_name": "netgear,wax630",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "24.10.0",
"revision": "r28427-6df0e3d02a",
"target": "qualcommax/ipq807x",
"description": "OpenWrt 24.10.0 r28427-6df0e3d02a",
"builddate": "1738624177"
}
}
~# cat /tmp/sysinfo/board_name
netgear,wax630
~# 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: 03c00000 00020000 "rootfs"
mtd19: 00900000 00020000 "0:wififw"
mtd20: 03c00000 00020000 "rootfs_1"
mtd21: 00900000 00020000 "0:wififw_1"
mtd22: 00080000 00020000 "0:ethphyfw"
mtd23: 00180000 00020000 "0:mfgdata"
mtd24: 08000000 00020000 "0:ntgrdata"
mtd25: 01c00000 00020000 "0:oops_log"
mtd26: 06400000 00020000 "0:reserved1"
mtd27: 06400000 00020000 "0:reserved2"
~# fw_printenv
active_fw=0
baudrate=115200
boot_count=1
bootargs=console=ttyMSM0,115200n8
bootcmd=bootipq
bootdelay=2
crash_status=1
eth1addr=c8:9e:43:f:dd:cf
ethact=eth0
ethaddr=c8:9e:43:f:dd:bf
failsafe=1
fdt_high=0x4A400000
fdtcontroladdr=4a96e260
fileaddr=44000000
filesize=c98b74
flash_type=2
fsbootargs=ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs
hw_ver=1.0
ipaddr=192.168.1.5
machid=8010000
netmask=255.255.255.0
proceed_upgrade=0
product_id=WAX630
serverip=192.168.1.131
soc_version_major=2
soc_version_minor=0
stderr=serial@78B3000
stdin=serial@78B3000
stdout=serial@78B3000
To install openwrt on wax630 I was following the instructions from the commit message, all went OK and I was able to boot into openwrt. But after couple reboots I was landed to the netgear OEM firmware web interface instead of luci. So I proceeded to repeat the openwrt installation via UART following git commit instructions once again. No more netgear firmware now but I am at the situation where I don't know which openwrt installation will boot next time. fw_printenv always shows active_fw=0 and fsbootargs=ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs
I have touched an indicator file to /root to let myself know which one it is. And if I make any changes to configuration I notice they are gone after few reboots so I need to maintain two installations not knowing which one will be loaded next. Can anyone please advice how to check which firmware wax630 decides to boot and why?
Interesting device.
Some devices switch boot partition after a certain number of failed boots, maybe this is what happened?
No, sorry, I can't help you there, this WebUI is just an add-on to the CLI tools which are usually taken care of by the device maintainers/OpenWrt core team. If there's no way to not only switch partition from CLI but even find out from CLI which partition you've booted into, there's nothing I can do with WebUI.
For your specific issue I'd reach out to @robimarko who frequents the forum or reach out to the committer via email.
As soon as there is active_fw variables I can only guess that it does dual FW
According to the owner of the hardware, active_fw=0
stays the same when booted on either partition, that's puzzling.
Beats me, I dont have the board, maybe they kept the same logic but there is only one partition?
Anything I can check that would give a clue?
~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mtdblock0 31:0 0 1M 0 disk
mtdblock1 31:1 0 1M 0 disk
mtdblock2 31:2 0 512K 0 disk
mtdblock3 31:3 0 512K 0 disk
mtdblock4 31:4 0 3M 0 disk
mtdblock5 31:5 0 3M 0 disk
mtdblock6 31:6 0 512K 0 disk
mtdblock7 31:7 0 512K 0 disk
mtdblock8 31:8 0 512K 0 disk
mtdblock9 31:9 0 512K 0 disk
mtdblock10 31:10 0 512K 0 disk
mtdblock11 31:11 0 512K 0 disk
mtdblock12 31:12 0 512K 0 disk
mtdblock13 31:13 0 512K 0 disk
mtdblock14 31:14 0 512K 0 disk
mtdblock15 31:15 0 1M 0 disk
mtdblock16 31:16 0 1M 0 disk
mtdblock17 31:17 0 512K 0 disk
mtdblock18 31:18 0 60M 0 disk
mtdblock19 31:19 0 9M 0 disk
mtdblock20 31:20 0 60M 0 disk
mtdblock21 31:21 0 9M 0 disk
mtdblock22 31:22 0 512K 0 disk
mtdblock23 31:23 0 1.5M 0 disk
mtdblock24 31:24 0 128M 0 disk
mtdblock25 31:25 0 28M 0 disk
mtdblock26 31:26 0 100M 0 disk
mtdblock27 31:27 0 100M 0 disk
ubiblock0_1 254:0 0 7.1M 0 disk /rom
~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 7.3M 7.3M 0 100% /rom
tmpfs 433.4M 1.3M 432.1M 0% /tmp
/dev/ubi0_2 31.2M 1008.0K 28.6M 3% /overlay
overlayfs:/overlay 31.2M 1008.0K 28.6M 3% /
tmpfs 512.0K 0 512.0K 0% /dev
~# fdisk -l
Disk /dev/mtdblock0: 1 MiB, 1048576 bytes, 2048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock1: 1 MiB, 1048576 bytes, 2048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock2: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock3: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock4: 3 MiB, 3145728 bytes, 6144 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock5: 3 MiB, 3145728 bytes, 6144 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock6: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock7: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock8: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock9: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock10: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock11: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock12: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock13: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock14: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock15: 1 MiB, 1048576 bytes, 2048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock16: 1 MiB, 1048576 bytes, 2048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock17: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock18: 60 MiB, 62914560 bytes, 122880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock19: 9 MiB, 9437184 bytes, 18432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock20: 60 MiB, 62914560 bytes, 122880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock21: 9 MiB, 9437184 bytes, 18432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock22: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock23: 1.5 MiB, 1572864 bytes, 3072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock24: 128 MiB, 134217728 bytes, 262144 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock25: 28 MiB, 29360128 bytes, 57344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock26: 100 MiB, 104857600 bytes, 204800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mtdblock27: 100 MiB, 104857600 bytes, 204800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/ubiblock0_1: 7.14 MiB, 7491584 bytes, 14632 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
I notice that /usr/sbin/fw_printenv
always shows
crash_status=1
and failsafe=1
but I don't know what these mean. Also boot_count gets resetted so maybe I should keep an eye on that...
In OEM firmware you might find something like this:
change_primaryboot() {
local mtdname=$1
local mtdpart
local primaryboot
mtdpart=$(grep "\"${mtdname}\"" /proc/mtd | awk -F: '{print $1}')
#ubidetach -f -p /dev/${mtdpart}
echo "$mtdname $mtdpart"
# Fail safe upgrade
[ -f /proc/boot_info/$mtdname/upgradepartition ] && {
echo "$mtdname $mtdpart"
primaryboot=$(cat /proc/boot_info/$mtdname/primaryboot)
if [ $primaryboot -eq 0 ]; then
echo 1 > /proc/boot_info/$mtdname/primaryboot
else
echo 0 > /proc/boot_info/$mtdname/primaryboot
fi
mtdname=$(cat /proc/boot_info/$mtdname/upgradepartition)
}
mtdpart=$(grep "\"${mtdname}\"" /proc/mtd | awk -F: '{print $1}')
echo "$mtdname $mtdpart"
}
do_swap()
{
rm -rf ${ALT_VERSION_FILE}
local board=$(ipq806x_board_name)
case "$board" in
db149 | ap148 | ap145 | ap148_1xx | db149_1xx | db149_2xx | ap145_1xx | ap160 | ap160_2xx | ap161 | ak01_1xx | ap-dk01.1-c1 | ap-dk01.1-c2 | ap-dk04.1-c1 | ap-dk04.1-c2 | ap-dk04.1-c3 | ap-dk04.1-c4 | ap-dk04.1-c5 | ap-dk04.1-c6 | ap-dk05.1-c1 | ap-dk06.1-c1 | ap-dk07.1-c1 | ap-dk07.1-c2 | ap-dk07.1-c3 | ap-dk07.1-c4 | ap-hk01-c1 | ap-hk01-c2 | ap-hk01-c3 | ap-hk01-c4 | ap-hk01-c5 | ap-hk02 | ap-hk05 | ap-hk06 | ap-hk07 | ap-hk08 | ap-hk09 | ap-hk10 | ap-ac01 | ap-ac02 | ap-ac03 | ap-ac04 | ap-oak02 | ap-oak03 | db-hk01 | db-hk02 | ap-cp01-c1 | ap-cp01-c2 | ap-cp02-c1 | ap-cp03-c1 | db-cp01 | db-cp02)
change_primaryboot "rootfs"
# update bootconfig to register that fw upgrade has been done
do_flash_bootconfig bootconfig "0:BOOTCONFIG"
do_flash_bootconfig bootconfig1 "0:BOOTCONFIG1"
erase_emmc_config
fw_setenv fw_upgrade 2
return 0;
;;
esac
echo "Swap Partition failed!"
return 1;
}
and there is a bootconfig
module:
Package: kmod-bootconfig
Version: 4.4.60+1-1
Depends: kernel (=4.4.60-1-d736c695bed8fa289fe393f78d8bf50d)
Source: qca/feeds/platform_utils/platform_drivers
Section: kernel
Architecture: ipq
Installed-Size: 3371
Description: Bootconfig partition for failsafe
So I've verified that WAX630 boots to alternating partition after 5 reboots (boot_count>4) and then I've found the same thing mentioned for similar device here OpenWrt support for Netgear WAX620 - #80 by Spacebar
So I've put
fw_setenv boot_count 0
in /etc/rc.local
to prevent booting to alternate partition.
On the other hand setting it to 5 should trigger booting to alternate partition so it should be possible to add support for this device to luci-app-advanced-reboot
by tweaking boot_count