Help Understanding MTD partitions

I have a device that the vendor put a custom (and I believe old) version of OpenWrt on. I am working on updating this and removing all their custom "stuff" - but after flashing the MTD partitions changed order... I didn't think this would be a normal thing, so looking for help/feedback to see if I screwed something up, or if it's okay.

To figure out partitions on the original firmware I used both proc/mtd and the kernel boot log

root@Leedarson:/proc# cat mtd
dev:	size		erasesize	name
mtd0:	00040000	00010000	"u-boot"
mtd1:	00010000	00010000	"u-boot-env"
mtd2:	00010000	00010000	"u-boot-env-bak"
mtd3:	00010000	00010000	"reserved"
mtd4:	00010000	00010000	"art"
mtd5:	00200000	00020000	"kernel-0"
mtd6:	02000000	00020000	"root-0"
mtd7:	00200000	00020000	"kernel-1"
mtd8:	02000000	00020000	"root-1"
mtd9:	03c00000	00020000	"extend"
mtd10:	02200000	00020000	"firmware0"
mtd11:	02200000	00020000	"firmware1"
mtd12:	009ee000	0001f000	"rootfs"
mtd13:	0122a000	0001f000	"rootfs_data"
mtd14:	03738000	0001f000	"media"

From Kernel Log:
5 cmdlinepart partitions found on MTD device spi0.0
Creating 5 MTD partitions on "spi0.0":
0x000000000000-0x000000040000 : "u-boot"
0x000000040000-0x000000050000 : "u-boot-env"
0x000000050000-0x000000060000 : "u-boot-env-bak"
0x000000060000-0x000000070000 : "reserved"
0x000000070000-0x000000080000 : "art"

7 cmdlinepart partitions found on MTD device spi0.1
Creating 7 MTD partitions on "spi0.1":
0x000000000000-0x000000200000 : "kernel-0"
0x000000200000-0x000002200000 : "root-0"
0x000002200000-0x000002400000 : "kernel-1"
0x000002400000-0x000004400000 : "root-1"
0x000004400000-0x000008000000 : "extend"
0x000000000000-0x000002200000 : "firmware0"
0x000002200000-0x000004400000 : "firmware1"

After flashing 22.03 it looks like this (device has two firmware slots, so only one was flashed... maybe this could be part of the problem?):

# cat mtd
dev:	size		erasesize	name
mtd0:	02200000	00020000	"firmware0"
mtd1:	00200000	00020000	"kernel"
mtd2:	02000000	00020000	"ubi"
mtd3:	02200000	00020000	"firmware1"
mtd4:	00260000	00020000	"kernel"
mtd5:	01fa0000	00020000	"rootfs"
mtd6:	01be0000	00020000	"rootfs_data"
mtd7:	03c00000	00020000	"extend"
mtd8:	00040000	00010000	"u-boot"
mtd9:	00010000	00010000	"u-boot-env"
mtd10:	00010000	00010000	"u-boot-env-bak"
mtd11:	00010000	00010000	"reserved"
mtd12:	00010000	00010000	"art"

From Kernel Log:
3 fixed-partitions partitions found on MTD device (null)
OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
Creating 3 MTD partitions on "(null)":
0x000000000000-0x000002200000 : "firmware0"
2 uimage-fw partitions found on MTD device firmware0
Creating 2 MTD partitions on "firmware0":
0x000000000000-0x000000200000 : "kernel"
0x000000200000-0x000002200000 : "ubi"
0x000002200000-0x000004400000 : "firmware1"
2 uimage-fw partitions found on MTD device firmware1
Creating 2 MTD partitions on "firmware1":
0x000000000000-0x000000260000 : "kernel"
0x000000260000-0x000002200000 : "rootfs"
mtd: setting mtd5 (rootfs) as root device
1 squashfs-split partitions found on MTD device rootfs
0x000000620000-0x000002200000 : "rootfs_data"
0x000004400000-0x000008000000 : "extend"
spi-nor spi0.0: mx25l3205d (4096 Kbytes)
5 fixed-partitions partitions found on MTD device spi0.0
Creating 5 MTD partitions on "spi0.0":
0x000000000000-0x000000040000 : "u-boot"
0x000000040000-0x000000050000 : "u-boot-env"
0x000000050000-0x000000060000 : "u-boot-env-bak"
0x000000060000-0x000000070000 : "reserved"
0x000000070000-0x000000080000 : "art"

This has to flash chips - and it looks like it switched them around on the 22.03 version. In the DTS file I have them in the order so that the u-boot, et. al. are first - so I'm not sure what caused this. Not everything is loading correctly, and I suspect it could be because the MTD partitions are not in the same order.

Does anyone have an idea of what I can check to figure out what is causing this? Happy to share any information (files I've modified, created, etc.) but didn't want to make this post any bigger than it already is.

Thank you again for any/all help!
DeadEnd

You are very scarce on kernel log in both situations (OEM and OpenWrt), is it a secret? You can always redact MAC addresses or serial numbers.

Anyway, judging from the limited output of OEM kernel log, You have two flash chips and looking at OpenWrt log there's probably no second flash chip specified or detected:

3 fixed-partitions partitions found on MTD device (null)
...
Creating 3 MTD partitions on "(null)":

If the second flash was specified in dts, did You confirm it's properly detected and You can read it before flashing new firmware?

I tried to keep the post short - I didn't want to write a book and scare away anyone trying to help, lol.

Here are the full logs:

Original Firmware before doing anything:

[    0.000000] Linux version 3.18.29 (chencheng@ubuntu16) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 gae98452) ) #1 Fri Apr 3 13:54:53 CST 2020
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 80452870, node_mem_map 81000000
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  ubi.mtd=root-0 version=g5c594c0-1 board=LDS-G152 console=ttyUSB0,115200 ubi.mtd=extend rootfs=/dev/mtdblock:rootfs rootfstype=squashfs noinitrd init=/sbin/init bootslot=0 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(u-boot-env-bak),64k(reserved),64k(art);spi0.1:2m(kernel-0)ro,32m(root-0),2m(kernel-1),32m(root-1),60m(extend),34m@0x0(firmware0),34m@0x2200000(firmware1) production=0000 hwversion=V2.0 app_switch=default mem=64M board=LDS-G152 rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 59980K/65536K available (3343K kernel code, 158K rwdata, 664K rodata, 176K init, 193K bss, 5556K reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:650.000MHz, DDR:597.070MHz, AHB:216.666MHz, Ref:25.000MHz
[    0.000000] Calibrating delay loop... 432.53 BogoMIPS (lpj=2162688)
[    0.060000] pid_max: default: 32768 minimum: 301
[    0.060000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.080000] NET: Registered protocol family 16
[    0.080000] MIPS: machine is Leedarson LDS-G152 board
[    0.090000] ar724x-pci ar724x-pci.0: PCIe link is down
[    0.090000] registering PCI controller with io_map_base unset
[    0.100000] ar71xx: invalid MDIO id 1
[    0.540000] i2c-gpio i2c-gpio.0: using pins 17 (SDA) and 16 (SCL)
[    0.550000] PCI host bridge to bus 0000:00
[    0.550000] pci_bus 0000:00: root bus resource [mem 0x10000000-0x11ffffff]
[    0.560000] pci_bus 0000:00: root bus resource [io  0x0000]
[    0.560000] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.570000] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
[    0.570000] Bluetooth: Core ver 2.19
[    0.570000] NET: Registered protocol family 31
[    0.570000] Bluetooth: HCI device and connection manager initialized
[    0.580000] Bluetooth: HCI socket layer initialized
[    0.580000] Bluetooth: L2CAP socket layer initialized
[    0.590000] Bluetooth: SCO socket layer initialized
[    0.590000] Switched to clocksource MIPS
[    0.600000] NET: Registered protocol family 2
[    0.600000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.600000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.610000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.620000] TCP: reno registered
[    0.620000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.630000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.630000] NET: Registered protocol family 1
[    0.640000] PCI: CLS 0 bytes, default 32
[    0.640000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.660000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.670000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.680000] msgmni has been set to 117
[    0.690000] io scheduler noop registered
[    0.690000] io scheduler deadline registered (default)
[    0.700000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.730000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
[    0.740000] m25p80 spi0.0: found mx25l3205d, expected m25p80
[    0.740000] m25p80 spi0.0: mx25l3205d (4096 Kbytes)
[    0.750000] 5 cmdlinepart partitions found on MTD device spi0.0
[    0.750000] Creating 5 MTD partitions on "spi0.0":
[    0.760000] 0x000000000000-0x000000040000 : "u-boot"
[    0.760000] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.770000] 0x000000050000-0x000000060000 : "u-boot-env-bak"
[    0.780000] 0x000000060000-0x000000070000 : "reserved"
[    0.780000] 0x000000070000-0x000000080000 : "art"
[    0.790000] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0x12
[    0.800000] nand: Macronix MX35LF1G4EAB 1G 3.3V 8-bit
[    0.800000] nand: 128MiB, SLC, page size: 2048, OOB size: 64
[    0.810000] Scanning device for bad blocks
[    0.870000] Bad eraseblock 966 at 0x0000078c0000
[    0.890000] 7 cmdlinepart partitions found on MTD device spi0.1
[    0.890000] Creating 7 MTD partitions on "spi0.1":
[    0.900000] 0x000000000000-0x000000200000 : "kernel-0"
[    0.900000] 0x000000200000-0x000002200000 : "root-0"
[    0.910000] 0x000002200000-0x000002400000 : "kernel-1"
[    0.920000] 0x000002400000-0x000004400000 : "root-1"
[    0.920000] 0x000004400000-0x000008000000 : "extend"
[    0.930000] 0x000000000000-0x000002200000 : "firmware0"
[    0.930000] 0x000002200000-0x000004400000 : "firmware1"
[    0.960000] libphy: ag71xx_mdio: probed
[    1.560000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[    1.570000] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.160000] ag71xx-mdio.1: Found an AR934X built-in switch
[    2.200000] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.210000] Bluetooth: HCI UART driver ver 2.2
[    2.210000] Bluetooth: HCI H4 protocol initialized
[    2.220000] Bluetooth: HCI BCSP protocol initialized
[    2.220000] Bluetooth: HCIATH3K protocol initialized
[    2.230000] TCP: cubic registered
[    2.230000] NET: Registered protocol family 10
[    2.240000] NET: Registered protocol family 17
[    2.240000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.260000] 8021q: 802.1Q VLAN Support v1.8
[    2.260000] bootconsole [early0] disabled
[    2.270000] UBI: attaching mtd6 to ubi0
[    2.760000] UBI: scanning is finished
[    2.780000] UBI: attached mtd6 (name "root-0", size 32 MiB) to ubi0
[    2.780000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    2.780000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    2.780000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[    2.780000] UBI: good PEBs: 256, bad PEBs: 0, corrupted PEBs: 0
[    2.780000] UBI: user volume: 2, internal volumes: 1, max. volumes count: 128
[    2.780000] UBI: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 51101808
[    2.780000] UBI: available PEBs: 0, total reserved PEBs: 256, PEBs reserved for bad PEB handling: 20
[    2.780000] UBI: background thread "ubi_bgt0d" started, PID 330
[    2.790000] mtd: device 12 (rootfs) set to be root filesystem
[    2.790000] UBI: attaching mtd9 to ubi1
[    3.700000] UBI: scanning is finished
[    3.730000] UBI: attached mtd9 (name "extend", size 60 MiB) to ubi1
[    3.730000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    3.730000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    3.730000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[    3.730000] UBI: good PEBs: 479, bad PEBs: 1, corrupted PEBs: 0
[    3.730000] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
[    3.730000] UBI: max/mean erase counter: 3/1, WL threshold: 4096, image sequence number: 1066470357
[    3.730000] UBI: available PEBs: 0, total reserved PEBs: 479, PEBs reserved for bad PEB handling: 19
[    3.730000] UBI: background thread "ubi_bgt1d" started, PID 348
[    3.730000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    3.730000] Warning: unable to open an initial console.
[    3.740000] VFS: Mounted root (squashfs filesystem) readonly on device 31:12.
[    3.740000] Freeing unused kernel memory: 176K (80474000 - 804a0000)
[    4.470000] init: Console is alive
[    4.470000] init: - watchdog -
[    5.860000] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    5.980000] usbcore: registered new interface driver usbfs
[    5.980000] usbcore: registered new interface driver hub
[    5.980000] usbcore: registered new device driver usb
[    5.980000] Button Hotplug driver version 0.4.1
[    5.990000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.990000] ehci-platform: EHCI generic platform driver
[    5.990000] ehci-platform ehci-platform: EHCI Host Controller
[    5.990000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[    5.990000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    6.010000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    6.010000] hub 1-0:1.0: USB hub found
[    6.010000] hub 1-0:1.0: 1 port detected
[    6.010000] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    6.500000] init: - preinit -
[    7.340000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    7.380000] random: mktemp urandom read with 11 bits of entropy available
[    9.620000] mount_root: loading kmods from internal overlay
[    9.650000] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[    9.650000] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
[   10.160000] block: attempting to load /etc/config/fstab
[   10.220000] block: extroot: not configured
[   10.220000] jffs2: write-buffering enabled buffer (2048) erasesize (126976)
[   10.230000] jffs2: Empty flash at 0x00401904 ends at 0x00402000
[   10.240000] jffs2: jffs2_scan_eraseblock(): Node at 0x004067fc {0x1985, 0xe001, 0x1985e001) has invalid CRC 0x0000002c (calculated 0x7168df63)
[   10.290000] jffs2: notice: (800) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   10.700000] block: attempting to load /etc/config/fstab
[   10.700000] block: extroot: not configured
[   10.710000] mount_root: switching to jffs2 overlay
[   10.730000] mount_root: fopivot system(rmdir_work: /bin/rm -rf /overlay/work) = 0 
[   10.760000] procd: - early -
[   10.760000] procd: - watchdog -
[   11.470000] procd: failed to set stdio
[   11.470000] procd: - ubus -
[   12.580000] procd: - init -
[   13.020000] kmodloader: loading kernel modules from /etc/modules.d/*
[   13.040000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   13.060000] i2c /dev entries driver
[   13.110000] u32 classifier
[   13.110000]     input device check on
[   13.110000]     Actions configured
[   13.110000] Mirror/redirect action on
[   13.210000] nf_conntrack version 0.5.0 (939 buckets, 3756 max)
[   13.210000] Loading modules backported from Linux version v3.18-116968-g2ab45bb
[   13.210000] Backport generated by backports.git backports-20160216-0-ge3c56e4
[   13.370000] ###################################################
[   13.370000] BTCOEX:Disabled
[   13.370000] 	priority_time:2
[   13.370000] 	first_slot_time:18
[   13.370000] 	wl_active_time:0
[   13.370000] 	wl_qc_time:0
[   13.370000] 	time_extend:10
[   13.370000] 	ack_cts:0
[   13.370000] 	btcoex_period:45
[   13.370000] 	btcoex_duty_cycle:40
[   13.370000] ###################################################
[   13.380000] ath: EEPROM regdomain: 0x0
[   13.380000] ath: EEPROM indicates default country code should be used
[   13.380000] ath: doing EEPROM country->regdmn map search
[   13.380000] ath: country maps to regdmn code: 0x3a
[   13.380000] ath: Country alpha2 being used: US
[   13.380000] ath: Regpair used: 0x3a
[   13.380000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   13.380000] ieee80211 phy0: Atheros AR9531 Rev:2 mem=0xb8100000, irq=47
[   13.450000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   13.490000] nf_conntrack_rtsp v0.6.21 loading
[   13.530000] nf_nat_rtsp v0.6.21 loading
[   13.570000] usbcore: registered new interface driver usbserial
[   13.570000] usbcore: registered new interface driver usbserial_generic
[   13.570000] usbserial: USB Serial support registered for generic
[   13.610000] xt_time: kernel timezone is -0000
[   13.610000] usbcore: registered new interface driver cp210x
[   13.610000] usbserial: USB Serial support registered for cp210x
[   13.630000] usbcore: registered new interface driver pl2303
[   13.630000] usbserial: USB Serial support registered for pl2303
[   13.630000] PPP generic driver version 2.4.2
[   13.630000] NET: Registered protocol family 24
[   13.640000] kmodloader: done loading kernel modules from /etc/modules.d/*
[   20.750000] UBIFS: background thread "ubifs_bgt1_0" started, PID 1310
[   20.920000] UBIFS: recovery needed
[   21.130000] UBIFS: recovery completed
[   21.130000] UBIFS: mounted UBI device 1, volume 0, name "media"
[   21.130000] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   21.130000] UBIFS: FS size: 56631296 bytes (54 MiB, 446 LEBs), journal size 2793472 bytes (2 MiB, 22 LEBs)
[   21.130000] UBIFS: reserved for root: 2674835 bytes (2612 KiB)
[   21.130000] UBIFS: media format: w4/r0 (latest is w4/r0), UUID 712FF777-9B19-451A-B367-17D1ABA0C012, small LPT model
[   21.330000] S45ubi (1314): drop_caches: 3

Kernel log after flashing:

## Booting image at 81000000 ...
   Image Name:   MIPS OpenWrt Linux-5.10.166
   Created:      2023-02-17  16:55:49 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    2446580 Bytes =  2.3 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x81000040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 5.10.166 (user@openwrt_build) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r19160+901-7ea2f3d6e2) 11.2.0, GNU ld (GNU Binutils)2.37) #0 Fri Feb 17 16:55:49 2023
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] MIPS: machine is Linkind,LDS-G152
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 55544K/65536K available (6002K kernel code, 591K rwdata, 1256K rodata, 1228K init, 205K bss, 9992K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 650.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5880801374 ns
[    0.000008] sched_clock: 32 bits at 325MHz, resolution 3ns, wraps every 6607641598ns
[    0.008301] Calibrating delay loop... 432.53 BogoMIPS (lpj=2162688)
[    0.074920] pid_max: default: 32768 minimum: 301
[    0.079959] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.087669] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.098101] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.108931] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.119346] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.126627] pinctrl core: initialized pinctrl subsystem
[    0.133741] NET: Registered protocol family 16
[    0.194693] clocksource: Switched to clocksource MIPS
[    0.201210] NET: Registered protocol family 2
[    0.206161] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.214437] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.223380] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.231482] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.238928] TCP: Hash tables configured (established 1024 bind 1024)
[    0.245786] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.252689] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.260396] NET: Registered protocol family 1
[    0.265059] PCI: CLS 0 bytes, default 32
[    0.279289] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.290671] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.296873] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.311633] pinctrl-single 1804002c.pinmux: 576 pins, size 72
[    0.318710] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.326201] printk: console [ttyS0] disabled
[    0.330784] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 9, base_baud = 1562500) is a 16550A
[    0.339946] printk: console [ttyS0] enabled
[    0.339946] printk: console [ttyS0] enabled
[    0.349009] printk: bootconsole [early0] disabled
[    0.349009] printk: bootconsole [early0] disabled
[    0.370755] spi-nand spi0.1: Macronix SPI NAND was found.
[    0.376419] spi-nand spi0.1: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
[    0.387478] 3 fixed-partitions partitions found on MTD device (null)
[    0.394096] OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
[    0.400998] OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
[    0.408162] OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
[    0.415066] OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
[    0.422114] Creating 3 MTD partitions on "(null)":
[    0.427125] 0x000000000000-0x000002200000 : "firmware0"
[    0.472996] 2 uimage-fw partitions found on MTD device firmware0
[    0.479282] Creating 2 MTD partitions on "firmware0":
[    0.484508] 0x000000000000-0x000000200000 : "kernel"
[    0.491548] 0x000000200000-0x000002200000 : "ubi"
[    0.497825] 0x000002200000-0x000004400000 : "firmware1"
[    0.538538] 2 uimage-fw partitions found on MTD device firmware1
[    0.544810] Creating 2 MTD partitions on "firmware1":
[    0.550033] 0x000000000000-0x000000260000 : "kernel"
[    0.556268] 0x000000260000-0x000002200000 : "rootfs"
[    0.564196] mtd: setting mtd5 (rootfs) as root device
[    0.570782] 1 squashfs-split partitions found on MTD device rootfs
[    0.577209] 0x000000620000-0x000002200000 : "rootfs_data"
[    0.585056] 0x000004400000-0x000008000000 : "extend"
[    0.651986] spi-nor spi0.0: mx25l3205d (4096 Kbytes)
[    0.657233] 5 fixed-partitions partitions found on MTD device spi0.0
[    0.663793] Creating 5 MTD partitions on "spi0.0":
[    0.668788] 0x000000000000-0x000000040000 : "u-boot"
[    0.675985] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.682565] 0x000000050000-0x000000060000 : "u-boot-env-bak"
[    0.691122] 0x000000060000-0x000000070000 : "reserved"
[    0.697699] 0x000000070000-0x000000080000 : "art"
[    0.709205] ag71xx 1a000000.eth: invalid MAC address, using random address
[    1.407608] switch0: Atheros AR8229 rev. 1 switch registered on mdio.0
[    1.466652] ag71xx 1a000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
[    1.476599] eth0: Atheros AG71xx at 0xba000000, irq 5, mode: gmii
[    1.484943] NET: Registered protocol family 10
[    1.497088] Segment Routing with IPv6
[    1.500997] NET: Registered protocol family 17
[    1.505752] 8021q: 802.1Q VLAN Support v1.8
[    1.515331] PCI host bridge /ahb/pcie-controller@180c0000 ranges:
[    1.521668]  MEM 0x0000000010000000..0x0000000013ffffff
[    1.527119]   IO 0x0000000000000000..0x0000000000000000
[    1.532522] ar724x-pci 180c0000.pcie-controller: PCIe link is down
[    1.539117] PCI host bridge to bus 0000:00
[    1.543360] pci_bus 0000:00: root bus resource [mem 0x10000000-0x13ffffff]
[    1.550489] pci_bus 0000:00: root bus resource [io  0x0000]
[    1.556255] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    1.563269] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    1.572293] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
[    1.582677] UBI: auto-attach mtd2
[    1.586192] ubi0: attaching mtd2
[    2.236015] ubi0: scanning is finished
[    2.270766] ubi0: attached mtd2 (name "ubi", size 32 MiB)
[    2.276415] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    2.283516] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    2.290546] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    2.297746] ubi0: good PEBs: 256, bad PEBs: 0, corrupted PEBs: 0
[    2.303945] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    2.311411] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 51101808
[    2.320666] ubi0: available PEBs: 0, total reserved PEBs: 256, PEBs reserved for bad PEB handling: 20
[    2.330302] ubi0: background thread "ubi_bgt0d" started, PID 319
[    2.339487] block ubiblock0_0: created from ubi0:0(rootfs)
[    2.381246] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    2.395246] Freeing unused kernel memory: 1228K
[    2.399923] This architecture does not have kernel memory protection.
[    2.406611] Run /sbin/init as init process
[    4.440402] init: Console is alive
[    4.444447] init: - watchdog -
[    7.283676] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    7.586067] usbcore: registered new interface driver usbfs
[    7.591841] usbcore: registered new interface driver hub
[    7.597484] usbcore: registered new device driver usb
[    7.614645] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    7.623283] fsl-ehci: Freescale EHCI Host controller driver
[    7.631803] ehci-platform: EHCI generic platform driver
[    7.637647] ehci-platform 1b000000.usb: EHCI Host Controller
[    7.643551] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1
[    7.651821] ehci-platform 1b000000.usb: irq 3, io mem 0x1b000000
[    7.684713] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
[    7.692083] hub 1-0:1.0: USB hub found
[    7.699146] hub 1-0:1.0: 1 port detected
[    7.707344] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    7.725397] init: - preinit -
[   11.344585] random: jshn: uninitialized urandom read (4 bytes read)
[   11.716822] random: jshn: uninitialized urandom read (4 bytes read)
[   11.764983] random: jshn: uninitialized urandom read (4 bytes read)
[   11.996717] eth0: link up (1000Mbps/Full duplex)
[   12.001529] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   16.634525] UBIFS error (ubi0:1 pid 436): ubifs_read_node: bad node type (255 but expected 6)
[   16.643403] UBIFS error (ubi0:1 pid 436): ubifs_read_node: bad node at LEB 0:0, LEB mapping status 0
[   16.652847] Not a node, first 24 bytes:
[   16.652862] 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff                          ........................
[   16.670126] CPU: 0 PID: 436 Comm: mount_root Not tainted 5.10.166 #0
[   16.676688] Stack : 80800000 80701730 00000000 00000000 81b95cec 80940000 80780000 806d0310
[   16.685352]         80d23148 80781de7 809432d0 000001b4 00000006 00000001 81b95ca0 11bffbf1
[   16.693997]         00000000 00000000 806d0310 81b95b40 ffffefff 00000000 00000000 ffffffea
[   16.702653]         0000009f 81b95b4c 0000009f 80787ae8 80000000 ffffffea 00001000 00000000
[   16.711309]         81a71000 00000006 00000000 807f89e4 00000018 803f238c 00000000 80940000
[   16.719965]         ...
[   16.722491] Call Trace:
[   16.725047] [<80066ea4>] show_stack+0x30/0x100
[   16.729641] [<8026a3ec>] ubifs_read_node+0x274/0x2d4
[   16.734785] [<80266c00>] ubifs_read_superblock+0x74/0x12c8
[   16.740452] [<80265cdc>] ubifs_mount+0xa60/0x16a4
[   16.745339] [<801f584c>] legacy_get_tree+0x2c/0x70
[   16.750310] [<801be4ec>] vfs_get_tree+0x2c/0xf8
[   16.755017] [<801e32b8>] path_mount+0x400/0x9fc
[   16.759699] [<801e3dcc>] sys_mount+0x204/0x2a4
[   16.764286] [<8006e6ac>] syscall_common+0x34/0x58
[   16.769155]
[   16.774922] mount_root: failed to mount -t ubifs /dev/ubi0_1 /tmp/overlay: Invalid argument
[   16.786050] urandom-seed: Seed file not found (/etc/urandom.seed)
[   17.316187] eth0: link down
[   17.332683] procd: - early -
[   17.336157] procd: - watchdog -
[   18.250320] procd: - watchdog -
[   18.254151] procd: - ubus -
[   18.481539] random: ubusd: uninitialized urandom read (4 bytes read)
[   18.490950] random: ubusd: uninitialized urandom read (4 bytes read)
[   18.498167] random: ubusd: uninitialized urandom read (4 bytes read)
[   18.524150] procd: - init -
Please press Enter to activate this console.
[   20.013834] random: jshn: uninitialized urandom read (4 bytes read)
[   20.031777] random: ubusd: uninitialized urandom read (4 bytes read)
[   20.038758] random: ubus: uninitialized urandom read (4 bytes read)
[   20.981444] kmodloader: loading kernel modules from /etc/modules.d/*
[   21.019994] random: jsonfilter: uninitialized urandom read (4 bytes read)
[   21.551929] i2c /dev entries driver
[   21.563365] i2c-gpio i2c: using lines 17 (SDA) and 16 (SCL)
[   21.593772] Loading modules backported from Linux version v5.15.92-0-ge515b9902f5f
[   21.601666] Backport generated by backports.git v5.15.92-1-0-gdfe0f60c
[   21.652959] urngd: v1.0.2 started.
[   21.670258] usbcore: registered new interface driver usbserial_generic
[   21.677174] usbserial: USB Serial support registered for generic
[   22.149839] usbcore: registered new interface driver ch341
[   22.155655] usbserial: USB Serial support registered for ch341-uart
[   22.348594] usbcore: registered new interface driver pl2303
[   22.354441] usbserial: USB Serial support registered for pl2303
[   22.377745] PPP generic driver version 2.4.2
[   22.396642] NET: Registered protocol family 24
[   22.494240] kmodloader: done loading kernel modules from /etc/modules.d/*
[   22.560803] random: crng init done
[   22.564334] random: 24 urandom warning(s) missed due to ratelimiting

Now, first thing I need to make sure I communicate - my DTS file was misisng network releated sections (spent time working through the flash and then forgot I wasn't done). So eithernet, wifi, and maybe one other thing were not present. I left all this out because I didn't think it was relavent to the MTD issue.

Speaking of DTS, here is my DTS so far (with network stuff added back in... making a new build tomorrow):

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "qca953x.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "linkind,lds-g152", "qca,qca9531";
	model = "Linkind,LDS-G152";

	aliases {
		led-boot = &led_power_green;
		led-failsafe = &led_power_green;
		led-running = &led_power_green;
		led-upgrade = &led_power_green;
	};

	leds {
		compatible = "gpio-leds";

		led_power_green: power_green {
			label = "green:power";
			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
		};

		lan_green {
			label = "green:lan";
			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
		};

		wan_green {
			label = "green:wan";
			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
		};
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			linux,code = <KEY_RESTART>;
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
		};
	};

	i2c: i2c {
		compatible = "i2c-gpio";

		sda-gpios = <&gpio 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
		scl-gpios = <&gpio 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
	};
};

&pcie0 {
	status = "okay";
};

&usb0 {
	status = "okay";

	dr_mode = "host";
};

&usb_phy {
	status = "okay";
};

&wdt {
	status = "okay";
};

&spi {
	status = "okay";

	/* Macronix MX25l3205D SPI flash */
	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <25000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "u-boot";
				reg = <0x000000 0x040000>;
				read-only;
			};

			partition@40000 {
				label = "u-boot-env";
				reg = <0x040000 0x010000>;
			};

			partition@50000 {
				label = "u-boot-env-bak";
				reg = <0x050000 0x010000>;
			};

			partition@60000 {
				label = "reserved";
				reg = <0x060000 0x010000>;
				read-only;
			};

			art: partition@70000 {
				label = "art";
				reg = <0x070000 0x010000>;
				read-only;
			};
		};
	};

	/* Macronix MX35LF1G4EAB Nand? flash */
	flash@1 {
		compatible = "spi-nand";
		reg = <1>;
		spi-max-frequency = <25000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			firmware0:partition@0 {
				compatible = "denx,uimage";
				label = "firmware0";
				reg = <0x000000 0x2200000>;
			};

			firmware1:partition@2200000 {
				compatible = "denx,uimage";
				label = "firmware1";
				reg = <0x2200000 0x2200000>;
			};

			partition@4400000 {
				label = "extend";
				reg = <0x4400000 0x3c00000>;
			};
		};
	};
};

&eth0 {
	status = "okay";

	phy-handle = <&swphy4>;

	nvmem-cells = <&macaddr_art_0>;
	nvmem-cell-names = "mac-address";
};

&eth1 {
	nvmem-cells = <&macaddr_art_0>;
	nvmem-cell-names = "mac-address";
	mac-address-increment = <1>;
};

&wmac {
	status = "okay";

	mtd-cal-data = <&art 0x1000>;
};

&art {
	compatible = "nvmem-cells";
	#address-cells = <1>;
	#size-cells = <1>;

	macaddr_art_0: macaddr@0 {
		reg = <0x0 0x6>;
	};
};

more in next post (hit character limit)...

When I compared the old and new kernel logs, I can see that all the partitions are present... but for some reason the new firmware loaded spi0.1 before spi0.0... When I started I had put the device in the general.mk and related files in the general directories... when I did this the build only loaded spi0.0 (nor flash). I then had the epiphany (could be incorrect) that I needed to move everything to the nand.mk and related nand directories. Once I did this, I got the build that these logs are from - both flash chips are recogniezd, but in reverse order.

Moving everything to the nand directories/make file could have been wrong... but that was what I guessed needed to be done to get the second flash chip to be recognized. It seems to work - just don't understand why it's loading spi0.1 before spi0.0 unless it's because I have it in the nand.mk file instead of generic.mk. If that is the case, I would ask the question - how do I get nand flash recognized when using the generic.mk file?

I hope this fills in the gaps... I 'm happy to share anything else... I know I've very inexperienced in this, and learning as I go.

Thanks!
Deadend

Only 'nand' subtarget has NAND drivers enabled, so putting the device there is only choice (unless You don't want to use that flash space). Your dts looks ok. Try to remove/comment whole nvmem node and "denx,uimage" compatibles. For experimenting always use initramfs image. What I don't understand is why kernel tries to attach/create partitions on null device, maybe that's an issue with the driver. Try also with 5.4 kernel (21.03 release) and with 5.15 kernel (snapshot). The reversed detection order should go away, after kernel attaches partitions to proper device. It might be also related to https://github.com/openwrt/openwrt/issues/10232.

I just installed a new build with all the devices (since I previously forgot the last few lines for eth and wman. Here's the new log:

[    0.000000] Linux version 5.10.166 (user@openwrt_build) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r19160+901-7ea2f3d6e2) 11.2.0, GNU ld (GNU Binutils)2.37) #0 Sun Feb 19 05:14:01 2023
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] MIPS: machine is Linkind,LDS-G152
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000]   Normal zone: 144 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 55544K/65536K available (6002K kernel code, 591K rwdata, 1256K rodata, 1228K init, 205K bss, 9992K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 650.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5880801374 ns
[    0.000009] sched_clock: 32 bits at 325MHz, resolution 3ns, wraps every 6607641598ns
[    0.008302] Calibrating delay loop... 432.53 BogoMIPS (lpj=2162688)
[    0.074920] pid_max: default: 32768 minimum: 301
[    0.079961] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.087669] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.098101] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.109015] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.119429] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.126712] pinctrl core: initialized pinctrl subsystem
[    0.133830] NET: Registered protocol family 16
[    0.195454] clocksource: Switched to clocksource MIPS
[    0.201973] NET: Registered protocol family 2
[    0.206928] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.215196] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.224140] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.232240] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.239685] TCP: Hash tables configured (established 1024 bind 1024)
[    0.246540] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.253450] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.261155] NET: Registered protocol family 1
[    0.265829] PCI: CLS 0 bytes, default 32
[    0.280019] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.291386] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.297589] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.312356] pinctrl-single 1804002c.pinmux: 576 pins, size 72
[    0.319492] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.326984] printk: console [ttyS0] disabled
[    0.331566] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 9, base_baud = 1562500) is a 16550A
[    0.340728] printk: console [ttyS0] enabled
[    0.349792] printk: bootconsole [early0] disabled
[    0.371901] spi-nand spi0.1: Macronix SPI NAND was found.
[    0.377568] spi-nand spi0.1: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
[    0.388628] 3 fixed-partitions partitions found on MTD device (null)
[    0.395246] OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
[    0.402147] OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
[    0.409515] OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
[    0.416423] OF: Bad cell count for /ahb/spi@1f000000/flash@1/partitions
[    0.423668] Creating 3 MTD partitions on "(null)":
[    0.428680] 0x000000000000-0x000002200000 : "firmware0"
[    0.474471] 2 uimage-fw partitions found on MTD device firmware0
[    0.480740] Creating 2 MTD partitions on "firmware0":
[    0.485987] 0x000000000000-0x000000200000 : "kernel"
[    0.493007] 0x000000200000-0x000002200000 : "ubi"
[    0.499265] 0x000002200000-0x000004400000 : "firmware1"
[    0.540083] 2 uimage-fw partitions found on MTD device firmware1
[    0.546354] Creating 2 MTD partitions on "firmware1":
[    0.551576] 0x000000000000-0x000000260000 : "kernel"
[    0.557803] 0x000000260000-0x000002200000 : "rootfs"
[    0.565848] mtd: setting mtd5 (rootfs) as root device
[    0.572366] 1 squashfs-split partitions found on MTD device rootfs
[    0.578817] 0x000000620000-0x000002200000 : "rootfs_data"
[    0.586628] 0x000004400000-0x000008000000 : "extend"
[    0.653654] spi-nor spi0.0: mx25l3205d (4096 Kbytes)
[    0.658905] 5 fixed-partitions partitions found on MTD device spi0.0
[    0.665544] OF: Bad cell count for /ahb/spi@1f000000/flash@0/partitions
[    0.672399] OF: Bad cell count for /ahb/spi@1f000000/flash@0/partitions
[    0.679975] Creating 5 MTD partitions on "spi0.0":
[    0.684947] 0x000000000000-0x000000040000 : "u-boot"
[    0.693123] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.699771] 0x000000050000-0x000000060000 : "u-boot-env-bak"
[    0.708398] 0x000000060000-0x000000070000 : "reserved"
[    0.714803] 0x000000070000-0x000000080000 : "art"
[    1.076545] ag71xx 19000000.eth: Could not connect to PHY device. Deferring probe.
[    1.768384] switch0: Atheros AR8229 rev. 1 switch registered on mdio.0
[    1.827417] ag71xx 1a000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
[    1.837398] eth0: Atheros AG71xx at 0xba000000, irq 5, mode: gmii
[    1.845886] NET: Registered protocol family 10
[    1.858660] Segment Routing with IPv6
[    1.862572] NET: Registered protocol family 17
[    1.867329] 8021q: 802.1Q VLAN Support v1.8
[    1.876773] PCI host bridge /ahb/pcie-controller@180c0000 ranges:
[    1.883108]  MEM 0x0000000010000000..0x0000000013ffffff
[    1.888561]   IO 0x0000000000000000..0x0000000000000000
[    1.893963] ar724x-pci 180c0000.pcie-controller: PCIe link is down
[    1.900547] PCI host bridge to bus 0000:00
[    1.904792] pci_bus 0000:00: root bus resource [mem 0x10000000-0x13ffffff]
[    1.911919] pci_bus 0000:00: root bus resource [io  0x0000]
[    1.917687] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    1.924700] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    1.933742] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
[    2.277549] ag71xx 19000000.eth: connected to PHY at mdio.0:1f:04 [uid=004dd042, driver=Generic PHY]
[    2.287935] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode: mii
[    2.297928] UBI: auto-attach mtd2
[    2.301391] ubi0: attaching mtd2
[    2.953428] ubi0: scanning is finished
[    2.988210] ubi0: attached mtd2 (name "ubi", size 32 MiB)
[    2.993801] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    3.000956] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    3.007985] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    3.015174] ubi0: good PEBs: 256, bad PEBs: 0, corrupted PEBs: 0
[    3.021389] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    3.028859] ubi0: max/mean erase counter: 3/0, WL threshold: 4096, image sequence number: 51101808
[    3.038114] ubi0: available PEBs: 0, total reserved PEBs: 256, PEBs reserved for bad PEB handling: 20
[    3.047750] ubi0: background thread "ubi_bgt0d" started, PID 331
[    3.056948] block ubiblock0_0: created from ubi0:0(rootfs)
[    3.101332] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    3.115307] Freeing unused kernel memory: 1228K
[    3.120023] This architecture does not have kernel memory protection.
[    3.126693] Run /sbin/init as init process
[    3.130917]   with arguments:
[    3.130921]     /sbin/init
[    3.130925]   with environment:
[    3.130930]     HOME=/
[    3.130934]     TERM=linux
[    5.158515] init: Console is alive
[    5.162562] init: - watchdog -
[    7.996565] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    8.301089] usbcore: registered new interface driver usbfs
[    8.306898] usbcore: registered new interface driver hub
[    8.312494] usbcore: registered new device driver usb
[    8.328443] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    8.338351] fsl-ehci: Freescale EHCI Host controller driver
[    8.346674] ehci-platform: EHCI generic platform driver
[    8.352462] ehci-platform 1b000000.usb: EHCI Host Controller
[    8.358422] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1
[    8.366670] ehci-platform 1b000000.usb: irq 3, io mem 0x1b000000
[    8.395473] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
[    8.402810] hub 1-0:1.0: USB hub found
[    8.407675] hub 1-0:1.0: 1 port detected
[    8.417753] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    8.427601] init: - preinit -
[   12.044478] random: jshn: uninitialized urandom read (4 bytes read)
[   12.415767] random: jshn: uninitialized urandom read (4 bytes read)
[   12.463495] random: jshn: uninitialized urandom read (4 bytes read)
[   12.694248] eth0: link up (1000Mbps/Full duplex)
[   12.705701] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   17.334357] UBIFS (ubi0:1): Mounting in unauthenticated mode
[   17.345602] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 449
[   17.509301] UBIFS (ubi0:1): recovery needed
[   17.868892] UBIFS (ubi0:1): recovery completed
[   17.873600] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[   17.881727] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   17.891979] UBIFS (ubi0:1): FS size: 17776640 bytes (16 MiB, 140 LEBs), journal size 1015809 bytes (0 MiB, 7 LEBs)
[   17.902672] UBIFS (ubi0:1): reserved for root: 839634 bytes (819 KiB)
[   17.909336] UBIFS (ubi0:1): media format: w5/r0 (latest is w5/r0), UUID 979C5FE2-A4D2-4746-98EA-FD4EF3DC1E21, small LPT model
[   17.938051] mount_root: switching to ubifs overlay
[   17.982983] urandom-seed: Seeding with /etc/urandom.seed
[   18.540401] eth0: link down
[   18.557510] procd: - early -
[   18.560880] procd: - watchdog -
[   19.483841] procd: - watchdog -
[   19.487765] procd: - ubus -
[   19.718310] random: ubusd: uninitialized urandom read (4 bytes read)
[   19.728022] random: ubusd: uninitialized urandom read (4 bytes read)
[   19.735200] random: ubusd: uninitialized urandom read (4 bytes read)
[   19.761276] procd: - init -
[   21.373882] random: jshn: uninitialized urandom read (4 bytes read)
[   21.392317] random: ubusd: uninitialized urandom read (4 bytes read)
[   21.399308] random: ubus: uninitialized urandom read (4 bytes read)
[   22.380171] kmodloader: loading kernel modules from /etc/modules.d/*
[   22.948767] i2c /dev entries driver
[   22.969082] i2c-gpio i2c: using lines 17 (SDA) and 16 (SCL)
[   22.994820] urngd: v1.0.2 started.
[   23.001980] Loading modules backported from Linux version v5.15.92-0-ge515b9902f5f
[   23.009885] Backport generated by backports.git v5.15.92-1-0-gdfe0f60c
[   23.069989] usbcore: registered new interface driver usbserial_generic
[   23.076920] usbserial: USB Serial support registered for generic
[   23.552542] usbcore: registered new interface driver ch341
[   23.558384] usbserial: USB Serial support registered for ch341-uart
[   23.767141] usbcore: registered new interface driver pl2303
[   23.772988] usbserial: USB Serial support registered for pl2303
[   23.788616] PPP generic driver version 2.4.2
[   23.807482] NET: Registered protocol family 24
[   23.922165] ath: EEPROM regdomain: 0x0
[   23.922181] ath: EEPROM indicates default country code should be used
[   23.922186] ath: doing EEPROM country->regdmn map search
[   23.922202] ath: country maps to regdmn code: 0x3a
[   23.922209] ath: Country alpha2 being used: US
[   23.922214] ath: Regpair used: 0x3a
[   23.933489] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   23.935825] ieee80211 phy0: Atheros AR9531 Rev:2 mem=0xb8100000, irq=13
[   23.948349] random: crng init done
[   23.951881] random: 25 urandom warning(s) missed due to ratelimiting
[   24.177430] kmodloader: done loading kernel modules from /etc/modules.d/*

Seems there is something causing it to reboot - but it stays up for a few minutes...
My uci defaults are not working as the wireless is suppose to be enabled by default - digging now to see what errors I can find beyond that.

I did want to try the initramfs boot as it would probably be much easier... but I wasn't certain how to flash it... can this be done from the GUI sysupgrade of the old firmware - or does it have to be done through sysupgrade in cli?

follow up... I just checked the u-boot and it looks like there might be something there...

U-Boot 1.1.4-g5c594c07-dirty (Dec 13 2019 - 11:38:48)

cus531mp3 - Honey Bee 2.0DRAM:
sri
Honey Bee 2.0
ath_ddr_initial_config(195): (16bit) ddr2 init
ath_sys_frequency: cpu 650 ddr 597 ahb 216
tap = 0x00000003
Tap (low, high) = (0x7, 0x23)
Tap values = (0x15, 0x15, 0x15, 0x15)
64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 222k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
Flash Manuf Id 0xc2, DeviceId0 0x20, DeviceId1 0x16
flash size 0MB, sector count = 8
Flash: 512 kB
Power up PLL with outdiv = 0 then switch to 3
*** Warning *** : PCIe WLAN Module not found !!!
In:    serial
Out:   serial
Err:   serial
Net:   ath_gmac_enet_initialize...
No valid address in Flash. Using fixed address
No valid address in Flash. Using fixed address
ath_gmac_enet_initialize: reset mask:c02200
Honey Bee ---->S27 PHY*
S27 reg init
: cfg1 0x800c0000 cfg2 0x7114
eth0: 00:03:7f:09:0b:ad
athrs27_phy_setup ATHR_PHY_CONTROL 4 :1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 4 :10
eth0 up
Honey Bee ---->  MAC 1 S27 PHY *
S27 reg init
ATHRS27: resetting s27
ATHRS27: s27 reset done
: cfg1 0x800c0000 cfg2 0x7214
eth1: 00:03:7f:09:0b:ad
athrs27_phy_setup ATHR_PHY_CONTROL 0 :1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 0 :10
athrs27_phy_setup ATHR_PHY_CONTROL 1 :1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 1 :10
athrs27_phy_setup ATHR_PHY_CONTROL 2 :1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 2 :10
athrs27_phy_setup ATHR_PHY_CONTROL 3 :1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 3 :10
eth1 up
eth0, eth1
Qualcomm Atheros SPI NAND Driver, Version 0.1 (c) 2014  Qualcomm Atheros Inc.
====== NAND Parameters ======
sc = 0x83ff8a00 page = 0x800 block = 0x20000
Setting 0x181162c0 to 0x2851a100
Hit any key to stop autoboot:  0

Loading from device 0: ath-spi-nand (offset 0x2200000)
   Image Name:   MIPS OpenWrt Linux-5.10.166
   Created:      2023-02-19   5:14:01 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    2446623 Bytes =  2.3 MB
   Load Address: 80060000
   Entry Point:  80060000
## Booting image at 81000000 ...
   Image Name:   MIPS OpenWrt Linux-5.10.166
   Created:      2023-02-19   5:14:01 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    2446623 Bytes =  2.3 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x81000040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

I expect this is pointing to the issue...
I see multiple things here that probably aren't good...

Rarely initramfs image is flashed to device, unless particular implementation requires it. Read this: https://openwrt.org/docs/techref/image.format#initramfs. Unfortunately for initramfs You'll need UART console and access to bootloader. Judging from the device You are trying to port, that should be accessible.

Might be a watchdoq expiring, You'll find more clues after looking at UART console.

oh... here's something...
The bootargs - I see these are being inherited from qca953x.dtsi

	chosen {
		bootargs = "console=ttyS0,115200n8";
	};

The original firmware of this device has a kernel log with:
Kernel command line: ubi.mtd=root-0 version=g5c594c0-1 board=LDS-G152 console=ttyUSB0,115200 ubi.mtd=extend rootfs=/dev/mtdblock:rootfs rootfstype=squashfs noinitrd init=/sbin/init bootslot=0 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(u-boot-env-bak),64k(reserved),64k(art);spi0.1:2m(kernel-0)ro,32m(root-0),2m(kernel-1),32m(root-1),60m(extend),34m@0x0(firmware0),34m@0x2200000(firmware1) production=0000 hwversion=V2.0 app_switch=default mem=64M board=LDS-G152 rootfstype=squashfs,jffs2 noinitrd

After updating the kernel command line is only:
Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2

so I think a large amount of the boot args are being lost... perhaps I need to add this to the DTS file to fix it...

As fart as UART console... I have pulled the board and am connected via USB FTDI adapter using Putty. I'll take a look at the link and see if I can use the initramfs...

Leave the bootargs for now, the default should suffice

It usually involves setting up TFTP server, entering bootloader command line, downloading initramfs image from TFTP server to specific memory address, and booting from that address.

Ah yes - I don't think I can use TFTP... this device doesn't have an ethernet port :slight_smile: .
I might be able to get a usb to ethernet connection working - haven't tried yet.
TFTP I couldn't find any documentation of doing over serial.

for the bootargs, I believe I will need to modify them as ttyS0 is used by the device.

serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A

The boot args in the original firmware used console=ttyUSB0,115200 so I might have to do that eventually to get the attached device working - but for now better to have console on ttyS0 for putty connection (If I understand what I'm doing).

welp... looks like trying to use the stable branch was my problem (who would have thunk)!
I cherry picked my commit to a new branch based on master instead of 22.03 - and It's Alive!.

Thanks for your help @tmn505 - I don't know how long I would have wasted trying to get it working on 22.03.
I actually started on the master branch, but was having build issues and switched to 22.03.
Ends up my build issues were hardware related (out of memory errors) - all good now!

Thanks again,
Deadend

Glad it worked out. I'm curious what has changed, please post bootlog of the snapshot.
BTW loading initramfs could be done from USB stick but I don't think it was ever implemented in Qualcomm/Atheros U-Boot fork. The only solution left would be loading through UART, either by kermit protocol (a bit faster) or using ubootwrite.py (slower), but that's very slow, usually 115200 bit/s (baud value).

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