Beeline Smartbox GIGA with bad erase block on NAND flash
Possible other NAND devices with bad erase blocks on flash
Software versions of OpenWrt/LEDE release, packages, etc: OpenWrt SNAPSHOT r16952-677813c776
Steps to reproduce:
Write Openwrt kernel (mtd4) and UBI (mtd6) partitions from the stock firmware on a device with badblock(s).
Get bootloop: [ 4.040886] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[ 4.042039] UBI error: no valid UBI magic found inside mtd6
[ 4.065746] hctosys: unable to open rtc device (rtc0)
[ 4.076584] /dev/root: Can't open blockdev
[ 4.084755] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
Root cause:
Both U-Boot and stock firmware detects a bad eraseblock, all following offsets are sifted by one block (0x20000). Our mtd4 and mtd6 in fact are written at 0x420000 and 0x1020000. ********************************************
Flash Map Information
Partition Logic_Offs Logic_size Real_Offs Real_Size
u-boot 0 100000 0 100000
part_map 100000 100000 100000 100000
factory-data 200000 100000 200000 120000
dual-flag 300000 100000 320000 100000
uImage1 400000 600000 420000 600000
uImage2 a00000 600000 a20000 600000
rootfs1 1000000 1800000 1020000 1800000
rootfs2 2800000 1800000 2820000 1800000
config/log 4000000 800000 4020000 800000
app-tmp 4800000 c00000 4820000 c00000
free-space 5400000 2800000 5420000 2800000
badblock-reserve 7c00000 400000 7c20000 360000
2. U-Boot still waiting for a kernel at 0x420000 and it's ok.
3. Openwrt detects a bad eraseblock, but does NOT shift all following offsets by one block: [ 1.198092] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
[ 1.210738] nand: Macronix MX30LF1G18AC
[ 1.218369] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 1.233435] mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits
[ 1.246486] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[ 1.261038] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[ 1.275588] Scanning device for bad blocks
[ 1.312129] Bad eraseblock 22 at 0x0000002c0000
[ 2.583817] 8 fixed-partitions partitions found on MTD device mt7621-nand
[ 2.597331] Creating 8 MTD partitions on "mt7621-nand":
[ 2.607736] 0x000000000000-0x000000100000 : "u-boot"
[ 2.618828] 0x000000100000-0x000000200000 : "dynamic partition map"
[ 2.632380] 0x000000200000-0x000000300000 : "Factory"
[ 2.643531] 0x000000300000-0x000000400000 : "Boot Flag"
[ 2.655139] 0x000000400000-0x000000a00000 : "kernel"
[ 2.666172] 0x000000a00000-0x000001000000 : "Kernel 2"
[ 2.677543] 0x000001000000-0x000007c00000 : "ubi"
[ 2.688598] 0x000007c20000-0x000007fa0000 : "bad block reserved"
3. As a result OpenWRT expects to find UBI at 0x1000000. In fact UBI is at 0x10200000. It causes boot loop:
[ 4.025957] pci 0000:00:01.0: bridge window [mem 0x60400000-0x604fffff pref]
[ 4.040886] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[ 4.042039] UBI error: no valid UBI magic found inside mtd6
[ 4.065746] hctosys: unable to open rtc device (rtc0)
[ 4.076584] /dev/root: Can't open blockdev
[ 4.084755] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 4.099639] Please append a correct "root=" boot option; here are the available partitions:
[ 4.116269] 1f00 1024 mtdblock0
[ 4.116274] (driver?)
[ 4.129299] 1f01 1024 mtdblock1
[ 4.129302] (driver?)
[ 4.142303] 1f02 1024 mtdblock2
[ 4.142305] (driver?)
[ 4.155316] 1f03 1024 mtdblock3
[ 4.155319] (driver?)
[ 4.168323] 1f04 6144 mtdblock4
[ 4.168326] (driver?)
[ 4.181324] 1f05 6144 mtdblock5
[ 4.181327] (driver?)
[ 4.194323] 1f06 110592 mtdblock6
[ 4.194326] (driver?)
[ 4.207336] 1f07 3584 mtdblock7
[ 4.207339] (driver?)
[ 4.220336] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 4.236804] Rebooting in 1 seconds..
The text was updated successfully, but these errors were encountered:
openwrt-bot commentedJun 19, 2021
csharper2005:
OpenWrt SNAPSHOT r16952-677813c776
[ 4.040886] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[ 4.042039] UBI error: no valid UBI magic found inside mtd6
[ 4.065746] hctosys: unable to open rtc device (rtc0)
[ 4.076584] /dev/root: Can't open blockdev
[ 4.084755] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
Root cause:
********************************************
Flash Map Information
Partition Logic_Offs Logic_size Real_Offs Real_Size
u-boot 0 100000 0 100000
part_map 100000 100000 100000 100000
factory-data 200000 100000 200000 120000
dual-flag 300000 100000 320000 100000
uImage1 400000 600000 420000 600000
uImage2 a00000 600000 a20000 600000
rootfs1 1000000 1800000 1020000 1800000
rootfs2 2800000 1800000 2820000 1800000
config/log 4000000 800000 4020000 800000
app-tmp 4800000 c00000 4820000 c00000
free-space 5400000 2800000 5420000 2800000
badblock-reserve 7c00000 400000 7c20000 360000
2. U-Boot still waiting for a kernel at 0x420000 and it's ok.
3. Openwrt detects a bad eraseblock, but does NOT shift all following offsets by one block:
[ 1.198092] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
[ 1.210738] nand: Macronix MX30LF1G18AC
[ 1.218369] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 1.233435] mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits
[ 1.246486] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[ 1.261038] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[ 1.275588] Scanning device for bad blocks
[ 1.312129] Bad eraseblock 22 at 0x0000002c0000
[ 2.583817] 8 fixed-partitions partitions found on MTD device mt7621-nand
[ 2.597331] Creating 8 MTD partitions on "mt7621-nand":
[ 2.607736] 0x000000000000-0x000000100000 : "u-boot"
[ 2.618828] 0x000000100000-0x000000200000 : "dynamic partition map"
[ 2.632380] 0x000000200000-0x000000300000 : "Factory"
[ 2.643531] 0x000000300000-0x000000400000 : "Boot Flag"
[ 2.655139] 0x000000400000-0x000000a00000 : "kernel"
[ 2.666172] 0x000000a00000-0x000001000000 : "Kernel 2"
[ 2.677543] 0x000001000000-0x000007c00000 : "ubi"
[ 2.688598] 0x000007c20000-0x000007fa0000 : "bad block reserved"
3. As a result OpenWRT expects to find UBI at 0x1000000. In fact UBI is at 0x10200000. It causes boot loop:
[ 4.025957] pci 0000:00:01.0: bridge window [mem 0x60400000-0x604fffff pref]
[ 4.040886] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[ 4.042039] UBI error: no valid UBI magic found inside mtd6
[ 4.065746] hctosys: unable to open rtc device (rtc0)
[ 4.076584] /dev/root: Can't open blockdev
[ 4.084755] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 4.099639] Please append a correct "root=" boot option; here are the available partitions:
[ 4.116269] 1f00 1024 mtdblock0
[ 4.116274] (driver?)
[ 4.129299] 1f01 1024 mtdblock1
[ 4.129302] (driver?)
[ 4.142303] 1f02 1024 mtdblock2
[ 4.142305] (driver?)
[ 4.155316] 1f03 1024 mtdblock3
[ 4.155319] (driver?)
[ 4.168323] 1f04 6144 mtdblock4
[ 4.168326] (driver?)
[ 4.181324] 1f05 6144 mtdblock5
[ 4.181327] (driver?)
[ 4.194323] 1f06 110592 mtdblock6
[ 4.194326] (driver?)
[ 4.207336] 1f07 3584 mtdblock7
[ 4.207339] (driver?)
[ 4.220336] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 4.236804] Rebooting in 1 seconds..
The text was updated successfully, but these errors were encountered: