R7800 -> Flashing openwrt causes bootloop (bad block in kernel area)

When you TFTP boot OpenWrt, use an initramfs build. This runs the rootfs from RAM so the rootfs in the flash chip does not need to be correct (and, when you're migrating from stock firmware, it won't be). Then you log in to the running initramfs and use its sysupgrade -n to install a sysupgrade image to the flash. The -n option causes any rootfs to be completely replaced with the clean one in the sysupgrade.

1 Like

Thanks, could you explain the steps in a little more detail? I can't flash initramfs as the server stops the transfer, file has bad checksum. I guess I only supposed to boot it. Im using tftpd32. Can I boot initramfs from this tool? Logging into initramfs is via the webinterface after I booted from it?

The initramfs UImage would need to be loaded from the bootloader CLI rather than the push-button recovery server. This may be a one step command or using tftpboot then bootm.

Before going that route though have you tried to TFTP recover to factory firmware then assuming that runs, install OpenWrt from the factory GUI?

Yes I have tried many, vie web interface and vie tftp such as:

R7800-V1.0.2.58 -> latest original dd-wrt factory dd-wrt
R7800-V1.0.2.58 -> OpenWrt.r7897 openwrt-18.06.5-ipq806x-netgear_r7800-squashfs-factory
R7800-V1.0.0.28 -> openwrt-18.06.5-ipq806x-netgear_r7800-squashfs-factory

They all end up in the bootloop. I can however flash all original netgear firmwares.
What would be the command to do this?

I don't have that model so I can't say exactly what to do. You could interrupt the boot and get a bootloader prompt then examine help and printenv.

EDIT 0: if you have not already done so, try to tftp flash an orginal netgear firmware first as @mk24 has suggested (the same way you would tftp flash an openwrt "openwrt*factory.img")

EDIT 1: see if you can find an "older" netgear firmware image (say from the openwrt version "18" timeframe last year) and see if that will flash, and run. If it does, then try to tftp an openwrt image over the older netgear image.

Before flashing a sysupgrade image to nand from an initramfs boot, I'm pretty sure from my own experience you must have first tftp flashed an openwrt factory image.

instructions to boot an initramfs image for r7800 here

after that I think @mk24 is suggesting you flash a "sysupgrade" openwrt image... (assuming the prior flashed version to nand was an openwrt image)

if the initramfs image does not have luci you'll have do something like:

scp openwrt*sysupgrade.bin root@openwrt.lan:/tmp

from your PC, and then from router

cd /tmp; sysupgrade -n openwrt*sysupgrade.bin

I've booted initramfs images on the r7500v2 but never tried the sysupgrade -n thing. good luck

I tried to flash 15 different versions of openwrt, from old to new, from standard to custom builds, all failed.

Flashig back netgear stock, any version, works every time. I tried to flash about 10 diferent versions from the GUI of different stock firmwares, they also all failed.

Last one, a bit older: lede-17.01.0-r3205-59508e3-ipq806x-R7800-squashfs-factory.img, flashed via tftp:


U-Boot 2012.07 [local,local] (Sep 03 2015 - 17:33:28)

U-boot 2012.07 dni1 V0.4 for DNI HW ID: 29764958 NOR flash 0MB; NAND flash 128MB; RAM 512MB; 1st Radio 4x4; 2nd Radio 4x4; Cascade
smem ram ptable found: ver: 0 len: 5
DRAM:  491 MiB
NAND:  SF: Unsupported manufacturer 00
ipq_spi: SPI Flash not found (bus/cs/speed/mode) = (0/0/48000000/0)
128 MiB
MMC:   
*** Warning - bad CRC, using default environment

PCI0 Link Intialized
PCI1 Link Intialized
In:    serial
Out:   serial
Err:   serial
 131072 bytes read: OK
MMC Device 0 not found
cdp: get part failed for 0:HLOS
Net:   MAC1 addr:3c:37:86:2a:c8:f6
athrs17_reg_init: complete
athrs17_vlan_config ...done
S17c init  done
MAC2 addr:3c:37:86:2a:c8:f5
eth0, eth1
Hit any key to stop autoboot:  2  1  0 
Mac2 unit failed
Mac1 unit failed

 nmrp server is stopped or failed !

Loading from device 0: nand0 (offset 0x1480000)
Skipping bad block 0x014a0000

** check kernel image **
   Verifying Checksum ... OK

** check rootfs image **
   Verifying Checksum ... OK
MMC Device 0 not found

Loading from nand0, offset 0x1480000
   Image Name:   ARM OpenWrt Linux-4.14.156
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2198227 Bytes = 2.1 MiB
   Load Address: 42208000
   Entry Point:  42208000
Skipping bad block 0x014a0000
Automatic boot of image at addr 0x44000000 ...
   Image Name:   ARM OpenWrt Linux-4.14.156
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2198227 Bytes = 2.1 MiB
   Load Address: 42208000
   Entry Point:  42208000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK
mtdparts variable not set, see 'help mtdparts'
no partitions defined

defaults:
mtdids  : nand0=msm_nand
mtdparts: none
info: "mtdparts" not set
Using machid 0x136c from environment

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.156 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r10775-db8345d8e4)) #0 SMP Sat Nov 30 15:52:33 2019
[    0.000000] CPU: ARMv7 Processor [512f04d0] revision 0 (ARMv7), cr=10c5787d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: Netgear Nighthawk X4S R7800
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] random: get_random_bytes called from 0xc09008dc with crng_init=0
[    0.000000] percpu: Embedded 15 pages/cpu s29388 r8192 d23860 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 121920
[    0.000000] Kernel command line: 
[    0.000000] Bootloader command line (ignored): console=ttyHSL1,115200n8
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 477372K/491520K available (4970K kernel code, 160K rwdata, 756K rodata, 1024K init, 234K bss, 14148K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xde800000 - 0xff800000   ( 528 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xde000000   ( 480 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0208000 - 0xc07dab88   (5963 kB)
[    0.000000]       .init : 0xc0900000 - 0xc0a00000   (1024 kB)
[    0.000000]       .data : 0xc0a00000 - 0xc0a28140   ( 161 kB)
[    0.000000]        .bss : 0xc0a2a000 - 0xc0a64a98   ( 235 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] clocksource: dg_timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 305801671480 ns
[    0.000008] sched_clock: 32 bits at 6MHz, resolution 160ns, wraps every 343597383600ns
[    0.000024] Switching to timer-based delay loop, resolution 160ns
[    0.000231] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.50 BogoMIPS (lpj=62500)
[    0.000256] pid_max: default: 32768 minimum: 301
[    0.000386] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000403] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000976] CPU: Testing write buffer coherency: ok
[    0.001740] Setting up static identity map for 0x42300000 - 0x42300060
[    0.001900] Hierarchical SRCU implementation.
[    0.002644] smp: Bringing up secondary CPUs ...
[    0.004463] smp: Brought up 1 node, 2 CPUs
[    0.004479] SMP: Total of 2 processors activated (25.00 BogoMIPS).
[    0.004490] CPU: All CPU(s) started in SVC mode.
[    0.014640] VFP support v0.3: implementor 51 architecture 64 part 4d variant 2 rev 0
[    0.014814] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.014842] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.014954] pinctrl core: initialized pinctrl subsystem
[    0.015938] NET: Registered protocol family 16
[    0.016185] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.017513] cpuidle: using governor ladder
[    0.017575] cpuidle: using governor menu
[    0.040010] msm_bus_fabric_init_driver
[    0.041516] usbcore: registered new interface driver usbfs
[    0.041595] usbcore: registered new interface driver hub
[    0.041685] usbcore: registered new device driver usb
[    0.041740] pps_core: LinuxPPS API ver. 1 registered
[    0.041753] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.041785] PTP clock support registered
[    0.043460] clocksource: Switched to clocksource dg_timer
[    0.046681] NET: Registered protocol family 2
[    0.047284] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.047326] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[    0.047382] TCP: Hash tables configured (established 4096 bind 4096)
[    0.047474] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.047499] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.047673] NET: Registered protocol family 1
[    0.048852] No memory allocated for crashlog
[    0.049111] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.054227] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.054244] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.060808] io scheduler noop registered
[    0.060826] io scheduler deadline registered (default)
[    0.062454] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda not found, using dummy regulator
[    0.062559] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda_phy not found, using dummy regulator
[    0.062649] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda_refclk not found, using dummy regulator
[    0.063434] OF: PCI: host bridge /soc/pci@1b500000 ranges:
[    0.063478] OF: PCI:    IO 0x0fe00000..0x0fefffff -> 0x0fe00000
[    0.063504] OF: PCI:   MEM 0x08000000..0x0fdfffff -> 0x08000000
[    0.171710] qcom-pcie 1b500000.pci: link up
[    0.171879] qcom-pcie 1b500000.pci: PCI host bridge to bus 0000:00
[    0.171902] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.171925] pci_bus 0000:00: root bus resource [io  0x0000-0xfffff] (bus address [0xfe00000-0xfefffff])
[    0.171941] pci_bus 0000:00: root bus resource [mem 0x08000000-0x0fdfffff]
[    0.172474] PCI: bus0: Fast back to back transfers disabled
[    0.174816] PCI: bus1: Fast back to back transfers disabled
[    0.174914] pci 0000:00:00.0: BAR 8: assigned [mem 0x08000000-0x081fffff]
[    0.174939] pci 0000:01:00.0: BAR 0: assigned [mem 0x08000000-0x081fffff 64bit]
[    0.175068] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    0.175093] pci 0000:00:00.0:   bridge window [mem 0x08000000-0x081fffff]
[    0.175627] pcieport 0000:00:00.0: AER enabled with IRQ 35
[    0.176152] qcom-pcie 1b700000.pci: 1b700000.pci supply vdda not found, using dummy regulator
[    0.176253] qcom-pcie 1b700000.pci: 1b700000.pci supply vdda_phy not found, using dummy regulator
[    0.176358] qcom-pcie 1b700000.pci: 1b700000.pci supply vdda_refclk not found, using dummy regulator
[    0.177113] OF: PCI: host bridge /soc/pci@1b700000 ranges:
[    0.177156] OF: PCI:    IO 0x31e00000..0x31efffff -> 0x31e00000
[    0.177180] OF: PCI:   MEM 0x2e000000..0x31dfffff -> 0x2e000000
[    0.287106] qcom-pcie 1b700000.pci: link up
[    0.287258] qcom-pcie 1b700000.pci: PCI host bridge to bus 0001:00
[    0.287277] pci_bus 0001:00: root bus resource [bus 00-ff]
[    0.287292] pci_bus 0001:00: root bus resource [mem 0x2e000000-0x31dfffff]
[    0.287756] PCI: bus0: Fast back to back transfers disabled
[    0.290098] PCI: bus1: Fast back to back transfers disabled
[    0.290184] pci 0001:00:00.0: BAR 8: assigned [mem 0x2e000000-0x2e1fffff]
[    0.290207] pci 0001:01:00.0: BAR 0: assigned [mem 0x2e000000-0x2e1fffff 64bit]
[    0.290340] pci 0001:00:00.0: PCI bridge to [bus 01-ff]
[    0.290361] pci 0001:00:00.0:   bridge window [mem 0x2e000000-0x2e1fffff]
[    0.290839] pcieport 0001:00:00.0: AER enabled with IRQ 68
[    0.293167] L2 @ QSB rate. Forcing new rate.
[    0.293379] L2 @ 384000 KHz
[    0.293559] CPU0 @ 800000 KHz
[    0.293572] CPU1 @ QSB rate. Forcing new rate.
[    0.293824] CPU1 @ 384000 KHz
[    0.297672] gsbi 16300000.gsbi: GSBI port protocol: 6 crci: 0
[    0.299598] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.302114] msm_serial 16340000.serial: msm_serial: detected port #0
[    0.302217] msm_serial 16340000.serial: uartclk = 7372800
[    0.302293] 16340000.serial: ttyMSM0 at MMIO 0x16340000 (irq = 101, base_baud = 460800) is a MSM
[    0.302330] msm_serial: console setup on port #0
[    1.022141] console [ttyMSM0] enabled
[    1.026953] msm_serial: driver initialized
[    1.035529] loop: module loaded
[    1.037541] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xa1
[    1.037576] nand: Macronix MX30UF1G18AC
[    1.044177] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.047735] 8 fixed-partitions partitions found on MTD device qcom_nand.0
[    1.055365] Creating 8 MTD partitions on "qcom_nand.0":
[    1.062140] 0x000000000000-0x000000c80000 : "qcadata"
[    1.072215] random: fast init done
[    1.089967] 0x000000c80000-0x000001180000 : "APPSBL"
[    1.099467] 0x000001180000-0x000001200000 : "APPSBLENV"
[    1.101104] 0x000001200000-0x000001340000 : "art"
[    1.106491] 0x000001340000-0x000001480000 : "artbak"
[    1.111270] 0x000001480000-0x000001880000 : "kernel"
[    1.121119] 0x000001880000-0x000007900000 : "ubi"
[    1.289241] 0x000007900000-0x000008000000 : "reserve"
[    1.303369] libphy: GPIO Bitbanged MDIO: probed
[    1.324880] switch0: Atheros AR8337 rev. 2 switch registered on gpio-0
[    2.185708] ar8327: qca,phy-rgmii-en is not specified
[    2.186099] libphy: Fixed MDIO Bus: probed
[    2.191888] ipq806x-gmac-dwmac 37200000.ethernet: PTP uses main clock
[    2.194133] stmmac - user ID: 0x10, Synopsys ID: 0x37
[    2.200247] ipq806x-gmac-dwmac 37200000.ethernet: Ring mode enabled
[    2.205377] ipq806x-gmac-dwmac 37200000.ethernet: DMA HW capability register supported
[    2.211361] ipq806x-gmac-dwmac 37200000.ethernet: Enhanced/Alternate descriptors
[    2.219424] ipq806x-gmac-dwmac 37200000.ethernet: Enabled extended descriptors
[    2.226986] ipq806x-gmac-dwmac 37200000.ethernet: RX Checksum Offload Engine supported
[    2.234014] ipq806x-gmac-dwmac 37200000.ethernet: COE Type 2
[    2.241827] ipq806x-gmac-dwmac 37200000.ethernet: TX Checksum insertion supported
[    2.247727] ipq806x-gmac-dwmac 37200000.ethernet: Wake-Up On Lan supported
[    2.255104] ipq806x-gmac-dwmac 37200000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    2.263400] ipq806x-gmac-dwmac 37400000.ethernet: PTP uses main clock
[    2.270678] stmmac - user ID: 0x10, Synopsys ID: 0x37
[    2.276781] ipq806x-gmac-dwmac 37400000.ethernet: Ring mode enabled
[    2.281756] ipq806x-gmac-dwmac 37400000.ethernet: DMA HW capability register supported
[    2.287902] ipq806x-gmac-dwmac 37400000.ethernet: Enhanced/Alternate descriptors
[    2.295900] ipq806x-gmac-dwmac 37400000.ethernet: Enabled extended descriptors
[    2.303372] ipq806x-gmac-dwmac 37400000.ethernet: RX Checksum Offload Engine supported
[    2.310489] ipq806x-gmac-dwmac 37400000.ethernet: COE Type 2
[    2.318362] ipq806x-gmac-dwmac 37400000.ethernet: TX Checksum insertion supported
[    2.324202] ipq806x-gmac-dwmac 37400000.ethernet: Wake-Up On Lan supported
[    2.331496] ipq806x-gmac-dwmac 37400000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    2.339038] i2c /dev entries driver
[    2.347807] Calibration not found.
[    2.351268] Speed bin: 0
[    2.353535] PVS bin: 4
[    2.357625] cpuidle: enable-method property 'qcom,kpss-acc-v1' found operations
[    2.358471] cpuidle: enable-method property 'qcom,kpss-acc-v1' found operations
[    2.366236] sdhci: Secure Digital Host Controller Interface driver
[    2.372896] sdhci: Copyright(c) Pierre Ossman
[    2.379214] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.384981] NET: Registered protocol family 10
[    2.390669] Segment Routing with IPv6
[    2.393631] NET: Registered protocol family 17
[    2.397454] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    2.402250] 8021q: 802.1Q VLAN Support v1.8
[    2.414875] Registering SWP/SWPB emulation handler
[    2.430866] qcom_rpm 108000.rpm: RPM firmware 3.0.16777364
[    2.442982] s1a: supplied by regulator-dummy
[    2.443077] s1a: Bringing 0uV into 1050000-1050000uV
[    2.446651] s1b: supplied by regulator-dummy
[    2.451313] s1b: Bringing 0uV into 1050000-1050000uV
[    2.455845] s2a: supplied by regulator-dummy
[    2.460531] s2a: Bringing 0uV into 775000-775000uV
[    2.465048] s2b: supplied by regulator-dummy
[    2.469376] s2b: Bringing 0uV into 775000-775000uV
[    2.478668] UBI error: no valid UBI magic found inside mtd[    2.484935] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    2.484957] Please append a correct "root=" boot option; here are the available partitions:
[    2.491399] 1f00           12800 mtdblock0 
[    2.491403]  (driver?)
[    2.503764] 1f01            5120 mtdblock1 
[    2.503769]  (driver?)
[    2.510219] 1f02             512 mtdblock2 
[    2.510223]  (driver?)
[    2.516800] 1f03            1280 mtdblock3 
[    2.516805]  (driver?)
[    2.523240] 1f04            1280 mtdblock4 
[    2.523244]  (driver?)
[    2.529751] 1f05            4096 mtdblock5 
[    2.529755]  (driver?)
[    2.536316] 1f06           98816 mtdblock6 
[    2.536320]  (driver?)
[    2.542771] 1f07            7168 mtdblock7 
[    2.542775]  (driver?)
[    2.549282] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    2.551734] CPU1: stopping
[    2.559971] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.156 #0
[    2.562659] Hardware name: Generic DT based system
[    2.568832] Function entered at [<c030f1c4>] from [<c030b390>]
[    2.573512] Function entered at [<c030b390>] from [<c07bf364>]
[    2.579328] Function entered at [<c07bf364>] from [<c030e40c>]
[    2.585143] Function entered at [<c030e40c>] from [<c03014b8>]
[    2.590959] Function entered at [<c03014b8>] from [<c030bf8c>]
[    2.596775] Exception stack(0xdd461f80 to 0xdd461fc8)
[    2.602621] 1f80: 00000001 00000000 00000000 c0315100 ffffe000 c0a03cb8 c0a03c6c 00000000
[    2.607747] 1fa0: 00000000 512f04d0 00000000 00000000 dd461fc8 dd461fd0 c030854c c0308550
[    2.615882] 1fc0: 60000013 ffffffff
[    2.624031] Function entered at [<c030bf8c>] from [<c0308550>]
[    2.627332] Function entered at [<c0308550>] from [<c0358988>]
[    2.633236] Function entered at [<c0358988>] from [<c0358cd0>]
[    2.639048] Function entered at [<c0358cd0>] from [<423017cc>]
[    2.644871] Rebooting in 1 seconds..

I think that something goes wrong with your flashing process:

  • you claim to have flashed a "lede-17.01.0" image
  • but your boot log after that shows kernel "OpenWrt Linux-4.14.156"

17.1.0 used kernel 4.4.x, so your device does not take the 17.01 image at all.
(4.14.156 matches the current master, not 17.01)

I am not sure if you do the TFTP flash right...

Can you please show us what the serial log says during the actual TFTP flashing process. (cold boot, entering TFTP mode, flash progress, subsequent boot etc.)

Yes looking at this again, it's not booting what you think you flashed. I think it is a dual partition so it could be that you keep booting the "backup" partition which is also faulty.

To try to resolve that, flash stock firmware, boot it up and use its GUI to flash stock firmware again (can be the same or a different version) so that both partitions have a fresh flash of stock firmware.

mtdparts variable not set, see 'help mtdparts'
no partitions defined

This may be normal or it may be a problem. For most models, OpenWrt ignores partition information supplied by the bootloader since it can be faulty.

R7800 is not a dual-partition device.

mtdparts text is normal in the uboot messages.
Like I said in my message in the other thread that spingioblast quoted, the abnormal thing in the log is the warning about a NAND bad block in early kernel area. And the failure notice about MAC addresses in uboot is strange.

FWIW, I second @hnyman's advice to post your flashing commands and outputs.

In one of your past posts, you wrote:

I also suspect this flashing process (and likely the others you've tried) are resulting in the boot loop. I did see other forum members say that they have flashed openwrt directly from the netgear www interface on the r7800. It may be that this no longer works...

Since you've tried several flashing methods and to make it easier for others to help you, I'd suggest you try the following flashing "workflow":

To tftp flash either a netgear or an openwrt factory image for both items 1 & 2 below, follow @hnyman's instructions here. (Post the commands you use to flash and their outputs.)

  1. tftp flash a netgear stock image (briefly verify that it boots and functions)
  2. tftp flash an openwrt factory image over the netgear image (I'd suggest the lastest stable 18.06.5 factory image: netgear_r7800-squashfs-factory.img) (i.e. do not use any www interface and do not use a "sysupgrade," or "initramfs" image).
  3. post the boot log from the serial interface if you get a boot loop.

Lastly, from the year or so I've spent with openwrt using an ipq806x device similar to the r7800, my observation is @hnyman is one of only a handful of experienced forum members that helps (new) users with the r7800... be patient).

HTH

Thanks for the help guys! I tried to flash stock from stock web gui just for fun, then openwrt, no luck either.

Then I flashed stock R7800-V1.0.2.62.img via tftp, works fine, then flashed openwrt-18.06.5-ipq806x-netgear_r7800-squashfs-factory.img via tftp, serial out:

U-Boot 2012.07 [local,local] (Sep 03 2015 - 17:33:28)

U-boot 2012.07 dni1 V0.4 for DNI HW ID: 29764958 NOR flash 0MB; NAND flash 128MB; RAM 512MB; 1st Radio 4x4; 2nd Radio 4x4; Cascade
smem ram ptable found: ver: 0 len: 5
DRAM:  491 MiB
NAND:  SF: Unsupported manufacturer 00
ipq_spi: SPI Flash not found (bus/cs/speed/mode) = (0/0/48000000/0)
128 MiB
MMC:   
*** Warning - bad CRC, using default environment

PCI0 Link Intialized
PCI1 Link Intialized
In:    serial
Out:   serial
Err:   serial
 131072 bytes read: OK
MMC Device 0 not found
cdp: get part failed for 0:HLOS
Net:   MAC1 addr:3c:37:86:2a:c8:f6
athrs17_reg_init: complete
athrs17_vlan_config ...done
S17c init  done
MAC2 addr:3c:37:86:2a:c8:f5
eth0, eth1
Factory Reset Mode                  Factory Reset Mode                  Factory Reset Mode                  Factory Reset Mode
The Router is in TFTP Server Firmware Recovery mode NOW!
Listening on Port : 69, IP Address: 192.168.1.1 ...
Upgrade Mode            Upgrade Mode            Upgrade Mode            Upgrade Mode            Upgrade Mode            Upgrade Mode            Upgrade Mode            
Rcv:
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.................................................................
	.....................................................
Done!
Bytes transferred = 8257665 (7e0081 hex)
MODEL ID on image: R7800
Firmware Image MODEL ID do not match open source firmware ID
 131072 bytes read: OK
HW ID on board: 29764958+0+128+512+4x4+4x4+cascade
HW ID on image: 29764958+0+128+512+4x4+4x4+cascade
Firmware Image HW ID matched Board HW ID

 131072 bytes read: OK
MODEL ID on board: R7800
MODEL ID on image: R7800
Firmware Image MODEL ID matched Board model ID

 131072 bytes read: OK
MODEL ID on board: R7800
MODEL ID on image: R7800
Firmware Image MODEL ID matched Board model ID

Erasing: off 1480000, size 20000

Erasing at 0x1480000 -- 100% complete. Cleanmarker written at 0x1480000.
OK
Writing: from RAM addr 42000080, to NAND off 1480000, size 20000
 131072 bytes written: OK
Alive-timer 22
NmrpAliveTimerBase 15
Skipping erasing bad block at 0x014a0000
Erasing: off 14c0000, size 20000

Erasing at 0x14c0000 -- 100% complete. Cleanmarker written at 0x14c0000.
OK
Writing: from RAM addr 42020080, to NAND off 14c0000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 14e0000, size 20000

Erasing at 0x14e0000 -- 100% complete. Cleanmarker written at 0x14e0000.
OK
Writing: from RAM addr 42040080, to NAND off 14e0000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1500000, size 20000

Erasing at 0x1500000 -- 100% complete. Cleanmarker written at 0x1500000.
OK
Writing: from RAM addr 42060080, to NAND off 1500000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1520000, size 20000

Erasing at 0x1520000 -- 100% complete. Cleanmarker written at 0x1520000.
OK
Writing: from RAM addr 42080080, to NAND off 1520000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1540000, size 20000

Erasing at 0x1540000 -- 100% complete. Cleanmarker written at 0x1540000.
OK
Writing: from RAM addr 420a0080, to NAND off 1540000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1560000, size 20000

Erasing at 0x1560000 -- 100% complete. Cleanmarker written at 0x1560000.
OK
Writing: from RAM addr 420c0080, to NAND off 1560000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1580000, size 20000

Erasing at 0x1580000 -- 100% complete. Cleanmarker written at 0x1580000.
OK
Writing: from RAM addr 420e0080, to NAND off 1580000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 15a0000, size 20000

Erasing at 0x15a0000 -- 100% complete. Cleanmarker written at 0x15a0000.
OK
Writing: from RAM addr 42100080, to NAND off 15a0000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 15c0000, size 20000

Erasing at 0x15c0000 -- 100% complete. Cleanmarker written at 0x15c0000.
OK
Writing: from RAM addr 42120080, to NAND off 15c0000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 15e0000, size 20000

Erasing at 0x15e0000 -- 100% complete. Cleanmarker written at 0x15e0000.
OK
Writing: from RAM addr 42140080, to NAND off 15e0000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1600000, size 20000

Erasing at 0x1600000 -- 100% complete. Cleanmarker written at 0x1600000.
OK
Writing: from RAM addr 42160080, to NAND off 1600000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1620000, size 20000

Erasing at 0x1620000 -- 100% complete. Cleanmarker written at 0x1620000.
OK
Writing: from RAM addr 42180080, to NAND off 1620000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1640000, size 20000

Erasing at 0x1640000 -- 100% complete. Cleanmarker written at 0x1640000.
OK
Writing: from RAM addr 421a0080, to NAND off 1640000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1660000, size 20000

Erasing at 0x1660000 -- 100% complete. Cleanmarker written at 0x1660000.
OK
Writing: from RAM addr 421c0080, to NAND off 1660000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 1680000, size 20000

Erasing at 0x1680000 -- 100% complete. Cleanmarker written at 0x1680000.
OK
Writing: from RAM addr 421e0080, to NAND off 1680000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 16a0000, size 20000

Erasing at 0x16a0000 -- 100% complete. Cleanmarker written at 0x16a0000.
OK
Writing: from RAM addr 42200080, to NAND off 16a0000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 16c0000, size 20000

Erasing at 0x16c0000 -- 100% complete. Cleanmarker written at 0x16c0000.
OK
Writing: from RAM addr 42220080, to NAND off 16c0000, size 20000
 131072 bytes written: OK
Alive-timer 15
Erasing: off 16e0000, size 20000

Erasing at 0x16e0000 -- 100% complete. Cleanmarker written at 0x16e0000.
OK
Writing: from RAM addr 42240080, to NAND off 16e0000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1700000, size 20000

Erasing at 0x1700000 -- 100% complete. Cleanmarker written at 0x1700000.
OK
Writing: from RAM addr 42260080, to NAND off 1700000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1720000, size 20000

Erasing at 0x1720000 -- 100% complete. Cleanmarker written at 0x1720000.
OK
Writing: from RAM addr 42280080, to NAND off 1720000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1740000, size 20000

Erasing at 0x1740000 -- 100% complete. Cleanmarker written at 0x1740000.
OK
Writing: from RAM addr 422a0080, to NAND off 1740000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1760000, size 20000

Erasing at 0x1760000 -- 100% complete. Cleanmarker written at 0x1760000.
OK
Writing: from RAM addr 422c0080, to NAND off 1760000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1780000, size 20000

Erasing at 0x1780000 -- 100% complete. Cleanmarker written at 0x1780000.
OK
Writing: from RAM addr 422e0080, to NAND off 1780000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 17a0000, size 20000

Erasing at 0x17a0000 -- 100% complete. Cleanmarker written at 0x17a0000.
OK
Writing: from RAM addr 42300080, to NAND off 17a0000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 17c0000, size 20000

Erasing at 0x17c0000 -- 100% complete. Cleanmarker written at 0x17c0000.
OK
Writing: from RAM addr 42320080, to NAND off 17c0000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 17e0000, size 20000

Erasing at 0x17e0000 -- 100% complete. Cleanmarker written at 0x17e0000.
OK
Writing: from RAM addr 42340080, to NAND off 17e0000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1800000, size 20000

Erasing at 0x1800000 -- 100% complete. Cleanmarker written at 0x1800000.
OK
Writing: from RAM addr 42360080, to NAND off 1800000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1820000, size 20000

Erasing at 0x1820000 -- 100% complete. Cleanmarker written at 0x1820000.
OK
Writing: from RAM addr 42380080, to NAND off 1820000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1840000, size 20000

Erasing at 0x1840000 -- 100% complete. Cleanmarker written at 0x1840000.
OK
Writing: from RAM addr 423a0080, to NAND off 1840000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1860000, size 20000

Erasing at 0x1860000 -- 100% complete. Cleanmarker written at 0x1860000.
OK
Writing: from RAM addr 423c0080, to NAND off 1860000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1880000, size 20000

Erasing at 0x1880000 -- 100% complete. Cleanmarker written at 0x1880000.
OK
Writing: from RAM addr 423e0080, to NAND off 1880000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 18a0000, size 20000

Erasing at 0x18a0000 -- 100% complete. Cleanmarker written at 0x18a0000.
OK
Writing: from RAM addr 42400080, to NAND off 18a0000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 18c0000, size 20000

Erasing at 0x18c0000 -- 100% complete. Cleanmarker written at 0x18c0000.
OK
Writing: from RAM addr 42420080, to NAND off 18c0000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 18e0000, size 20000

Erasing at 0x18e0000 -- 100% complete. Cleanmarker written at 0x18e0000.
OK
Writing: from RAM addr 42440080, to NAND off 18e0000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1900000, size 20000

Erasing at 0x1900000 -- 100% complete. Cleanmarker written at 0x1900000.
OK
Writing: from RAM addr 42460080, to NAND off 1900000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1920000, size 20000

Erasing at 0x1920000 -- 100% complete. Cleanmarker written at 0x1920000.
OK
Writing: from RAM addr 42480080, to NAND off 1920000, size 20000
 131072 bytes written: OK
Alive-timer 16
Erasing: off 1940000, size 20000

Erasing at 0x1940000 -- 100% complete. Cleanmarker written at 0x1940000.
OK
Writing: from RAM addr 424a0080, to NAND off 1940000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1960000, size 20000

Erasing at 0x1960000 -- 100% complete. Cleanmarker written at 0x1960000.
OK
Writing: from RAM addr 424c0080, to NAND off 1960000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1980000, size 20000

Erasing at 0x1980000 -- 100% complete. Cleanmarker written at 0x1980000.
OK
Writing: from RAM addr 424e0080, to NAND off 1980000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 19a0000, size 20000

Erasing at 0x19a0000 -- 100% complete. Cleanmarker written at 0x19a0000.
OK
Writing: from RAM addr 42500080, to NAND off 19a0000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 19c0000, size 20000

Erasing at 0x19c0000 -- 100% complete. Cleanmarker written at 0x19c0000.
OK
Writing: from RAM addr 42520080, to NAND off 19c0000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 19e0000, size 20000

Erasing at 0x19e0000 -- 100% complete. Cleanmarker written at 0x19e0000.
OK
Writing: from RAM addr 42540080, to NAND off 19e0000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1a00000, size 20000

Erasing at 0x1a00000 -- 100% complete. Cleanmarker written at 0x1a00000.
OK
Writing: from RAM addr 42560080, to NAND off 1a00000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1a20000, size 20000

Erasing at 0x1a20000 -- 100% complete. Cleanmarker written at 0x1a20000.
OK
Writing: from RAM addr 42580080, to NAND off 1a20000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1a40000, size 20000

Erasing at 0x1a40000 -- 100% complete. Cleanmarker written at 0x1a40000.
OK
Writing: from RAM addr 425a0080, to NAND off 1a40000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1a60000, size 20000

Erasing at 0x1a60000 -- 100% complete. Cleanmarker written at 0x1a60000.
OK
Writing: from RAM addr 425c0080, to NAND off 1a60000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1a80000, size 20000

Erasing at 0x1a80000 -- 100% complete. Cleanmarker written at 0x1a80000.
OK
Writing: from RAM addr 425e0080, to NAND off 1a80000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1aa0000, size 20000

Erasing at 0x1aa0000 -- 100% complete. Cleanmarker written at 0x1aa0000.
OK
Writing: from RAM addr 42600080, to NAND off 1aa0000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1ac0000, size 20000

Erasing at 0x1ac0000 -- 100% complete. Cleanmarker written at 0x1ac0000.
OK
Writing: from RAM addr 42620080, to NAND off 1ac0000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1ae0000, size 20000

Erasing at 0x1ae0000 -- 100% complete. Cleanmarker written at 0x1ae0000.
OK
Writing: from RAM addr 42640080, to NAND off 1ae0000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1b00000, size 20000

Erasing at 0x1b00000 -- 100% complete. Cleanmarker written at 0x1b00000.
OK
Writing: from RAM addr 42660080, to NAND off 1b00000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1b20000, size 20000

Erasing at 0x1b20000 -- 100% complete. Cleanmarker written at 0x1b20000.
OK
Writing: from RAM addr 42680080, to NAND off 1b20000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1b40000, size 20000

Erasing at 0x1b40000 -- 100% complete. Cleanmarker written at 0x1b40000.
OK
Writing: from RAM addr 426a0080, to NAND off 1b40000, size 20000
 131072 bytes written: OK
Alive-timer 17
Erasing: off 1b60000, size 20000

Erasing at 0x1b60000 -- 100% complete. Cleanmarker written at 0x1b60000.
OK
Writing: from RAM addr 426c0080, to NAND off 1b60000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1b80000, size 20000

Erasing at 0x1b80000 -- 100% complete. Cleanmarker written at 0x1b80000.
OK
Writing: from RAM addr 426e0080, to NAND off 1b80000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1ba0000, size 20000

Erasing at 0x1ba0000 -- 100% complete. Cleanmarker written at 0x1ba0000.
OK
Writing: from RAM addr 42700080, to NAND off 1ba0000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1bc0000, size 20000

Erasing at 0x1bc0000 -- 100% complete. Cleanmarker written at 0x1bc0000.
OK
Writing: from RAM addr 42720080, to NAND off 1bc0000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1be0000, size 20000

Erasing at 0x1be0000 -- 100% complete. Cleanmarker written at 0x1be0000.
OK
Writing: from RAM addr 42740080, to NAND off 1be0000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1c00000, size 20000

Erasing at 0x1c00000 -- 100% complete. Cleanmarker written at 0x1c00000.
OK
Writing: from RAM addr 42760080, to NAND off 1c00000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1c20000, size 20000

Erasing at 0x1c20000 -- 100% complete. Cleanmarker written at 0x1c20000.
OK
Writing: from RAM addr 42780080, to NAND off 1c20000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1c40000, size 20000

Erasing at 0x1c40000 -- 100% complete. Cleanmarker written at 0x1c40000.
OK
Writing: from RAM addr 427a0080, to NAND off 1c40000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1c60000, size 20000

Erasing at 0x1c60000 -- 100% complete. Cleanmarker written at 0x1c60000.
OK
Writing: from RAM addr 427c0080, to NAND off 1c60000, size 20000
 131072 bytes written: OK
Alive-timer 18
Erasing: off 1c80000, size 20000

Erasing at 0x1c80000 -- 100% complete. Cleanmarker written at 0x1c80000.
OK
Writing: from RAM addr 427e0080, to NAND off 1c80000, size 20000
 131072 bytes written: OK
Alive-timer 18
Done
Rebooting...
resetting ...

Resetting with watch dog!

First boot after flash:


U-Boot 2012.07 [local,local] (Sep 03 2015 - 17:33:28)

U-boot 2012.07 dni1 V0.4 for DNI HW ID: 29764958 NOR flash 0MB; NAND flash 128MB; RAM 512MB; 1st Radio 4x4; 2nd Radio 4x4; Cascade
smem ram ptable found: ver: 0 len: 5
DRAM:  491 MiB
NAND:  SF: Unsupported manufacturer 00
ipq_spi: SPI Flash not found (bus/cs/speed/mode) = (0/0/48000000/0)
128 MiB
MMC:   
*** Warning - bad CRC, using default environment

PCI0 Link Intialized
PCI1 Link Intialized
In:    serial
Out:   serial
Err:   serial
 131072 bytes read: OK
MMC Device 0 not found
cdp: get part failed for 0:HLOS
Net:   MAC1 addr:3c:37:86:2a:c8:f6
athrs17_reg_init: complete
athrs17_vlan_config ...done
S17c init  done
MAC2 addr:3c:37:86:2a:c8:f5
eth0, eth1
Hit any key to stop autoboot:  2  1  0 

 Client starts...[Listening] for ADVERTISE...TTT
Retry count exceeded; boot the image as usual

 nmrp server is stopped or failed !

Loading from device 0: nand0 (offset 0x1480000)
Skipping bad block 0x014a0000

** check kernel image **
   Verifying Checksum ... OK

** check rootfs image **
   Verifying Checksum ... OK
MMC Device 0 not found

Loading from nand0, offset 0x1480000
   Image Name:   ARM OpenWrt Linux-4.14.151
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2188793 Bytes = 2.1 MiB
   Load Address: 42208000
   Entry Point:  42208000
Skipping bad block 0x014a0000
Automatic boot of image at addr 0x44000000 ...
   Image Name:   ARM OpenWrt Linux-4.14.151
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2188793 Bytes = 2.1 MiB
   Load Address: 42208000
   Entry Point:  42208000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK
mtdparts variable not set, see 'help mtdparts'
no partitions defined

defaults:
mtdids  : nand0=msm_nand
mtdparts: none
info: "mtdparts" not set
Using machid 0x136c from environment

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.151 (buildbot@62f0e5d67d46) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7897-9d401013fc)) #0 SMP Tue Nov 5 14:12:18 2019
[    0.000000] CPU: ARMv7 Processor [512f04d0] revision 0 (ARMv7), cr=10c5787d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: Netgear Nighthawk X4S R7800
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] random: get_random_bytes called from 0xc09008dc with crng_init=0
[    0.000000] percpu: Embedded 15 pages/cpu s29388 r8192 d23860 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 121920
[    0.000000] Kernel command line: 
[    0.000000] Bootloader command line (ignored): console=ttyHSL1,115200n8
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 477376K/491520K available (4912K kernel code, 162K rwdata, 760K rodata, 1024K init, 234K bss, 14144K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xde800000 - 0xff800000   ( 528 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xde000000   ( 480 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0208000 - 0xc07cc198   (5905 kB)
[    0.000000]       .init : 0xc0900000 - 0xc0a00000   (1024 kB)
[    0.000000]       .data : 0xc0a00000 - 0xc0a28840   ( 163 kB)
[    0.000000]        .bss : 0xc0a2a000 - 0xc0a64a98   ( 235 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] clocksource: dg_timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 305801671480 ns
[    0.000006] sched_clock: 32 bits at 6MHz, resolution 160ns, wraps every 343597383600ns
[    0.000020] Switching to timer-based delay loop, resolution 160ns
[    0.000221] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.50 BogoMIPS (lpj=62500)
[    0.000244] pid_max: default: 32768 minimum: 301
[    0.000368] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000386] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000952] CPU: Testing write buffer coherency: ok
[    0.001717] Setting up static identity map for 0x42300000 - 0x42300060
[    0.001872] Hierarchical SRCU implementation.
[    0.002597] smp: Bringing up secondary CPUs ...
[    0.004429] smp: Brought up 1 node, 2 CPUs
[    0.004447] SMP: Total of 2 processors activated (25.00 BogoMIPS).
[    0.004458] CPU: All CPU(s) started in SVC mode.
[    0.014954] VFP support v0.3: implementor 51 architecture 64 part 4d variant 2 rev 0
[    0.015122] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.015147] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.015259] pinctrl core: initialized pinctrl subsystem
[    0.016221] NET: Registered protocol family 16
[    0.016468] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.017776] cpuidle: using governor ladder
[    0.017841] cpuidle: using governor menu
[    0.040561] msm_bus_fabric_init_driver
[    0.042074] usbcore: registered new interface driver usbfs
[    0.042152] usbcore: registered new interface driver hub
[    0.042235] usbcore: registered new device driver usb
[    0.042291] pps_core: LinuxPPS API ver. 1 registered
[    0.042302] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.042336] PTP clock support registered
[    0.043998] clocksource: Switched to clocksource dg_timer
[    0.047174] NET: Registered protocol family 2
[    0.047762] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.047805] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[    0.047861] TCP: Hash tables configured (established 4096 bind 4096)
[    0.047951] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.047978] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.048152] NET: Registered protocol family 1
[    0.049295] No memory allocated for crashlog
[    0.049551] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.054549] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.054564] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.061461] io scheduler noop registered
[    0.061481] io scheduler deadline registered (default)
[    0.063290] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda not found, using dummy regulator
[    0.063396] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda_phy not found, using dummy regulator
[    0.063488] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda_refclk not found, using dummy regulator
[    0.064280] OF: PCI: host bridge /soc/pci@1b500000 ranges:
[    0.064429] OF: PCI:    IO 0x0fe00000..0x0fefffff -> 0x0fe00000
[    0.064455] OF: PCI:   MEM 0x08000000..0x0fdfffff -> 0x08000000
[    0.172585] qcom-pcie 1b500000.pci: link up
[    0.172743] qcom-pcie 1b500000.pci: PCI host bridge to bus 0000:00
[    0.172766] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.172787] pci_bus 0000:00: root bus resource [io  0x0000-0xfffff] (bus address [0xfe00000-0xfefffff])
[    0.172802] pci_bus 0000:00: root bus resource [mem 0x08000000-0x0fdfffff]
[    0.173324] PCI: bus0: Fast back to back transfers disabled
[    0.175657] PCI: bus1: Fast back to back transfers disabled
[    0.175754] pci 0000:00:00.0: BAR 8: assigned [mem 0x08000000-0x081fffff]
[    0.175778] pci 0000:01:00.0: BAR 0: assigned [mem 0x08000000-0x081fffff 64bit]
[    0.175907] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    0.175932] pci 0000:00:00.0:   bridge window [mem 0x08000000-0x081fffff]
[    0.176461] pcieport 0000:00:00.0: AER enabled with IRQ 35
[    0.176984] qcom-pcie 1b700000.pci: 1b700000.pci supply vdda not found, using dummy regulator
[    0.177084] qcom-pcie 1b700000.pci: 1b700000.pci supply vdda_phy not found, using dummy regulator
[    0.177186] qcom-pcie 1b700000.pci: 1b700000.pci supply vdda_refclk not found, using dummy regulator
[    0.177948] OF: PCI: host bridge /soc/pci@1b700000 ranges:
[    0.177986] OF: PCI:    IO 0x31e00000..0x31efffff -> 0x31e00000
[    0.178010] OF: PCI:   MEM 0x2e000000..0x31dfffff -> 0x2e000000
[    0.287951] qcom-pcie 1b700000.pci: link up
[    0.288099] qcom-pcie 1b700000.pci: PCI host bridge to bus 0001:00
[    0.288118] pci_bus 0001:00: root bus resource [bus 00-ff]
[    0.288133] pci_bus 0001:00: root bus resource [mem 0x2e000000-0x31dfffff]
[    0.288591] PCI: bus0: Fast back to back transfers disabled
[    0.290930] PCI: bus1: Fast back to back transfers disabled
[    0.291016] pci 0001:00:00.0: BAR 8: assigned [mem 0x2e000000-0x2e1fffff]
[    0.291038] pci 0001:01:00.0: BAR 0: assigned [mem 0x2e000000-0x2e1fffff 64bit]
[    0.291170] pci 0001:00:00.0: PCI bridge to [bus 01-ff]
[    0.291189] pci 0001:00:00.0:   bridge window [mem 0x2e000000-0x2e1fffff]
[    0.291654] pcieport 0001:00:00.0: AER enabled with IRQ 68
[    0.294003] L2 @ QSB rate. Forcing new rate.
[    0.294215] L2 @ 384000 KHz
[    0.294520] CPU0 @ 800000 KHz
[    0.294533] CPU1 @ QSB rate. Forcing new rate.
[    0.294661] CPU1 @ 384000 KHz
[    0.298515] gsbi 16300000.gsbi: GSBI port protocol: 6 crci: 0
[    0.300442] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.302996] msm_serial 16340000.serial: msm_serial: detected port #0
[    0.303100] msm_serial 16340000.serial: uartclk = 7372800
[    0.303182] 16340000.serial: ttyMSM0 at MMIO 0x16340000 (irq = 101, base_baud = 460800) is a MSM
[    0.303222] msm_serial: console setup on port #0
[    1.023153] console [ttyMSM0] enabled
[    1.028001] msm_serial: driver initialized
[    1.036584] loop: module loaded
[    1.038610] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xa1
[    1.038643] nand: Macronix MX30UF1G18AC
[    1.045241] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.048795] 8 fixed-partitions partitions found on MTD device qcom_nand.0
[    1.056428] Creating 8 MTD partitions on "qcom_nand.0":
[    1.063195] 0x000000000000-0x000000c80000 : "qcadata"
[    1.073252] random: fast init done
[    1.090993] 0x000000c80000-0x000001180000 : "APPSBL"
[    1.100458] 0x000001180000-0x000001200000 : "APPSBLENV"
[    1.102093] 0x000001200000-0x000001340000 : "art"
[    1.107474] 0x000001340000-0x000001480000 : "artbak"
[    1.112264] 0x000001480000-0x000001880000 : "kernel"
[    1.122131] 0x000001880000-0x000007900000 : "ubi"
[    1.289708] 0x000007900000-0x000008000000 : "reserve"
[    1.303828] libphy: GPIO Bitbanged MDIO: probed
[    1.325062] switch0: Atheros AR8337 rev. 2 switch registered on gpio-0
[    2.185573] libphy: Fixed MDIO Bus: probed
[    2.187790] ipq806x-gmac-dwmac 37200000.ethernet: PTP uses main clock
[    2.188882] stmmac - user ID: 0x10, Synopsys ID: 0x37
[    2.195164] ipq806x-gmac-dwmac 37200000.ethernet: Ring mode enabled
[    2.200113] ipq806x-gmac-dwmac 37200000.ethernet: DMA HW capability register supported
[    2.206285] ipq806x-gmac-dwmac 37200000.ethernet: Enhanced/Alternate descriptors
[    2.214177] ipq806x-gmac-dwmac 37200000.ethernet: Enabled extended descriptors
[    2.221801] ipq806x-gmac-dwmac 37200000.ethernet: RX Checksum Offload Engine supported
[    2.228831] ipq806x-gmac-dwmac 37200000.ethernet: COE Type 2
[    2.236734] ipq806x-gmac-dwmac 37200000.ethernet: TX Checksum insertion supported
[    2.242473] ipq806x-gmac-dwmac 37200000.ethernet: Wake-Up On Lan supported
[    2.249921] ipq806x-gmac-dwmac 37200000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    2.258278] ipq806x-gmac-dwmac 37400000.ethernet: PTP uses main clock
[    2.265478] stmmac - user ID: 0x10, Synopsys ID: 0x37
[    2.271553] ipq806x-gmac-dwmac 37400000.ethernet: Ring mode enabled
[    2.276658] ipq806x-gmac-dwmac 37400000.ethernet: DMA HW capability register supported
[    2.282668] ipq806x-gmac-dwmac 37400000.ethernet: Enhanced/Alternate descriptors
[    2.290715] ipq806x-gmac-dwmac 37400000.ethernet: Enabled extended descriptors
[    2.298275] ipq806x-gmac-dwmac 37400000.ethernet: RX Checksum Offload Engine supported
[    2.305305] ipq806x-gmac-dwmac 37400000.ethernet: COE Type 2
[    2.313130] ipq806x-gmac-dwmac 37400000.ethernet: TX Checksum insertion supported
[    2.319019] ipq806x-gmac-dwmac 37400000.ethernet: Wake-Up On Lan supported
[    2.326392] ipq806x-gmac-dwmac 37400000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    2.333749] i2c /dev entries driver
[    2.342606] Calibration not found.
[    2.346149] Speed bin: 0
[    2.348367] PVS bin: 4
[    2.352364] cpuidle: enable-method property 'qcom,kpss-acc-v1' found operations
[    2.353302] cpuidle: enable-method property 'qcom,kpss-acc-v1' found operations
[    2.361072] sdhci: Secure Digital Host Controller Interface driver
[    2.367817] sdhci: Copyright(c) Pierre Ossman
[    2.373977] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.379993] NET: Registered protocol family 10
[    2.385551] Segment Routing with IPv6
[    2.388459] NET: Registered protocol family 17
[    2.392169] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    2.397252] 8021q: 802.1Q VLAN Support v1.8
[    2.409693] Registering SWP/SWPB emulation handler
[    2.425913] qcom_rpm 108000.rpm: RPM firmware 3.0.16777364
[    2.438045] s1a: supplied by regulator-dummy
[    2.438145] s1a: Bringing 0uV into 1050000-1050000uV
[    2.441633] s1b: supplied by regulator-dummy
[    2.446476] s1b: Bringing 0uV into 1050000-1050000uV
[    2.450814] s2a: supplied by regulator-dummy
[    2.455684] s2a: Bringing 0uV into 775000-775000uV
[    2.460019] s2b: supplied by regulator-dummy
[    2.464527] s2b: Bringing 0uV into 775000-775000uV
[    2.473645] UBI error: no valid UBI magic found inside mt⸮[    2.479970] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    2.479992] Please append a correct "root=" boot option; here are the available partitions:
[    2.486501] 1f00           12800 mtdblock0 
[    2.486506]  (driver?)
[    2.498746] 1f01            5120 mtdblock1 
[    2.498750]  (driver?)
[    2.505327] 1f02             512 mtdblock2 
[    2.505331]  (driver?)
[    2.511765] 1f03            1280 mtdblock3 
[    2.511769]  (driver?)
[    2.518324] 1f04            1280 mtdblock4 
[    2.518328]  (driver?)
[    2.524853] 1f05            4096 mtdblock5 
[    2.524857]  (driver?)
[    2.531296] 1f06           98816 mtdblock6 
[    2.531300]  (driver?)
[    2.537880] 1f07            7168 mtdblock7 
[    2.537884]  (driver?)
[    2.544377] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    2.546767] CPU1: stopping
[    2.555008] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.151 #0
[    2.557694] Hardware name: Generic DT based system
[    2.563867] Function entered at [<c030f1b8>] from [<c030b388>]
[    2.568550] Function entered at [<c030b388>] from [<c07b14d8>]
[    2.574366] Function entered at [<c07b14d8>] from [<c030e400>]
[    2.580179] Function entered at [<c030e400>] from [<c03014b8>]
[    2.585996] Function entered at [<c03014b8>] from [<c030bf8c>]
[    2.591810] Exception stack(0xdd461f80 to 0xdd461fc8)
[    2.597657] 1f80: 00000001 00000000 00000000 c0314f60 ffffe000 c0a03c74 c0a03c28 00000000
[    2.602782] 1fa0: 00000000 512f04d0 00000000 00000000 dd461fc8 dd461fd0 c03086ac c03086b0
[    2.610917] 1fc0: 60000013 ffffffff
[    2.619064] Function entered at [<c030bf8c>] from [<c03086b0>]
[    2.622367] Function entered at [<c03086b0>] from [<c034fd70>]
[    2.628271] Function entered at [<c034fd70>] from [<c03500b8>]
[    2.634085] Function entered at [<c03500b8>] from [<423017cc>]
[    2.639907] Rebooting in 1 seconds..

Here the serial out of the tftp flash of the stock firmware including first boot:

http://www.alcs.ch/webdata/serial_tftp_flash_R7800-V1.0.2.62.txt

Last one, complete log of stock tftp flash, startup, openwrt tftp flash and startup.
R7800-V1.0.2.62.img and openwrt-18.06.5-ipq806x-netgear_r7800-squashfs-factory.img

http://www.alcs.ch/webdata/serial_tftp_stock_and_openwrt_flash.log

The bad block in the flash has pushed the start of the rootfs out of its standard location. But the stock firmware detects and compensates for that here:

mtd: find squashfs magic at 0x16c0000 of "msm_nand"
the correct location of partition "rootfs": 0x0000016c0000-0x000003480000

OpenWrt does not do that. It appears that OpenWrt requires the rootfs to exist exactly at 16a0000, or it will not find the magic number, can't mount the rootfs, and crashes. Because of skipping a bad block while writing the kernel, the rootfs has been pushed up to 16c0000 in your unit. This happens both with OpenWrt and stock firmware, but again the stock firmware has code to deal with it.

The workaround then would be to remove 128k of the padding bytes between the kernel and the rootfs in the OpenWrt "factory" image file, so the rootfs gets written to the right place. You will likely have to do this every time you upgrade because your flash has a bad block in the kernel partition.

3 Likes

That looks like a normal TFTP flashing.

Just for reference, I TFTP flashed my own R7800 for comparison. (This is a kernel 4.19 image, so the kernel boot log is slightly different.)
https://gist.github.com/hnyman/9f0ef6434aa01420bf8087186040ae17

I feel that @mk24 has likely explained the error here:

That bad block in the kernel area is the only notable difference that your logs show. Likely that is the reason why the stock image works, but none of the OpenWrt images does.

(I have a vague recollection that I have seen that problem discussed earlier, but I do not remember if any easy solution was drafted.)

A similar issue and discussion about badblock handling on NAND happened for mir3g (mt7621) a while ago, but it didn't really end up with an actionable solution.

It seems there were other cases, however people returned their routers or gave up. I will try to flash it tomorrow without the padding bytes. Cheers

Actually, how to best identify / remove the padding?