Kernel detects squashfs on mtd but fail to mount root vfs panic

Hi! I am working on adding support for Linksys EA8100.

initramfs-kernel.bin boots successfully via tftp and sysupgrade squashfs-sysupgrade.bin seem to have worked correctly. Please check my patch on github that makes this happen.

Between reboots, tftp booting from initramfs-kernel.bin allows me to manually mount /dev/mtdblock7:

BusyBox v1.28.3 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 18.06.1, r7258-5eb055306f
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# mkdir /tmp/squashfs
root@OpenWrt:/# mount /dev/mtdblock7 /tmp/squashfs
root@OpenWrt:/# mount
rootfs on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/mtdblock7 on /tmp/squashfs type squashfs (ro,relatime)
root@OpenWrt:/# ls /tmp/squashfs/
bin      etc      lib      overlay  rom      sbin     tmp      var
dev      init     mnt      proc     root     sys      usr      www
root@OpenWrt:/# 

However the kernel when booting from nand is not able to mount the squashfs as /. It seem to detect the correct partition, though, because the squashfs is on mtdblock7 which I suppose is unknown-block(31,7):

[    5.306133] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,7)

Possibly relevant sections of dmesg:

...
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
...
[    0.823159] MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
[    0.830300] Enable NFI Clock
[    0.833169] # MTK NAND # : Use HW ECC
[    0.836827] Device not found, ID: c2f1
[    0.840586] Not Support this Device!
[    0.844318] chip_mode=00000001
[    0.847355] Support this Device in MTK table! c2f1
[    0.852314] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[    0.858770] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
[    0.865100] nand: Macronix NAND 128MiB 3,3V 8-bit
[    0.869782] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.877340] Scanning device for bad blocks
[    0.898127] Bad eraseblock 71 at 0x0000008e0000
[    0.967428] Bad eraseblock 349 at 0x000002ba0000
[    0.977750] Bad eraseblock 374 at 0x000002ec0000
[    0.987603] Bad eraseblock 397 at 0x0000031a0000
[    1.005870] Bad eraseblock 456 at 0x000003900000
[    1.021098] Bad eraseblock 502 at 0x000003ec0000
[    1.034456] Bad eraseblock 540 at 0x000004380000
[    1.050159] Bad eraseblock 588 at 0x000004980000
[    1.106496] Bad eraseblock 810 at 0x000006540000
[    1.128493] Bad eraseblock 885 at 0x000006ea0000
[    1.165420] 6 fixed-partitions partitions found on MTD device MT7621-NAND
[    1.172195] Creating 6 MTD partitions on "MT7621-NAND":
[    1.177403] 0x000000000000-0x000000080000 : "uboot"
[    1.183370] 0x000000080000-0x0000000c0000 : "uboot_env"
[    1.189526] 0x0000000c0000-0x000000100000 : "factory"
[    1.195555] 0x000000100000-0x000000140000 : "s_env"
[    1.201423] 0x000000140000-0x000000180000 : "devinfo"
[    1.207409] 0x000000180000-0x000002980000 : "firmware"
[    1.771302] 2 uimage-fw partitions found on MTD device firmware
[    1.777219] 0x000000180000-0x000000580000 : "kernel"
[    1.783288] 0x000000580000-0x000002980000 : "rootfs"
[    1.789463] mtd: device 7 (rootfs) set to be root filesystem
[    1.795168] 1 squashfs-split partitions found on MTD device rootfs
[    1.801347] 0x000000700000-0x000002980000 : "rootfs_data"
[    1.807972] [mtk_nand] probe successfully!
[    1.812790] Signature matched and data read!
...
[    5.099877] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0016001c: 0x58fc instead
[    5.109313] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00160020: 0x73d0 instead
[    5.118759] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00160024: 0xa60f instead
[    5.128199] jffs2: Further such events for this erase block will not be printed
[    5.209300] jffs2_scan_eraseblock(): End of filesystem marker found at 0x180000
[    5.216899] jffs2: Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes
[    5.225307] jffs2: empty_blocks 275, bad_blocks 1, c->nr_blocks 288
[    5.231651] VFS: Cannot open root device "(null)" or unknown-block(31,7): error -5
[    5.239180] Please append a correct "root=" boot option; here are the available partitions:
[    5.247510] 1f00             512 mtdblock0
[    5.247516]  (driver?)
[    5.254032] 1f01             256 mtdblock1
[    5.254037]  (driver?)
[    5.260549] 1f02             256 mtdblock2
[    5.260554]  (driver?)
[    5.267053] 1f03             256 mtdblock3
[    5.267057]  (driver?)
[    5.273569] 1f04             256 mtdblock4
[    5.273574]  (driver?)
[    5.280092] 1f05           40960 mtdblock5
[    5.280097]  (driver?)
[    5.286596] 1f06            4096 mtdblock6
[    5.286600]  (driver?)
[    5.293113] 1f07           36864 mtdblock7
[    5.293118]  (driver?)
[    5.299616] 1f08           35328 mtdblock8
[    5.299619]  (driver?)
[    5.306133] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,7)
[    5.316758] Rebooting in 1 seconds..

So it looks like the kernel probably tried mounting squashfs but this failed (even though manual mounting is ok) and then it disregarded an empty jffs2 and panicked.

Hope someone can give me advise as to what's wrong or where to look please? Thanks.

Full dmesg:



===================================================================
                MT7621   stage1 code done
                CPU=50000000 HZ BUS=16666666 HZ
===================================================================


U-Boot 1.1.3 (Aug  5 2016 - 15:06:22)

SERCOMM v1.03.0, Release date: 2016/08/05

Board: Ralink APSoC DRAM:  256 MB
relocate_code Pointer at: 8ffa8000

Config XHCI 40M PLL
******************************
Software System Reset Occurred
******************************
Allocate 16 byte aligned buffer: 8ffdf070
Enable NFI Clock
# MTK NAND # : Use HW ECC
NAND ID [C2 F1 80 95 02]
Device found in MTK table, ID: c2f1, EXT_ID: 809502
Support this Device in MTK table! c2f1
select_chip
[NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
Signature matched and data read!
load_fact_bbt success 1023
load fact bbt success
[mtk_nand] probe successfully!
mtd->writesize=2048 mtd->oobsize=64,    mtd->erasesize=131072  devinfo.iowidth=8
..============================================
Ralink UBoot Version: 5.0.0.0
--------------------------------------------
ASIC MT7621A DualCore (MAC to MT7530 Mode)
DRAM_CONF_FROM: Auto-Detection
DRAM_TYPE: DDR3
DRAM bus: 16 bit
Xtal Mode=3 OCP Ratio=1/3
Flash component: NAND Flash
Date:Aug  5 2016  Time:15:06:22
============================================
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:256, ways:4, linesz:32 ,total:32768

 ##### The CPU freq = 880 MHZ ####
 estimate memory size =256 Mbytes
#Reset_MT7530
set LAN/WAN WLLLL

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.

You choosed 3
                                                                                                                                                                                                                                              0

#### auto_recovery ####

check env def auto_recovery no
check env def auto_recovery yes
check env def boot_part 1
check env def boot_part_ready 3
enabled:1, boot_part:1, boot_part_ready:3
..nand read ret = 0x20000
boot_count:1, next_record:58
boot_count:1, next_record:58

3: System Boot system code via Flash.
## Booting image at bc180000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.63
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1864499 Bytes =  1.8 MB
   Load Address: 80001000
   Entry Point:  80001000
.............................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 256

Starting kernel ...

[    0.000000] Linux version 4.14.63 (@) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7258-5eb055306f)) #0 SMP Thu Aug 16 07:51:15 2018
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is Linksys EA8100
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 10000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x90/0x4a4 with crng_init=0
[    0.000000] percpu: Embedded 14 pages/cpu @8120e000 s26192 r8192 d22960 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Writing ErrCtl register=0002c40c
[    0.000000] Readback ErrCtl register=0002c40c
[    0.000000] Memory: 253484K/262144K available (4392K kernel code, 231K rwdata, 976K rodata, 212K init, 264K bss, 8660K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 256
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.000010] sched_clock: 32 bits at 440MHz, resolution 2ns, wraps every 4880645118ns
[    0.007798] Calibrating delay loop... 586.13 BogoMIPS (lpj=2930688)
[    0.073970] pid_max: default: 32768 minimum: 301
[    0.078735] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.085242] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.093952] Hierarchical SRCU implementation.
[    0.099066] smp: Bringing up secondary CPUs ...
[    0.105935] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.105945] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.105957] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.106088] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.163804] Synchronize counters for CPU 1: done.
[    0.199706] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.199714] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.199721] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.199792] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.254875] Synchronize counters for CPU 2: done.
[    0.287018] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.287026] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.287032] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.287109] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.340055] Synchronize counters for CPU 3: done.
[    0.369909] smp: Brought up 1 node, 4 CPUs
[    0.377123] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.386905] futex hash table entries: 1024 (order: 3, 32768 bytes)
[    0.393184] pinctrl core: initialized pinctrl subsystem
[    0.398894] NET: Registered protocol family 16
[    0.420369] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.426150] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.431901] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.439878] clocksource: Switched to clocksource GIC
[    0.446347] NET: Registered protocol family 2
[    0.451322] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.458205] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.464623] TCP: Hash tables configured (established 2048 bind 2048)
[    0.471024] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.476786] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.483243] NET: Registered protocol family 1
[    0.719820] 4 CPUs re-calibrate udelay(lpj = 2924544)
[    0.726192] Crashlog allocated RAM at address 0x3f00000
[    0.731553] workingset: timestamp_bits=30 max_order=16 bucket_order=0
[    0.743841] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.749579] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.760385] random: fast init done
[    0.765958] io scheduler noop registered
[    0.769792] io scheduler deadline registered (default)
[    0.775846] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.783307] console [ttyS0] disabled
[    0.786850] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 18, base_baud = 3125000) is a 16550A
[    0.795867] console [ttyS0] enabled
[    0.795867] console [ttyS0] enabled
[    0.802740] bootconsole [early0] disabled
[    0.802740] bootconsole [early0] disabled
[    0.811321] cacheinfo: Failed to find cpu0 device node
[    0.816442] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.823159] MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
[    0.830300] Enable NFI Clock
[    0.833169] # MTK NAND # : Use HW ECC
[    0.836827] Device not found, ID: c2f1
[    0.840586] Not Support this Device!
[    0.844318] chip_mode=00000001
[    0.847355] Support this Device in MTK table! c2f1
[    0.852314] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[    0.858770] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
[    0.865100] nand: Macronix NAND 128MiB 3,3V 8-bit
[    0.869782] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.877340] Scanning device for bad blocks
[    0.898127] Bad eraseblock 71 at 0x0000008e0000
[    0.967428] Bad eraseblock 349 at 0x000002ba0000
[    0.977750] Bad eraseblock 374 at 0x000002ec0000
[    0.987603] Bad eraseblock 397 at 0x0000031a0000
[    1.005870] Bad eraseblock 456 at 0x000003900000
[    1.021098] Bad eraseblock 502 at 0x000003ec0000
[    1.034456] Bad eraseblock 540 at 0x000004380000
[    1.050159] Bad eraseblock 588 at 0x000004980000
[    1.106496] Bad eraseblock 810 at 0x000006540000
[    1.128493] Bad eraseblock 885 at 0x000006ea0000
[    1.165420] 6 fixed-partitions partitions found on MTD device MT7621-NAND
[    1.172195] Creating 6 MTD partitions on "MT7621-NAND":
[    1.177403] 0x000000000000-0x000000080000 : "uboot"
[    1.183370] 0x000000080000-0x0000000c0000 : "uboot_env"
[    1.189526] 0x0000000c0000-0x000000100000 : "factory"
[    1.195555] 0x000000100000-0x000000140000 : "s_env"
[    1.201423] 0x000000140000-0x000000180000 : "devinfo"
[    1.207409] 0x000000180000-0x000002980000 : "firmware"
[    1.771302] 2 uimage-fw partitions found on MTD device firmware
[    1.777219] 0x000000180000-0x000000580000 : "kernel"
[    1.783288] 0x000000580000-0x000002980000 : "rootfs"
[    1.789463] mtd: device 7 (rootfs) set to be root filesystem
[    1.795168] 1 squashfs-split partitions found on MTD device rootfs
[    1.801347] 0x000000700000-0x000002980000 : "rootfs_data"
[    1.807972] [mtk_nand] probe successfully!
[    1.812790] Signature matched and data read!
[    1.817036] load_fact_bbt success 1023
[    1.821441] libphy: Fixed MDIO Bus: probed
[    1.891651] mtk_soc_eth 1e100000.ethernet: generated random MAC address da:1b:64:a3:81:c3
[    1.899995] libphy: mdio: probed
[    3.302770] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    3.309407] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20
[    3.320139] NET: Registered protocol family 10
[    3.326062] Segment Routing with IPv6
[    3.329811] NET: Registered protocol family 17
[    3.334331] 8021q: 802.1Q VLAN Support v1.8
[    3.340813] hctosys: unable to open rtc device (rtc0)
[    3.347788] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000010: 0xc000 instead
[    3.357260] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000005c: 0x3000 instead
[    3.366712] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000007c: 0x3000 instead
[    3.376166] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000000dc: 0x0c00 instead
[    3.458152] jffs2: Empty flash at 0x00000100 ends at 0x00000118
[    3.464071] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000118: 0x82dc instead
[    3.473517] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000011c: 0x9ec9 instead
[    3.482963] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000120: 0xd28e instead
[    3.492409] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000124: 0x1a0e instead
[    3.501854] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000128: 0xe5b8 instead
[    3.511300] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000012c: 0x8812 instead
[    3.520740] jffs2: Further such events for this erase block will not be printed
[    3.536370] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020000: 0xee07 instead
[    3.545825] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020004: 0x4b2e instead
[    3.555270] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020008: 0xfef6 instead
[    3.564716] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002000c: 0xf55b instead
[    3.574162] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020010: 0x9cbc instead
[    3.583607] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020014: 0x96e1 instead
[    3.593057] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020018: 0x2134 instead
[    3.602502] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002001c: 0x9813 instead
[    3.611948] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020020: 0xbf12 instead
[    3.621393] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020024: 0xfe80 instead
[    3.630834] jffs2: Further such events for this erase block will not be printed
[    3.682403] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040000: 0xbefe instead
[    3.691854] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040004: 0xf599 instead
[    3.701300] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040008: 0x37fb instead
[    3.710746] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0004000c: 0xabad instead
[    3.720196] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040010: 0x5fad instead
[    3.729628] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040014: 0xc233 instead
[    3.739072] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040018: 0x5861 instead
[    3.748518] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0004001c: 0x4ee1 instead
[    3.757963] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040020: 0x7419 instead
[    3.767409] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040024: 0x7696 instead
[    3.776850] jffs2: Further such events for this erase block will not be printed
[    3.821811] jffs2: Old JFFS2 bitmask found at 0x00047e1c
[    3.827095] jffs2: You cannot use older JFFS2 filesystems with newer kernels
[    3.840720] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060000: 0x0b7e instead
[    3.850174] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060004: 0x77e8 instead
[    3.859606] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060008: 0x70d5 instead
[    3.869049] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0006000c: 0x6ea7 instead
[    3.878495] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060010: 0x5351 instead
[    3.887940] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060014: 0x635f instead
[    3.897386] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060018: 0x7944 instead
[    3.906831] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0006001c: 0x2aaf instead
[    3.916276] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060020: 0x4ba6 instead
[    3.925722] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060024: 0xb3b4 instead
[    3.935162] jffs2: Further such events for this erase block will not be printed
[    3.986728] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080000: 0xe685 instead
[    3.996180] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080004: 0x0686 instead
[    4.005627] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080008: 0x49b7 instead
[    4.015072] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0008000c: 0xd9ea instead
[    4.024518] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080010: 0xf8d1 instead
[    4.033963] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080014: 0xea4b instead
[    4.043409] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080018: 0xfee5 instead
[    4.052855] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0008001c: 0x37c3 instead
[    4.062300] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080020: 0x86f2 instead
[    4.071745] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080024: 0x625e instead
[    4.081186] jffs2: Further such events for this erase block will not be printed
[    4.132798] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a0000: 0xbfce instead
[    4.142255] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a0004: 0x7003 instead
[    4.151701] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a0008: 0x86e2 instead
[    4.161147] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a000c: 0xb871 instead
[    4.170593] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a0010: 0xd3b1 instead
[    4.180039] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a0014: 0x33fc instead
[    4.189470] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a0018: 0xf5c2 instead
[    4.198914] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a001c: 0xdbe7 instead
[    4.208360] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a0020: 0x7d9a instead
[    4.217805] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000a0024: 0x81b5 instead
[    4.227246] jffs2: Further such events for this erase block will not be printed
[    4.274472] jffs2: Old JFFS2 bitmask found at 0x000b20fc
[    4.279756] jffs2: You cannot use older JFFS2 filesystems with newer kernels
[    4.291146] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0000: 0xbc4e instead
[    4.300596] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0004: 0xe8fc instead
[    4.310041] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0008: 0x57a1 instead
[    4.319473] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c000c: 0x9860 instead
[    4.328917] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0010: 0x19c7 instead
[    4.338363] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0014: 0x9a43 instead
[    4.347808] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0018: 0x74cd instead
[    4.357253] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c001c: 0xd159 instead
[    4.366699] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0020: 0x8cfe instead
[    4.376149] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000c0024: 0x0385 instead
[    4.385589] jffs2: Further such events for this erase block will not be printed
[    4.437154] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e0000: 0x451d instead
[    4.446606] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e0004: 0x04ed instead
[    4.456052] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e0008: 0x7947 instead
[    4.465497] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e000c: 0x323a instead
[    4.474943] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e0010: 0xb31e instead
[    4.484388] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e0014: 0x67e0 instead
[    4.493834] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e0018: 0xf12d instead
[    4.503284] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e001c: 0x634e instead
[    4.512730] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e0020: 0xece5 instead
[    4.522176] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x000e0024: 0x0f2f instead
[    4.531616] jffs2: Further such events for this erase block will not be printed
[    4.567574] mtk_soc_eth 1e100000.ethernet eth0: port 4 link up
[    4.583289] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100000: 0x4e7a instead
[    4.592739] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100004: 0x90e6 instead
[    4.602185] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100008: 0x599b instead
[    4.611630] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0010000c: 0x4c1c instead
[    4.621076] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100010: 0x94f8 instead
[    4.630526] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100014: 0x47be instead
[    4.639972] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100018: 0x191d instead
[    4.649403] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0010001c: 0x86c6 instead
[    4.658847] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100020: 0xdae1 instead
[    4.668293] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00100024: 0xac02 instead
[    4.677733] jffs2: Further such events for this erase block will not be printed
[    4.729290] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00120000: 0xca98 instead
[    4.738742] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00120004: 0xedbb instead
...
[    4.804866] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00120020: 0x39c3 instead
[    4.814312] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00120024: 0x2e93 instead
[    4.823752] jffs2: Further such events for this erase block will not be printed
[    4.871074] jffs2: Old JFFS2 bitmask found at 0x00132770
[    4.876358] jffs2: You cannot use older JFFS2 filesystems with newer kernels
[    4.887633] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00140000: 0x639a instead
[    4.897087] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00140004: 0xde55 instead
...
[    4.963207] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00140020: 0xe46c instead
[    4.972653] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00140024: 0xc8aa instead
[    4.982093] jffs2: Further such events for this erase block will not be printed
[    5.033683] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00160000: 0x6f27 instead
[    5.043136] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00160004: 0xf7b9 instead
...
[    5.109313] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00160020: 0x73d0 instead
[    5.118759] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00160024: 0xa60f instead
[    5.128199] jffs2: Further such events for this erase block will not be printed
[    5.209300] jffs2_scan_eraseblock(): End of filesystem marker found at 0x180000
[    5.216899] jffs2: Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes
[    5.225307] jffs2: empty_blocks 275, bad_blocks 1, c->nr_blocks 288
[    5.231651] VFS: Cannot open root device "(null)" or unknown-block(31,7): error -5
[    5.239180] Please append a correct "root=" boot option; here are the available partitions:
[    5.247510] 1f00             512 mtdblock0
[    5.247516]  (driver?)
[    5.254032] 1f01             256 mtdblock1
[    5.254037]  (driver?)
[    5.260549] 1f02             256 mtdblock2
[    5.260554]  (driver?)
[    5.267053] 1f03             256 mtdblock3
[    5.267057]  (driver?)
[    5.273569] 1f04             256 mtdblock4
[    5.273574]  (driver?)
[    5.280092] 1f05           40960 mtdblock5
[    5.280097]  (driver?)
[    5.286596] 1f06            4096 mtdblock6
[    5.286600]  (driver?)
[    5.293113] 1f07           36864 mtdblock7
[    5.293118]  (driver?)
[    5.299616] 1f08           35328 mtdblock8
[    5.299619]  (driver?)
[    5.306133] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,7)
[    5.316758] Rebooting in 1 seconds..

Hello!

I'm interested to help with adding support to this router as well! I am very new to openwrt development so I am probably not of much help.

If it helps, Linksys does publish the GPL kernel sources for this router here - https://www.linksys.com/us/support-article?articleNum=114663, maybe there's information there to help with fixing the VFS kernel panics.

Did you try with ubifs? In mt7621.mk, set FILESYSTEMS to squashfs for your device, and in device tree, rename rootfs to ubi and delete rootfs_data partition.

Welcome @kelvl!

So far I haven't been focusing on how to flash an image without opening up the cover, but currently use UART to tell the bootloader to boot from tftp. You need some soldering if you are to do the same.

Let you know when I have something you can test with.

Thanks @danijeltudek! So I made this commit and now it boots with overlay and all.

It's odd why plain old squashfs didn't work.

Here the dmesg (tftp boot the -squashfs-sysupgrade.bin):

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.                                                                                                                                                    3
You choosed 2
                                                                                                                                                                                                             0


2: System Load Linux Kernel then write to Flash via TFTP.
 Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N)
 Please Input new ones /or Ctrl-C to discard
        Input device IP () ==:
        Input server IP () ==:
        Input Linux Kernel filename (openwrt-ramips-mt7621-ea8100-squashfs-sysupgrade.bin) ==:openwrt-ramips-mt7621-ea8100-squashfs-sysupgrade.bin
        which kernel partition to update (1/2/3=both) (2) ==:1

 NetTxPacket = 0x8FFE3200

 KSEG1ADDR(NetTxPacket) = 0xAFFE3200

 NetLoop,call eth_halt !

 NetLoop,call eth_init !
Trying Eth0 (10/100-M)

 Waitting for RX_DMA_BUSY status Start... done


 ETH_STATE_ACTIVE!!
TFTP from server ; our IP address is 
Filename 'openwrt-ramips-mt7621-ea8100-squashfs-sysupgrade.bin'.

 TIMEOUT_COUNT=10,Load address: 0x80100000
Loading: checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
Got ARP REPLY, set server/gtwy eth addr ()
Got it
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ######
done
Bytes transferred = 6684672 (660000 hex)
LoadAddr=80100000 NetBootFileXferSize= 00660000
ranand_erase: start:180000, len:20000
..ranand_erase: start:1a0000, len:20000
..ranand_erase: start:1c0000, len:20000
..ranand_erase: start:1e0000, len:20000
..ranand_erase: start:200000, len:20000
..ranand_erase: start:220000, len:20000
..ranand_erase: start:240000, len:20000
..ranand_erase: start:260000, len:20000
..ranand_erase: start:280000, len:20000
..ranand_erase: start:2a0000, len:20000
..ranand_erase: start:2c0000, len:20000
..ranand_erase: start:2e0000, len:20000
..ranand_erase: start:300000, len:20000
..ranand_erase: start:320000, len:20000
..ranand_erase: start:340000, len:20000
..ranand_erase: start:360000, len:20000
..ranand_erase: start:380000, len:20000
..ranand_erase: start:3a0000, len:20000
..ranand_erase: start:3c0000, len:20000
..ranand_erase: start:3e0000, len:20000
..ranand_erase: start:400000, len:20000
..ranand_erase: start:420000, len:20000
..ranand_erase: start:440000, len:20000
..ranand_erase: start:460000, len:20000
..ranand_erase: start:480000, len:20000
..ranand_erase: start:4a0000, len:20000
..ranand_erase: start:4c0000, len:20000
..ranand_erase: start:4e0000, len:20000
..ranand_erase: start:500000, len:20000
..ranand_erase: start:520000, len:20000
..ranand_erase: start:540000, len:20000
..ranand_erase: start:560000, len:20000
..ranand_erase: start:580000, len:20000
..ranand_erase: start:5a0000, len:20000
..ranand_erase: start:5c0000, len:20000
..ranand_erase: start:5e0000, len:20000
..ranand_erase: start:600000, len:20000
..ranand_erase: start:620000, len:20000
..ranand_erase: start:640000, len:20000
..ranand_erase: start:660000, len:20000
..ranand_erase: start:680000, len:20000
..ranand_erase: start:6a0000, len:20000
..ranand_erase: start:6c0000, len:20000
..ranand_erase: start:6e0000, len:20000
..ranand_erase: start:700000, len:20000
..ranand_erase: start:720000, len:20000
..ranand_erase: start:740000, len:20000
..ranand_erase: start:760000, len:20000
..ranand_erase: start:780000, len:20000
..ranand_erase: start:7a0000, len:20000
..ranand_erase: start:7c0000, len:20000
..Done!
## Booting image at bc180000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.63
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1864270 Bytes =  1.8 MB
   Load Address: 80001000
   Entry Point:  80001000
.............................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 256

Starting kernel ...

[    0.000000] Linux version 4.14.63 (@) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7258-5eb055306f)) #0 SMP Thu Aug 16 07:51:15 2018
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is Linksys EA8100
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 10000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x90/0x4a4 with crng_init=0
[    0.000000] percpu: Embedded 14 pages/cpu @8120e000 s26192 r8192 d22960 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Writing ErrCtl register=0002c400
[    0.000000] Readback ErrCtl register=0002c400
[    0.000000] Memory: 253484K/262144K available (4392K kernel code, 231K rwdata, 976K rodata, 212K init, 264K bss, 8660K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 256
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.000010] sched_clock: 32 bits at 440MHz, resolution 2ns, wraps every 4880645118ns
[    0.007799] Calibrating delay loop... 586.13 BogoMIPS (lpj=2930688)
[    0.073972] pid_max: default: 32768 minimum: 301
[    0.078735] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.085243] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.093957] Hierarchical SRCU implementation.
[    0.099068] smp: Bringing up secondary CPUs ...
[    0.105940] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.105950] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.105961] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.106093] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.163804] Synchronize counters for CPU 1: done.
[    0.199707] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.199715] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.199723] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.199792] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.254875] Synchronize counters for CPU 2: done.
[    0.287020] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.287028] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.287035] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.287111] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.340056] Synchronize counters for CPU 3: done.
[    0.369910] smp: Brought up 1 node, 4 CPUs
[    0.377136] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.386918] futex hash table entries: 1024 (order: 3, 32768 bytes)
[    0.393196] pinctrl core: initialized pinctrl subsystem
[    0.398909] NET: Registered protocol family 16
[    0.421051] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.426839] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.432579] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.440679] clocksource: Switched to clocksource GIC
[    0.447127] NET: Registered protocol family 2
[    0.452093] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.458975] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.465454] TCP: Hash tables configured (established 2048 bind 2048)
[    0.471896] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.477658] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.484155] NET: Registered protocol family 1
[    0.720606] 4 CPUs re-calibrate udelay(lpj = 2924544)
[    0.726982] Crashlog allocated RAM at address 0x3f00000
[    0.732326] workingset: timestamp_bits=30 max_order=16 bucket_order=0
[    0.745680] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.751474] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.762794] random: fast init done
[    0.767926] io scheduler noop registered
[    0.771816] io scheduler deadline registered (default)
[    0.777794] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.785404] console [ttyS0] disabled
[    0.788945] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 18, base_baud = 3125000) is a 16550A
[    0.797954] console [ttyS0] enabled
[    0.797954] console [ttyS0] enabled
[    0.804825] bootconsole [early0] disabled
[    0.804825] bootconsole [early0] disabled
[    0.813372] cacheinfo: Failed to find cpu0 device node
[    0.818491] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.825335] MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
[    0.832435] Enable NFI Clock
[    0.835304] # MTK NAND # : Use HW ECC
[    0.838963] Device not found, ID: c2f1
[    0.842724] Not Support this Device!
[    0.846457] chip_mode=00000001
[    0.849494] Support this Device in MTK table! c2f1
[    0.854453] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[    0.860921] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
[    0.867241] nand: Macronix NAND 128MiB 3,3V 8-bit
[    0.871932] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.879480] Scanning device for bad blocks
[    0.900442] Bad eraseblock 71 at 0x0000008e0000
[    0.970448] Bad eraseblock 349 at 0x000002ba0000
[    0.980842] Bad eraseblock 374 at 0x000002ec0000
[    0.990759] Bad eraseblock 397 at 0x0000031a0000
[    1.009155] Bad eraseblock 456 at 0x000003900000
[    1.024494] Bad eraseblock 502 at 0x000003ec0000
[    1.037945] Bad eraseblock 540 at 0x000004380000
[    1.053758] Bad eraseblock 588 at 0x000004980000
[    1.110641] Bad eraseblock 810 at 0x000006540000
[    1.132819] Bad eraseblock 885 at 0x000006ea0000
[    1.170093] 7 fixed-partitions partitions found on MTD device MT7621-NAND
[    1.176865] Creating 7 MTD partitions on "MT7621-NAND":
[    1.182090] 0x000000000000-0x000000080000 : "uboot"
[    1.187910] 0x000000080000-0x0000000c0000 : "uboot_env"
[    1.193999] 0x0000000c0000-0x000000100000 : "factory"
[    1.199867] 0x000000100000-0x000000140000 : "s_env"
[    1.205606] 0x000000140000-0x000000180000 : "devinfo"
[    1.211509] 0x000000180000-0x000002980000 : "kernel"
[    1.217622] 0x000000580000-0x000002980000 : "ubi"
[    1.223443] [mtk_nand] probe successfully!
[    1.228223] Signature matched and data read!
[    1.232488] load_fact_bbt success 1023
[    1.236837] libphy: Fixed MDIO Bus: probed
[    1.312442] mtk_soc_eth 1e100000.ethernet: generated random MAC address 32:95:c2:fe:8d:c1
[    1.320801] libphy: mdio: probed
[    2.723542] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    2.730136] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20
[    2.740815] NET: Registered protocol family 10
[    2.746741] Segment Routing with IPv6
[    2.750487] NET: Registered protocol family 17
[    2.755002] 8021q: 802.1Q VLAN Support v1.8
[    2.762004] UBI: auto-attach mtd6
[    2.765334] ubi0: attaching mtd6
[    2.784751] UBI: EOF marker found, PEBs from 14 will be erased
[    2.790941] ubi0: scanning is finished
[    2.833138] ubi0: volume 1 ("rootfs_data") re-sized from 9 to 252 LEBs
[    2.840387] ubi0: attached mtd6 (name "ubi", size 36 MiB)
[    2.845788] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    2.852641] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    2.859394] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    2.866330] ubi0: good PEBs: 287, bad PEBs: 1, corrupted PEBs: 0
[    2.872318] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    2.879507] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 996859445
[    2.888518] ubi0: available PEBs: 0, total reserved PEBs: 287, PEBs reserved for bad PEB handling: 19
[    2.897729] ubi0: background thread "ubi_bgt0d" started, PID 341
[    2.899383] block ubiblock0_0: created from ubi0:0(rootfs)
[    2.899399] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[    2.899420] hctosys: unable to open rtc device (rtc0)
[    2.937084] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    2.944639] Freeing unused kernel memory: 212K
[    2.949072] This architecture does not have kernel memory protection.
[    3.430379] init: Console is alive
[    3.434035] init: - watchdog -
[    3.696990] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.785632] usbcore: registered new interface driver usbfs
[    3.791258] usbcore: registered new interface driver hub
[    3.796693] usbcore: registered new device driver usb
[    3.810295] xhci-mtk 1e1c0000.xhci: xHCI Host Controller
[    3.815719] xhci-mtk 1e1c0000.xhci: new USB bus registered, assigned bus number 1
[    3.830804] xhci-mtk 1e1c0000.xhci: hcc params 0x01401198 hci version 0x96 quirks 0x00210010
[    3.839280] xhci-mtk 1e1c0000.xhci: irq 19, io mem 0x1e1c0000
[    3.845948] hub 1-0:1.0: USB hub found
[    3.849767] hub 1-0:1.0: 2 ports detected
[    3.854362] xhci-mtk 1e1c0000.xhci: xHCI Host Controller
[    3.859672] xhci-mtk 1e1c0000.xhci: new USB bus registered, assigned bus number 2
[    3.867154] xhci-mtk 1e1c0000.xhci: Host supports USB 3.0  SuperSpeed
[    3.873751] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    3.882653] hub 2-0:1.0: USB hub found
[    3.886469] hub 2-0:1.0: 1 port detected
[    3.892420] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.910967] init: - preinit -
[    3.975570] mtk_soc_eth 1e100000.ethernet eth0: port 3 link up
[    4.419331] usb 1-2: new high-speed USB device number 2 using xhci-mtk
[    4.502526] mtk_soc_eth 1e100000.ethernet: PPE started
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
[    4.650590] random: procd: uninitialized urandom read (4 bytes read)
[    7.714779] UBIFS (ubi0:1): default file-system created
[    7.721463] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 430
[    7.833257] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[    7.841083] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    7.850969] UBIFS (ubi0:1): FS size: 30728192 bytes (29 MiB, 242 LEBs), journal size 1523712 bytes (1 MiB, 12 LEBs)
[    7.861365] UBIFS (ubi0:1): reserved for root: 1451367 bytes (1417 KiB)
[    7.867951] UBIFS (ubi0:1): media format: w4/r0 (latest is w5/r0), UUID B1658E26-ED85-41BD-A694-CBD9CA3C54B7, small LPT model
[    7.882220] mount_root: overlay filesystem has not been fully initialized yet
[    7.889934] mount_root: switching to ubifs overlay
[    7.912063] urandom-seed: Seed file not found (/etc/urandom.seed)
[    7.989554] mtk_soc_eth 1e100000.ethernet: 0x100 = 0x6060000c, 0x10c = 0x80818
[    8.004036] procd: - early -
[    8.007008] procd: - watchdog -
[    8.670810] procd: - watchdog -
[    8.674246] procd: - ubus -
[    8.737346] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.744515] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.751295] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.758455] procd: - init -
Please press Enter to activate this console.
[    8.992217] kmodloader: loading kernel modules from /etc/modules.d/*
[    9.002214] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    9.367366] ip_tables: (C) 2000-2006 Netfilter Core Team
[    9.705065] nf_conntrack version 0.5.0 (4096 buckets, 16384 max)
[    9.913708] xt_time: kernel timezone is -0000
[   10.094194] PPP generic driver version 2.4.2
[   10.099806] NET: Registered protocol family 24
[   10.106660] kmodloader: done loading kernel modules from /etc/modules.d/*
[   11.233585] urandom_read: 5 callbacks suppressed
[   11.233596] random: jshn: uninitialized urandom read (4 bytes read)
[   17.187357] mtk_soc_eth 1e100000.ethernet: PPE started
[   17.200297] br-lan: port 1(eth0.2) entered blocking state
[   17.205782] br-lan: port 1(eth0.2) entered disabled state
[   17.211815] device eth0.2 entered promiscuous mode
[   17.216644] device eth0 entered promiscuous mode
[   17.225140] br-lan: port 1(eth0.2) entered blocking state
[   17.230553] br-lan: port 1(eth0.2) entered forwarding state
[   17.236638] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   18.201051] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   24.230646] random: crng init done

and mount:

root@OpenWrt:/# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_1 on /overlay type ubifs (rw,noatime,ubi=0,vol=1)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

and df:

root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.5M      1.5M         0 100% /rom
tmpfs                   123.9M     60.0K    123.8M   0% /tmp
/dev/ubi0_1              26.4M     36.0K     25.0M   0% /overlay
overlayfs:/overlay       26.4M     36.0K     25.0M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev

Able to opkg install luci:

image

Not able to boot from nand yet. It says:

## Booting image at be980000 ...
Bad Magic Number,55424923 

Will need more work.

I must admit that it's a mystery for me how does that ubi-rootfs detection works (never bothered to inspect it), but it worked on a few boards I tried running OpenWrt on.

Regarding the NAND boot issue, that's U-Boot error message. Define KERNEL variable to generate uImage (check Device/wf-2881) and try flashing it to kernel partition either via initramfs image or the U-Boot console.

I referred to GPL code that Linksys has published. EA8100 seems to have two sets of OS image.


0x0         0x80000   0xC0000    0x100000   0x140000   0x180000             0x2980000            0x5180000      0x5280000            0x8000000
 +-------------+----------+----------+----------+----------+--------------------+--------------------+--------------+---------------------+
 |    u-boot   |u-boot-env|  Factory |   s_env  |  devinfo |        kernel      |     alt_kernel     |   sysdiag    |        syscfg       |
 |   (0x80000) | (0x40000)| (0x40000)| (0x40000)| (0x40000)|      (0x2800000)   |     (0x2800000)    |  (0x100000)  |      (0x2D80000)    |
 |             |          |          |          |          |    +---------------+    +---------------+              |                     |
 |             |          |          |          |          |    |    rootfs     |    |  alt_rootfs   |              |                     |
 |             |          |          |          |          |    |  (0x2400000)  |    |  (0x2400000)  |              |                     |
 +-------------+----------+----------+----------+----------+----+---------------+----+---------------+--------------+---------------------+
                                                              0x580000             0x2D80000

It seems that the Kernel can not be loaded from the second partition (alt_kernel).

@danijeltudek @musashino Thanks for the help people!

It went back to booting at bc180000 after I set boot_part_ready=3 and boot_part=1 in uboot env. Maybe these control which "partition" to boot.

Previously these were both set to 2. (I had messed with them before.) Now I suppose that boot_part_ready is a bitmask indicating which partitions are "ready", and boot_part indicates which one to boot from. Setting both to 2 probably told the bootloader that only the 2nd kernel was ready and also it should boot from that. Haven't done anything to confirm this.

uboot env that works:

MT7621 # printenv
bootargs=console=ttyS1,115200n8 root=/dev/mtdblock6 ro rootfstype=jffs2 init=/sbin/init
bootcmd=tftp
auto_recovery=yes
bootdelay=5
baudrate=115200
ethaddr="00:AA:BB:CC:DD:10"
Image1Stable=1
filesize=3181a0
fileaddr=80A00000
ipaddr=192.168.x.x
serverip=192.168.x.x
autostart=no
bootfile=openwrt-ramips-mt7621-ea8100-initramfs-kernel.bin
stdin=serial
stdout=serial
stderr=serial
Image1Try=0
boot_part_ready=3
boot_part=1

55424923 is actually the hex for "UBI#" string which is the magic bytes in the header of a UBI block. I dumped the entire mtd (incl the 2nd part) but only found these bytes within the first "firmware" mtdblock (first kernel plus first rootfs), so the new strange thing now is that theoretically the bootloader shouldn't complain about 55424923 if it's booting from be980000 (2nd partition).

Unless! boot_part=2 means boot from firmware stored at 0x580000 which is the ubi? However there is missing puzzle before this becomes intuitive.

[    2.333965] Creating 8 MTD partitions on "MT7621-NAND":
[    2.339173] 0x000000000000-0x000000080000 : "uboot"
[    2.345142] 0x000000080000-0x0000000c0000 : "uboot_env"
[    2.351397] 0x0000000c0000-0x000000100000 : "factory"
[    2.357388] 0x000000100000-0x000000140000 : "s_env"
[    2.363268] 0x000000140000-0x000000180000 : "devinfo"
[    2.369297] 0x000000180000-0x000002980000 : "kernel"
[    2.375581] 0x000000580000-0x000002980000 : "ubi"
[    2.381554] 0x000002980000-0x000005180000 : "alt_kernel"

OK anyway now we have a working image. Next thing is to look at how to flash it without opening up the cover then I can give the image to @kelvl for further testing. Some Linksys signature detection is in place if I upload the .bin over the factory UI.

Maybe holding reset or another button during boot instructs U-Boot to start TFTP download?

@danijeltudek This didn't work. I requested the linksys source code last year and they posted it online but for so long I haven't done any deep dive. A quick grep for 180000 or 2980000 didn't turn up anything useful outside of linux kernel patches. Please let us know if you found anything in there.

Anyway... I managed to create a signature that the linksys UI accepted and flashed. However it seem to have gone into the alt_kernel so the ubi address is now not valid.

Unlikely that linksys hardcoded to target alt_kernel. Likely it flashes the one from which it did not boot from. We need some way to determine the ubi address based on where we are booted from. Will think about this tomorrow and over the weekend.

There seems to be some hints in "/usr/sbin/update_defs" and "/etc/init.d/service_autofwup.sh" in stock firmware.

I guess that boot_part is determined from some kind of a header present in the image format that Web UI accepts. You should take a look there.

I reverted both partitions to factory image from Linksys and tried booting from both.

Regardless of which partition I booted up from, it appears the Linksys UI always writes to the 2nd partition.

So I decided to build with EA8100.dts pointing kernel and ubs to the 2nd partition addresses. The -squashfs-sysupgrade.bin was flashed via Linksys UI, and dmesg say the new addresses as expected:

[    2.338784] 0x000000000000-0x000000080000 : "uboot"
[    2.344774] 0x000000080000-0x0000000c0000 : "uboot_env"
[    2.350950] 0x0000000c0000-0x000000100000 : "factory"
[    2.357014] 0x000000100000-0x000000140000 : "s_env"
[    2.362924] 0x000000140000-0x000000180000 : "devinfo"
[    2.368923] 0x000002980000-0x000005180000 : "kernel"
[    2.375207] 0x000002d80000-0x000005180000 : "ubi"

However:

[    3.924342] UBI error: no valid UBI magic found inside mtd6

I tftp boot into -initramfs-kernel.bin and found that the UBI header is not aligned:

root@OpenWrt:/# head /dev/mtd6 | hexdump  -C | head
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00020000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 00  |UBI#............|
00020010  00 00 08 00 00 00 10 00  7e 62 6e 91 00 00 00 00  |........~bn.....|
00020020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00020030  00 00 00 00 00 00 00 00  00 00 00 00 ff d4 03 e1  |................|
00020040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00020800  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00020810  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

I reflashed with mtd command:

root@OpenWrt:/tmp# mtd erase kernel
Unlocking kernel ...
Erasing kernel ...

Skipping bad block at 0x220000   
Skipping bad block at 0x540000   
Skipping bad block at 0x820000   
Skipping bad block at 0xf80000   
Skipping bad block at 0x1540000   
Skipping bad block at 0x1a00000   
root@OpenWrt:/tmp# mtd write openwrt-ramips-mt7621-ea8100-squashfs-sysupgrade.bi
n kernel
Unlocking kernel ...

Writing from openwrt-ramips-mt7621-ea8100-squashfs-sysupgrade.bin to kernel ...  [e]
Skipping bad block at 0x00220000[e]
Skipping bad block at 0x0054000    

However the result is the same.

I know the image is good in terms of alignment:

/home/tftpd# binwalk openwrt-ramips-mt7621-ea8100-squashfs-sysupgrade.bin

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             uImage header, header size: 64 bytes, header CRC: 0x9D840594, created: 2019-01-12 03:52:11, image size: 1896421 bytes, Data Address: 0x80001000, Entry Point: 0x80001000, data CRC: 0x9069E256, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: "MIPS OpenWrt Linux-4.14.91"
64            0x40            LZMA compressed data, properties: 0x6D, dictionary size: 2097152 bytes, uncompressed size: 6051408 bytes
4194304       0x400000        UBI erase count header, version: 1, EC: 0x0, VID header offset: 0x800, data offset: 0x1000
/home/tftpd# hexdump -C openwrt-ramips-mt7621-ea8100-squashfs-sysupgrade.bin | egrep ^00400000  -A 30 | head
00400000  55 42 49 23 01 00 00 00  00 00 00 00 00 00 00 00  |UBI#............|
00400010  00 00 08 00 00 00 10 00  7e 62 6e 91 00 00 00 00  |........~bn.....|
00400020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00400030  00 00 00 00 00 00 00 00  00 00 00 00 ff d4 03 e1  |................|
00400040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00400800  55 42 49 21 01 01 00 05  7f ff ef ff 00 00 00 00  |UBI!............|
00400810  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00400830  00 00 00 00 00 00 00 00  00 00 00 00 b8 25 64 a8  |.............%d.|

Is it due to bad erase blocks that the data got shifted? How do we work around this?

Is it due to bad erase blocks that the data got shifted? How do we work around this?

The mt7621 NAND driver tries to be smart and breaks stuff instead.

The issue is tracked in https://bugs.openwrt.org/index.php?do=details&task_id=1926 and a patch is provided which requires testing.

1 Like

@mkresin thanks for the link.

The change to shift_on_bbt = 0; as described in the patch of patch does not solve the problem. There did not seem to be making any difference. Either the fix is not working or I am encountering a different bug.

I did check that target-mipsel_24kc_musl/linux-ramips_mt7621/linux-4.14.91/drivers/mtd/nand/mtk_nand2.c was correctly updated and the changes made it to the output binaries. I tftp booted from new -initramfs-kernel.bin and wrote the new -squashfs-sysupgrade.bin to mtd again before trying to boot from 2nd partition of nand. The "patch1" word shows up in dmesg in both boots.

$ git diff target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch
diff --git a/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch b/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch
index d50e689110..1f95d5ad7d 100644
--- a/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch
+++ b/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch
@@ -3576,9 +3576,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +      err = mtd_device_parse_register(mtd, probe_types, &ppdata,
 +                                      NULL, 0);
 +      if (!err) {
-+              MSG(INIT, "[mtk_nand] probe successfully!\n");
++              MSG(INIT, "[mtk_nand] probe successfully patch1!\n");
 +              nand_disable_clock();
-+              shift_on_bbt = 1;
++              shift_on_bbt = 0;
 +              if (load_fact_bbt(mtd) == 0) {
 +                      int i;
 +                      for (i = 0; i < 0x100; i++)

It seem that in my case the issue isn't exactly as described by 1926. In that one, "reading a page with 0x2e00000 flash data it returns page that contains 0x2e20000 data". While for my case, when the kernel was reading the start of mtd it gave data for the previous erase block (almost like it ignored the bad block). As you can see from the hexdump of /dev/mtd6 only by reading 0x20000 can I get data originally meant for 0x0. It seems that the direction of "shift" is reversed to me.

Another thing: I have 2 bad blocks before 0x000002d80000 so actually the block offset should be shifted by 2 x 0x20000? Not sure how it's supposed to work.

[    0.898127] Bad eraseblock 71 at 0x0000008e0000
[    0.967428] Bad eraseblock 349 at 0x000002ba0000

Reading kernel partition works though when we can expect offset of 1 block. You can see the uboot image signature 27 05 19 56:

root@OpenWrt:/# head /dev/mtd5 | hexdump  -C | head
00000000  27 05 19 56 ee 16 1b ec  5c 39 80 f3 00 1c ef 94  |'..V....\9......|
00000010  80 00 10 00 80 00 10 00  e3 f3 3c a0 05 05 02 03  |..........<.....|
00000020  4d 49 50 53 20 4f 70 65  6e 57 72 74 20 4c 69 6e  |MIPS OpenWrt Lin|

I have started watching 1926 so that I can test as new patches are out. Hope that 1926 is describing the same problem as what I have but just need a different fix for it to work (so that I don't have to wait for a new fix).

@mkresin It looks like the issue in 1926 is solved but it doesn't work in my case.

This is probably what's happening:

image

Basically the suspicion is that when the image get written, every block after the bad erase block contains data meant for the previous block.

Hence when the kernel tries reading ubi at 0x2d80000 it end up getting empty padding data meant for the erase block before (i.e. the padding in the .bin file).

Is there a way to skip declaration of ubi@0xd80000 in the .dts, so that we get 1 big partition @ 0x298000-0x5180000 containing a ubi that encompass the kernel, squashfs and rootfs, and still make it properly boot? Maybe then the calculation will take into account the bad erase block will allow the kernel to properly read non-kernel data.

What to change in the source?

Raised this bug report. https://bugs.openwrt.org/index.php?do=details&task_id=2097

Now I am using mtdsplit of firmware partition so the dts no longer contain information about rootfs/ubi. It auto detects the correct block for start of the ubi.

https://bugs.openwrt.org/index.php?do=details&task_id=1926 also fixes a problem wrt bad block consideration and works in tandem.

@firemelon

May I know how is your working going? I am also interested to have a openwrt firmware installed in my EA8100

I successfully flashed the EA8100 with OpenWRT (firemelon's bins). Anybody else using the same? It is largely stable but will need to see overtime. There is an issue when you hardboot, it randomly picks up the original linksys firmware from boot partition. But couple of restarts and it comes back. Will report back after a week or so. Hopefully it remains stable

Hi could you please provide some instructions on how to flash EA8100? It seems like this link is not working.