Sysupgrade behaviour on filogic SPI-NOR

So I'm creating support for new device mt7981 based with 16MB SPI

I'm getting openwrt-mediatek-filogic-cudy_wr3000-initramfs-kernel.bin
and openwrt-mediatek-filogic-cudy_wr3000-squashfs-sysupgrade.bin
After tftp booting initramfs
sysupgrade -n /tmp/openwrt-mediatek-filogic-cudy_wr3000-squashfs-sysupgrade.bin and this what I'm getting:

Thu Apr 20 00:13:08 UTC 2023 upgrade: Switching to ramdisk...
mount: mounting /dev/mtdblock8 on /overlay failed: Resource busy[  432.734070] VFS: Busy inodes after unmount of jffs2. Self-destruct in 5 seconds.  Have a nice day...

Thu Apr 20 00:13:09 UTC 2023 upgrade: Performing system upgrade...
[  433.056247] ubi0: default fastmap pool size: 8
[  433.060715] ubi0: default fastmap WL pool size: 4
[  433.065407] ubi0: attaching mtd7
[  433.081364] ubi0: scanning is finished
[  433.085113] ubi0 error: ubi_read_volume_table: the layout volume was not found
[  433.092371] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd7, error -22
ubiattach: error!: cannot attach mtd7
           error 22 (Invalid argument)
ubiformat: mtd7 (nor), size 11862016 bytes (11.3 MiB), 181 eraseblocks of 65536 bytes (64.0 KiB), min. I/O size 1 bytes
ubiformat: formatting eraseblock 180 -- 100 % complete
[  471.388276] ubi0: default fastmap pool size: 8
[  471.392718] ubi0: default fastmap WL pool size: 4
[  471.397410] ubi0: attaching mtd7
[  471.413455] ubi0: scanning is finished
[  471.428019] ubi0: attached mtd7 (name "rootfs", size 11 MiB)
[  471.433680] ubi0: PEB size: 65536 bytes (64 KiB), LEB size: 65408 bytes
[  471.440298] ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
[  471.446466] ubi0: VID header offset: 64 (aligned 64), data offset: 128
[  471.452999] ubi0: good PEBs: 181, bad PEBs: 0, corrupted PEBs: 0
[  471.458996] ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
[  471.466204] ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 1490940209
[  471.475323] ubi0: available PEBs: 175, total reserved PEBs: 6, PEBs reserved for bad PEB handling: 0
[  471.484450] ubi0: background thread "ubi_bgt0d" started, PID 3616
UBI device number 0, total 181 LEBs (11838848 bytes, 11.2 MiB), available 175 LEBs (11446400 bytes, 10.9 MiB), LEB size 65408 bytes (63.8 KiB)
Volume ID 0, size 17 LEBs (1111936 bytes, 1.0 MiB), LEB size 65408 bytes (63.8 KiB), dynamic, name "ubootenv", alignment 1
Volume ID 1, size 17 LEBs (1111936 bytes, 1.0 MiB), LEB size 65408 bytes (63.8 KiB), dynamic, name "ubootenv2", alignment 1
Volume ID 2, size 125 LEBs (8176000 bytes, 7.7 MiB), LEB size 65408 bytes (63.8 KiB), dynamic, name "kernel", alignment 1
Set volume size to 1046528
Volume ID 3, size 16 LEBs (1046528 bytes, 1022.0 KiB), LEB size 65408 bytes (63.8 KiB), dynamic, name "rootfs_data", alignment 1
sysupgrade successful
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource [  490.237766] mt7530 mdio-bus:1f lan3: Link is Down
busy
[  490.244360] br-lan: port 1(lan1) entered disabled state
[  490.249664] br-lan: port 2(lan2) entered disabled state
[  490.254945] br-lan: port 3(lan3) entered disabled state


after reboot

  Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit
SF: Detected XM25QH128C with page size 256 Bytes, erase size 4 KiB, total 16 MiB
Reading from 0xf0000 to 0x46000000, size 0x100 ... OK
Reading from 0xf0000 to 0x46000000, size 0x3b1df4 ... OK
## Loading kernel from FIT Image at 46000000 ...
   Using 'config-1' configuration
   Trying 'kernel-1' kernel subimage
     Description:  ARM64 OpenWrt Linux-5.15.107
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x460000ec
     Data Size:    3839627 Bytes = 3.7 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x48000000
     Entry Point:  0x48000000
     Hash algo:    crc32
     Hash value:   2ae5d0c6
     Hash algo:    sha1
     Hash value:   88edee8df7a4fb63c1446435f7522a9d8a0b79d6
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 46000000 ...
   Using 'config-1' configuration
   Trying 'fdt-1' fdt subimage
     Description:  ARM64 OpenWrt cudy_wr3000 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x463a98b4
     Data Size:    32768 Bytes = 32 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   b64cd178
     Hash algo:    sha1
     Hash value:   657490e1979c445f0f46372f0266f78b6e49267f
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x463a98b4
   Uncompressing Kernel Image
   Loading Device Tree to 000000004f7ee000, end 000000004f7f8fff ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 5.15.107 (user@DESKTOP-J3ELAS3) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 12.2.0 r22604-0a18d08026) 12.2.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Thu Apr 20 00:05:30 2023
[    0.000000] Machine model: CUDY WR3000
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x000000004fffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x0000000042ffffff]
[    0.000000]   node   0: [mem 0x0000000043000000-0x000000004302ffff]
[    0.000000]   node   0: [mem 0x0000000043030000-0x0000000047c7ffff]
[    0.000000]   node   0: [mem 0x0000000047c80000-0x0000000047ffffff]
[    0.000000]   node   0: [mem 0x0000000048000000-0x000000004fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000004fffffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 17 pages/cpu s29592 r8192 d31848 u69632
[    0.000000] pcpu-alloc: s29592 r8192 d31848 u69632 alloc=17*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: kernel page table isolation disabled by kernel configuration
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64512
[    0.000000] Kernel command line:
[    0.000000] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 241140K/262144K available (8064K kernel code, 886K rwdata, 2160K rodata, 384K init, 286K bss, 21004K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 640 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] GICv3: Distributor has no Range Selector support
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: 16 PPIs implemented
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x000000000c080000
[    0.000000] arch_timer: cp15 timer(s) running at 13.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2ff89eacb, max_idle_ns: 440795202429 ns
[    0.000000] sched_clock: 56 bits at 13MHz, resolution 76ns, wraps every 4398046511101ns
[    0.000130] Calibrating delay loop (skipped), value calculated using timer frequency.. 26.00 BogoMIPS (lpj=130000)
[    0.000141] pid_max: default: 32768 minimum: 301
[    0.000228] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.000237] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.001275] rcu: Hierarchical SRCU implementation.
[    0.001382] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.001598] smp: Bringing up secondary CPUs ...
[    0.001900] Detected VIPT I-cache on CPU1
[    0.001924] GICv3: CPU1: found redistributor 1 region 0:0x000000000c0a0000
[    0.001951] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.002013] smp: Brought up 1 node, 2 CPUs
[    0.002026] SMP: Total of 2 processors activated.
[    0.002031] CPU features: detected: 32-bit EL0 Support
[    0.002035] CPU features: detected: CRC32 instructions
[    0.002116] CPU: All CPU(s) started at EL2
[    0.002127] alternatives: patching kernel code
[    0.004483] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.004504] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.004591] pinctrl core: initialized pinctrl subsystem
[    0.005139] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.005390] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[    0.005419] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.005444] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.005725] thermal_sys: Registered thermal governor 'fair_share'
[    0.005729] thermal_sys: Registered thermal governor 'bang_bang'
[    0.005733] thermal_sys: Registered thermal governor 'step_wise'
[    0.005738] thermal_sys: Registered thermal governor 'user_space'
[    0.005879] ASID allocator initialised with 65536 entries
[    0.014509] cryptd: max_cpu_qlen set to 1000
[    0.016539] SCSI subsystem initialized
[    0.016698] libata version 3.00 loaded.
[    0.017640] clocksource: Switched to clocksource arch_sys_counter
[    0.018100] NET: Registered PF_INET protocol family
[    0.018184] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.018464] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.018484] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.018492] TCP established hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.018511] TCP bind hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.018540] TCP: Hash tables configured (established 2048 bind 2048)
[    0.018595] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.018612] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.018709] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.018729] PCI: CLS 0 bytes, default 64
[    0.021204] workingset: timestamp_bits=46 max_order=16 bucket_order=0
[    0.023942] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.023955] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.065915] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.066461] printk: console [ttyS0] disabled
[    0.086611] 11002000.serial: ttyS0 at MMIO 0x11002000 (irq = 17, base_baud = 2500000) is a ST16650V2
[    0.681964] printk: console [ttyS0] enabled
[    0.686795] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.695497] loop: module loaded
[    0.700058] spi-nor spi0.0: XM25QH128C (16384 Kbytes)
[    0.705287] 6 fixed-partitions partitions found on MTD device spi0.0
[    0.712068] Creating 6 MTD partitions on "spi0.0":
[    0.716859] 0x000000000000-0x000000040000 : "BL2"
[    0.721974] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.727707] 0x000000050000-0x000000060000 : "Factory"
[    0.733085] 0x000000060000-0x000000070000 : "bdinfo"
[    0.738452] 0x000000070000-0x0000000f0000 : "FIP"
[    0.743468] 0x0000000f0000-0x000001000000 : "firmware"
[    0.749127] 2 fit-fw partitions found on MTD device firmware
[    0.754787] Creating 2 MTD partitions on "firmware":
[    0.759752] 0x000000000000-0x0000003c0000 : "kernel"
[    0.765114] 0x0000003c0000-0x000000f10000 : "ubi"
[    0.928864] MediaTek MT7981 PHY mdio-bus:00: TX-VCM SW cal result: 0x2
[    0.938274] mtk_soc_eth 15100000.ethernet eth0: mediatek frame engine at 0xffffffc009580000, irq 81
[    0.947867] i2c_dev: i2c /dev entries driver
[    0.953705] NET: Registered PF_INET6 protocol family
[    0.959476] Segment Routing with IPv6
[    0.963158] In-situ OAM (IOAM) with IPv6
[    0.967104] NET: Registered PF_PACKET protocol family
[    0.972317] 8021q: 802.1Q VLAN Support v1.8
[    1.018991] mt7530 mdio-bus:1f: no interrupt support
[    1.030445] mt7530 mdio-bus:1f: configuring for fixed/2500base-x link mode
[    1.039143] mt7530 mdio-bus:1f: Link is Up - 2.5Gbps/Full - flow control rx/tx
[    1.048359] mt7530 mdio-bus:1f wan (uninitialized): PHY [mt7530-0:00] driver [MediaTek MT7531 PHY] (irq=POLL)
[    1.068200] mt7530 mdio-bus:1f lan1 (uninitialized): PHY [mt7530-0:01] driver [MediaTek MT7531 PHY] (irq=POLL)
[    1.087977] mt7530 mdio-bus:1f lan2 (uninitialized): PHY [mt7530-0:02] driver [MediaTek MT7531 PHY] (irq=POLL)
[    1.107715] mt7530 mdio-bus:1f lan3 (uninitialized): PHY [mt7530-0:03] driver [MediaTek MT7531 PHY] (irq=POLL)
[    1.119181] DSA: tree 0 setup
[    1.122585] UBI: auto-attach mtd7
[    1.125905] ubi0: default fastmap pool size: 8
[    1.130378] ubi0: default fastmap WL pool size: 4
[    1.135075] ubi0: attaching mtd7
[    1.151101] ubi0: scanning is finished
[    1.165866] ubi0: attached mtd7 (name "ubi", size 11 MiB)
[    1.171281] ubi0: PEB size: 65536 bytes (64 KiB), LEB size: 65408 bytes
[    1.177891] ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
[    1.184058] ubi0: VID header offset: 64 (aligned 64), data offset: 128
[    1.190574] ubi0: good PEBs: 181, bad PEBs: 0, corrupted PEBs: 0
[    1.196567] ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128
[    1.203778] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1490940209
[    1.212897] ubi0: available PEBs: 0, total reserved PEBs: 181, PEBs reserved for bad PEB handling: 0
[    1.222031] ubi0: background thread "ubi_bgt0d" started, PID 397
[    1.228475] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    1.235951] Please append a correct "root=" boot option; here are the available partitions:
[    1.244314] 1f00             256 mtdblock0
[    1.244320]  (driver?)
[    1.250859] 1f01              64 mtdblock1
[    1.250863]  (driver?)
[    1.257378] 1f02              64 mtdblock2
[    1.257382]  (driver?)
[    1.263903] 1f03              64 mtdblock3
[    1.263907]  (driver?)
[    1.270426] 1f04             512 mtdblock4
[    1.270430]  (driver?)
[    1.276946] 1f05           15424 mtdblock5
[    1.276950]  (driver?)
[    1.283469] 1f06            3840 mtdblock6
[    1.283473]  (driver?)
[    1.289992] 1f07           11584 mtdblock7
[    1.289996]  (driver?)
[    1.296512] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.304758] SMP: stopping secondary CPUs
[    1.308669] Kernel Offset: disabled
[    1.312143] CPU features: 0x00000000,20000802
[    1.316487] Memory Limit: none
[    1.319529] Rebooting in 1 seconds..

F0: 102B 0000
FA: 0000 0000
V0: 0000 0000 [0001]

What's works is to just use
mtd -r write /tmp/openwrt-mediatek-filogic-cudy_wr3000-squashfs-sysupgrade.bin firmware

I have no clue why it force ubi format not jffs2

The default sysupgrade type of mediatek/filogic is nand_do_upgrade, so a new entry of your device with default_do_upgrade need to be added into filogic/base-files/lib/upgrade/platform.sh.

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