Sysupgrade boot looping but u-boot tftp ok. UBI

I have an AX3000 router that I've got a working compile of 24.10.1. It uses an mt7981 chip. I can u-boot update firmware and it's ok. If I use the ota update in luci, while it's upgrading I get and error about mtd6 and ubi. It creates kernel and UBI rather than kernel and rootfs as well. I don't know what is needed to see but I have uart access to the device. I've tried disabling ubi manually in .config just to see and have problems compiling fstools. I've tried several different approaches in the filogic.mk file but nothing has helped.

  • Are you referring to the Xiaomi AX3000T?
  • Can you show us this error?
  • "OTA update"?

No this is a generic no name that one from Amazon.

Ok, I found more time to mess with this. I've made a few changes to the dts and now it's not boot looping, but here is what happens:

I do an kernel install using u-boot, and then do a sysupgrade and it fails. Here is the log from u-art console:

root@OpenWrt:~# Watchdog handover: fd=3
- watchdog -
Watchdog does not have CARDRESET support
Thu Jan  1 00:04:02 UTC 1970 upgrade: Sending TERM to remaining processes ...
Thu Jan  1 00:04:02 UTC 1970 upgrade: Sending signal TERM to netifd (1719)
Thu Jan  1 00:04:06 UTC 1970 upgrade: Sending KILL to remaining processes ...
Thu Jan  1 00:04:06 UTC 1970 upgrade: Sending signal KILL to netifd (1719)
[  254.633671] stage2 (3273): drop_caches: 3
Thu Jan  1 00:04:14 UTC 1970 upgrade: Switching to ramdisk...
Thu Jan  1 00:04:15 UTC 1970 upgrade: Performing system upgrade...
cannot find ubi mtd partition rootfs
sysupgrade failed
umount: can't unmount /dev: Resource busy
umount: can'[  255.981901] reboot: Restarting system

If I do a u-boot flash of sysupgrade.bin I have this layout:

[    0.861082] spi-nor spi0.0: mx25l12805d (16384 Kbytes)
[    0.866915] 5 fixed-partitions partitions found on MTD device spi0.0
[    0.873491] Creating 5 MTD partitions on "spi0.0":
[    0.878337] 0x000000000000-0x000000040000 : "BL2"
[    0.883518] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.889487] 0x000000050000-0x000000060000 : "Factory"
[    0.895136] 0x000000100000-0x000000180000 : "FIP"
[    0.900362] 0x000000180000-0x000000f80000 : "firmware"
[    0.906190] 2 fit-fw partitions found on MTD device firmware
[    0.911852] Creating 2 MTD partitions on "firmware":
[    0.916837] 0x000000000000-0x000000420000 : "kernel"
[    0.922223] 0x000000420000-0x000000e00000 : "rootfs"
[    0.927673] mtd: setting mtd6 (rootfs) as root device
[    0.932793] 1 squashfs-split partitions found on MTD device rootfs
[    0.938988] 0x000000a70000-0x000000e00000 : "rootfs_data"
[    1.090352] mt7530-mdio mdio-bus:1f: no ports child node found
[    1.096210] mt7530-mdio: probe of mdio-bus:1f failed with error -22

I can provide more of whatever logging or dts, etc.

Please provide the output of:

ubus call system board

(It's still unclear what supported device you're using, if any.)

Not sure what you mean by "supported" as a developer, but here is info I've extracted:

Hardware
--------
MediaTek ARM  
MT7981BA  
2436-AMK  
BTPA1V3C

MT7976CN
Wi-Fi 6 (802.11ax) RF/PHY


MX25L12833F
Memory Size: 128 Mbit (16 MB)
Interface: SPI (typically operates in SPI, Dual I/O, and Quad I/O modes)

Samsung K4B2G1646E-BCH9
Type: DDR3 SDRAM
Density: 2Gb (256MB)
Bus Width: x16
Package: FBGA
Speed: "BCH9" usually indicates DDR3-1333 (667 MHz)
Voltage: 1.5V standard

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "BL2"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 000b0000 00010000 "Factory"
mtd3: 00080000 00010000 "FIP"
mtd4: 00e80000 00010000 "firmware"
mtd5: 00350000 00010000 "kernel"
mtd6: 00b20000 00010000 "rootfs"
mtd7: 000f0000 00010000 "rootfs_data"

cat /tmp/sysinfo/board_name 
mediatek,mt7981-spim-nor-rfb

cat /tmp/sysinfo/model
MediaTek MT7981 RFB

cat /proc/cpuinfo
processor       : 0
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 26.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 26.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

cat /proc/meminfo (256MB)
MemTotal:         230656 kB
MemFree:           83664 kB
MemAvailable:      96344 kB
Buffers:            4920 kB
Cached:            16364 kB
SwapCached:            0 kB
Active:            17244 kB
Inactive:           7860 kB
Active(anon):       3852 kB
Inactive(anon):       88 kB
Active(file):      13392 kB
Inactive(file):     7772 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:          3844 kB
Mapped:             6288 kB
Shmem:               120 kB
KReclaimable:       5560 kB
Slab:              44032 kB
SReclaimable:       5560 kB
SUnreclaim:        38472 kB
KernelStack:        1552 kB
PageTables:          476 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      115328 kB
Committed_AS:       9156 kB
VmallocTotal:   262930368 kB
VmallocUsed:       40572 kB
VmallocChunk:          0 kB
Percpu:              280 kB

cat /etc/openwrt_release
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='21.02-SNAPSHOT'
DISTRIB_REVISION='r16841-cbe73ea33d'
DISTRIB_TARGET='mediatek/mt7981'
DISTRIB_ARCH='aarch64_cortex-a53'
DISTRIB_DESCRIPTION='OpenWrt 21.02-SNAPSHOT r16841-cbe73ea33d'
DISTRIB_TAINTS='no-all busybox'

It means that you need to provide us detailed device information if this is an initial inquiry about a device that's currently unsupported.

Thanks for providing more information.

  • Does ubus call system board work on your running OpenWrt?
  • Do you have a boot log output?

Here is the full boot log output:

I'll get the ubus call in a min

1 Like

ubus call system board

{
        "kernel": "5.4.246",
        "hostname": "Srepeater",
        "system": "ARMv8 Processor rev 4",
        "model": "MediaTek MT7981 RFB",
        "board_name": "mediatek,mt7981-spim-nor-rfb",
        "release": {
                "distribution": "OpenWrt",
                "version": "21.02-SNAPSHOT",
                "revision": "r16841-cbe73ea33d",
                "target": "mediatek/mt7981",
                "description": "OpenWrt 21.02-SNAPSHOT r16841-cbe73ea33d"
        }
}
1 Like

It appears you are using firmware that is not from the official OpenWrt project.

When using forks/offshoots/vendor-specific builds that are "based on OpenWrt", there may be many differences compared to the official versions (hosted by OpenWrt.org). Some of these customizations may fundamentally change the way that OpenWrt works. You might need help from people with specific/specialized knowledge about the firmware you are using, so it is possible that advice you get here may not be useful.

You may find that the best options are:

  1. Install an official version of OpenWrt, if your device is supported (see https://firmware-selector.openwrt.org).
  2. Ask for help from the maintainer(s) or user community of the specific firmware that you are using.
  3. Provide the source code for the firmware so that users on this forum can understand how your firmware works (OpenWrt forum users are volunteers, so somebody might look at the code if they have time and are interested in your issue).

If you believe that this specific issue is common to generic/official OpenWrt and/or the maintainers of your build have indicated as such, please feel free to clarify.

Perhaps I'm misunderstanding something. I specifically posted in the developers section because I'm trying to develop a formula for porting to this device. The device is working, all functions are working with the exception of sysupgrade from my cobbled together compile. If I flash directly to the device, everything works. I would like to get sysupgrade working and then make it available to the community.

Perhaps I should add that all the posted info I'm using is from the orginal firmware, not the openwrt compile I'm using. I've based the compile of another router's dts and modified the dts and the network_02 and filogic.mk to create a new firmware.

1 Like

Please explain the above.

PRs won't be accepted towards stable, you need to work with master.

1 Like

FYI, the user added this after:

1 Like

sounds like you just need to adjust the platform.sh to suite the device. Can you post the post the /lib/upgrade/platform.sh from the working openwrt ... and a look at the original and the modified dts , it looks like you broke it ...

also , from the device running openwrt, post the output of

 cat /proc/mtd

if you have an image that, as you say, works (except sysupgrade functionality). It should be pretty simple to fix.

Ok, I found that my device is very close to a wavlink wl-wn573hx3. I just needed to fix gpios and remove an extra partition entry and it is all working now including sysupgrade from kernel.

Only one last small issue: I found the gpio for the eth link led but it doesn't flash with data.

You will need to write user guide around ubi manupulations.

I didn't do anything. I just used the dts from the wl-wn573hx3 so I didn't learn anything about the ubi stuff.

1 Like

Verify that MAC addresses and wifi calibration are ok before playing with partitions. You might accidentally wipe important bits.

set it as you wish via luci ..

<ip>/cgi-bin/luci/admin/system/leds

or set its default, as such in the dts, just use the correct function ..

(outdated but should be fine for your use case)

I created a uci-defaults scripts so it's all working.

IMO that's more of a band-aide fix, than a proper solution .. but whatever floats your boat.

If you plan to do a pr, to add official support for the device, you'll need to do it differently.