Ok, further success. I found an option in the firmware to "Load system code to SDRAM via TFTP." So I setup the env to point to my tftp server and renamed the OpenWrt firmware to test.bin and here's what happened.
Automatic boot of image at addr 0x80A00000 ...
## Booting image at 80a00000 ...
Image Name: MIPS OpenWrt Linux-4.14.95
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 1437410 Bytes = 1.4 MB
Load Address: 80000000
Entry Point: 80000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 64
Starting kernel ...
[ 0.000000] Linux version 4.14.95 (buildbot@builds-03.infra.lede-project.org) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7627-753531d)) #0 Mon Jan 28 08:54:32 2019
[ 0.000000] Board has DDR2
[ 0.000000] Analog PMU set to hw control
[ 0.000000] Digital PMU set to hw control
[ 0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[ 0.000000] MIPS: machine is Phicomm PSG1218 rev.A
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 04000000 @ 00000000 (usable)
[ 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, PIPT, no 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] random: get_random_bytes called from 0x8042472c with crng_init=0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[ 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=0003f26b
[ 0.000000] Readback ErrCtl register=0003f26b
[ 0.000000] Memory: 60240K/65536K available (3590K kernel code, 178K rwdata, 464K rodata, 176K init, 214K bss, 5296K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 256
[ 0.000000] CPU Clock: 580MHz
[ 0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[ 0.000000] systick: enable autosleep mode
[ 0.000000] systick: running - mult: 214748, shift: 32
[ 0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[ 0.000013] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[ 0.015476] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[ 0.087704] pid_max: default: 32768 minimum: 301
[ 0.097128] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.110148] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.130128] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.149606] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.161784] pinctrl core: initialized pinctrl subsystem
[ 0.173381] NET: Registered protocol family 16
[ 0.186607] Can't analyze schedule() prologue at 8037d498
[ 0.450301] PCI host bridge /pcie@10140000 ranges:
[ 0.459694] MEM 0x0000000020000000..0x000000002fffffff
[ 0.470070] IO 0x0000000010160000..0x000000001016ffff
[ 0.497607] rt2880_gpio 10000600.gpio: registering 24 gpios
[ 0.508638] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[ 0.521762] PCI host bridge to bus 0000:00
[ 0.529761] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[ 0.543471] pci_bus 0000:00: root bus resource [io 0xffffffff]
[ 0.555205] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[ 0.568704] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[ 0.584916] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[ 0.601473] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[ 0.614523] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[ 0.628338] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[ 0.641841] pci 0000:00:00.0: BAR 9: assigned [mem 0x20100000-0x201fffff pref]
[ 0.656204] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
[ 0.669715] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit]
[ 0.684259] pci 0000:01:00.0: BAR 6: assigned [mem 0x20100000-0x2010ffff pref]
[ 0.698605] pci 0000:00:00.0: PCI bridge to [bus 01]
[ 0.708464] pci 0000:00:00.0: bridge window [mem 0x20000000-0x200fffff]
[ 0.721974] pci 0000:00:00.0: bridge window [mem 0x20100000-0x201fffff pref]
[ 0.740278] clocksource: Switched to clocksource systick
[ 0.751915] NET: Registered protocol family 2
[ 0.761484] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.775258] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.787847] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.800620] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.812126] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.824821] NET: Registered protocol family 1
[ 0.836160] rt-timer 10000100.timer: maximum frequency is 1220Hz
[ 0.848866] Crashlog allocated RAM at address 0x3f00000
[ 0.860987] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.879676] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.891168] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.921013] io scheduler noop registered
[ 0.928658] io scheduler deadline registered (default)
[ 0.939850] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[ 0.955298] console [ttyS0] disabled
[ 0.962351] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[ 0.982017] console [ttyS0] enabled
[ 0.982017] console [ttyS0] enabled
[ 0.995834] bootconsole [early0] disabled
[ 0.995834] bootconsole [early0] disabled
[ 1.012394] cacheinfo: Failed to find cpu0 device node
[ 1.022668] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 1.042211] spi spi0.0: force spi mode3
[ 1.050691] m25p80 spi0.0: mx25l6405d (8192 Kbytes)
[ 1.060501] 4 fixed-partitions partitions found on MTD device spi0.0
[ 1.073162] Creating 4 MTD partitions on "spi0.0":
[ 1.082720] 0x000000000000-0x000000030000 : "u-boot"
[ 1.093536] 0x000000030000-0x000000040000 : "u-boot-env"
[ 1.105056] 0x000000040000-0x000000050000 : "factory"
[ 1.116038] 0x000000050000-0x000000800000 : "firmware"
[ 2.059970] libphy: Fixed MDIO Bus: probed
[ 2.072500] gsw: setting port4 to ephy mode
[ 2.080903] mtk_soc_eth 10100000.ethernet eth0 (uninitialized): port 0 link up (100Mbps/Full duplex)
[ 2.099353] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[ 2.111862] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[ 2.128870] rt2880_wdt 10000120.watchdog: Initialized
[ 2.140421] NET: Registered protocol family 10
[ 2.153303] Segment Routing with IPv6
[ 2.160793] NET: Registered protocol family 17
[ 2.169692] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[ 2.195525] 8021q: 802.1Q VLAN Support v1.8
[ 2.206692] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 2.221671] Please append a correct "root=" boot option; here are the available partitions:
[ 2.238324] 1f00 192 mtdblock0
[ 2.238329] (driver?)
[ 2.251364] 1f01 64 mtdblock1
[ 2.251369] (driver?)
[ 2.264389] 1f02 64 mtdblock2
[ 2.264393] (driver?)
[ 2.277416] 1f03 7872 mtdblock3
[ 2.277420] (driver?)
[ 2.290451] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 2.308240] Rebooting in 1 seconds..
So it looks like the kernel is booting but needs more info about rootfs ( Full dump at https://pastebin.com/upGF44w6 as well) I'm kind of out of my league here but it seems to me that the mtdblocks are different then the original firmware, but I'm assuming that the blocks are created by the firmware on boot. All in all it looks like this firmware should work. I tried to do a tftp upload and mtd write firmware.bin firmware but it just came back to the command line without doing anything. I (dangerously) tried -f but same thing.
BTW - I'm using the OpenWrt Image from the Phicomm K2 PSG1218 router as it had similar specs, but on further investigation, I think I'm wrong about the configuring of the MTD's as I did an upgrade flash (holding the button on boot with tftp of upgrade.bin) of the firmware and got the same error. I was able to reflash the original firmware so at least I know I'm close. (Sorry slh for being so reckless)
I'm currently compiling git for Phicomm PSG1218 rev.A. I looked at the dsti file and see where the MTD's setup happens. Going to try modifying those to reflect the original firmware. Any help here is GREATLY appreciated. I'm not all that clear on the MTD configuration yet.
Victory! I change ./target/linux/ramips/dts/PSG1218.dtsi as follows:
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bootloader";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "config";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "params";
reg = <0x50000 0x10000>;
read-only;
};
partition@60000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x60000 0x7a0000>;
};
};
Did an update via tftp. Seems to be working now. Booted up. wlan0/1. Luci running. Tested. Seems good!