OpenWrt Forum Archive

Topic: Netis WF-2881 boot failed

The content of this topic has been archived on 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all.
I tried to install trunk firmware to my Netis WF-2881, but after reboot it was not respond.
From U-Boot log, the error is in partitions layout:

[    2.670000] 5 ofpart partitions found on MTD device MT7621-NAND
[    2.680000] Creating 5 MTD partitions on "MT7621-NAND":
[    2.690000] 0x000000000000-0x000000030000 : "u-boot"
[    2.700000] 0x000000030000-0x000000031000 : "u-boot-env"
[    2.710000] 0x000000080000-0x000000100000 : "config"
[    2.720000] 0x000000100000-0x000000140000 : "factory"
[    2.730000] 0x000000140000-0x000007f80000 : "firmware"
[    4.490000] 2 uimage-fw partitions found on MTD device firmware
[    4.510000] 0x000000140000-0x0000002c0000 : "kernel"
[    4.520000] 0x0000002c0000-0x000007f80000 : "ubi"
[    4.530000] [mtk_nand] probe successfully!
[    4.540000] Signature matched and data read!
...
[    4.690000] UBI: auto-attach mtd6
[    4.700000] ubi0: attaching mtd6
[    5.880000] ubi0: scanning is finished
[    5.880000] ubi0 error: ubi_read_volume_table: the layout volume was not found
[    5.900000] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd6, error -22
[    5.910000] UBI error: cannot attach mtd6

After checkout commit 1a5d8c271f351f8dc8679a68a969b0fe6c3cad62 (where WF-2881 support was added) and build, router loaded successfully. The error occurs after commit d192740e04044530fa0d3f495e084b86b9139a89, that changes size of kernel partition to auto-calculated. So that patch fixes boot error:

diff --git a/target/linux/ramips/dts/WF-2881.dts b/target/linux/ramips/dts/WF-2881.dts
index 050bc2e..20349cb 100644
--- a/target/linux/ramips/dts/WF-2881.dts
+++ b/target/linux/ramips/dts/WF-2881.dts
@@ -42,9 +42,17 @@
                        read-only;
                };
 
-               partition@140000 {
+               firmware {
                        label = "firmware";
-                       reg = <0x140000 0x7E40000>;
+                       reg = <0x140000 0x6EC0000>;
+               };
+               partition@140000 {
+                       label = "kernel";
+                       reg = <0x140000 0x200000>;
+               };
+               partition@340000 {
+                       label = "ubi";
+                       reg = <0x340000 0x6CC0000>;
                };
        };
 
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 3175244..50e1372 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -142,8 +142,9 @@ define Device/wf-2881
   PAGESIZE := 2048
   FILESYSTEMS := squashfs
   IMAGE_SIZE := 132382720
-  KERNEL := $(KERNEL_DTB) | pad-offset 131072 64 | uImage lzma
-  IMAGE/sysupgrade.bin := append-kernel | append-ubi | check-size $$$$(IMAGE_SIZE)
+  KERNEL_SIZE := 2097152
+#  KERNEL := $(KERNEL_DTB) | pad-offset 131072 64 | uImage lzma
+  IMAGE/sysupgrade.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)
   DEVICE_TITLE := NETIS WF-2881
   DEVICE_PACKAGES := kmod-usb3 kmod-ledtrig-usbdev
 endef

But fixed size kernel partition is not very good. Can someone make proper patch and push it to trunk?

grayelf wrote:

But fixed size kernel partition is not very good. Can someone make proper patch and push it to trunk?

Never good ..

The problem is here the not "formated" UBI partition on MTD.

Some question here, beacuse I don't have any CPE with NAND
Boots this device into the shell or not ??

elektroman wrote:

Boots this device into the shell or not ??

No, rootfs is on that ubi partition, so kernel panic

[    2.430000] nand: device found, Manufacturer ID: 0xc8, Chip ID: 0xd1
[    2.440000] nand: Unknown NAND 128MiB 3,3V 8-bit
[    2.450000] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    2.460000] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[    2.480000] Scanning device for bad blocks
[    2.530000] Bad eraseblock 310 at 0x0000026c0000
[    2.570000] Bad eraseblock 543 at 0x0000043e0000
[    2.610000] Bad eraseblock 731 at 0x000005b60000
[    2.620000] Bad eraseblock 755 at 0x000005e60000
[    2.670000] 5 ofpart partitions found on MTD device MT7621-NAND
[    2.680000] Creating 5 MTD partitions on "MT7621-NAND":
[    2.690000] 0x000000000000-0x000000030000 : "u-boot"
[    2.700000] 0x000000030000-0x000000031000 : "u-boot-env"
[    2.710000] 0x000000080000-0x000000100000 : "config"
[    2.720000] 0x000000100000-0x000000140000 : "factory"
[    2.730000] 0x000000140000-0x000007f80000 : "firmware"
[    4.490000] 2 uimage-fw partitions found on MTD device firmware
[    4.510000] 0x000000140000-0x0000002c0000 : "kernel"
[    4.520000] 0x0000002c0000-0x000007f80000 : "ubi"
[    4.530000] [mtk_nand] probe successfully!
[    4.540000] Signature matched and data read!
[    4.550000] load_fact_bbt success 1023
[    4.550000] netif_napi_add() called with weight 128 on device eth%d
[    4.580000] libphy: mdio: probed
[    4.600000] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    4.610000] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 10
[    4.630000] mt7621_wdt 1e000100.wdt: Initialized
[    4.640000] NET: Registered protocol family 10
[    4.650000] NET: Registered protocol family 17
[    4.660000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    4.680000] 8021q: 802.1Q VLAN Support v1.8
[    4.690000] UBI: auto-attach mtd6
[    4.700000] ubi0: attaching mtd6
[    5.880000] ubi0: scanning is finished
[    5.880000] ubi0 error: ubi_read_volume_table: the layout volume was not found
[    5.900000] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd6, error -22
[    5.910000] UBI error: cannot attach mtd6
[    5.920000] hctosys: unable to open rtc device (rtc0)
[    5.930000] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    5.950000] Please append a correct "root=" boot option; here are the available partitions:
[    5.960000] 1f00             192 mtdblock0  (driver?)
[    5.970000] 1f01               4 mtdblock1  (driver?)
[    5.980000] 1f02             512 mtdblock2  (driver?)
[    5.990000] 1f03             256 mtdblock3  (driver?)
[    6.000000] 1f04          129280 mtdblock4  (driver?)
[    6.010000] 1f05            1536 mtdblock5  (driver?)
[    6.020000] 1f06          127744 mtdblock6  (driver?)
[    6.030000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    6.030000] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

And this is normal log with fixed ubi partition offset:

[    2.570000] nand: device found, Manufacturer ID: 0xc8, Chip ID: 0xd1
[    2.580000] nand: Unknown NAND 128MiB 3,3V 8-bit
[    2.590000] nand: 128MiB, SLC, page size: 2048, OOB size: 64
[    2.600000] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[    2.620000] Scanning device for bad blocks
[    2.670000] Bad eraseblock 310 at 0x0000026c0000
[    2.710000] Bad eraseblock 543 at 0x0000043e0000
[    2.750000] Bad eraseblock 731 at 0x000005b60000
[    2.760000] Bad eraseblock 755 at 0x000005e60000
[    2.810000] 7 ofpart partitions found on MTD device MT7621-NAND
[    2.820000] Creating 7 MTD partitions on "MT7621-NAND":
[    2.830000] 0x000000000000-0x000000030000 : "u-boot"
[    2.840000] 0x000000080000-0x000000100000 : "config"
[    2.850000] 0x000000100000-0x000000140000 : "factory"
[    2.860000] 0x000000140000-0x000000340000 : "kernel"
[    2.870000] 0x000000030000-0x000000031000 : "u-boot-env"
[    2.880000] 0x000000140000-0x000007000000 : "firmware"
[    4.930000] 0x000000340000-0x000007000000 : "ubi"
[    4.940000] [mtk_nand] probe successfully!
[    4.950000] Signature matched and data read!
[    4.960000] load_fact_bbt success 1023
[    4.970000] netif_napi_add() called with weight 128 on device eth%d
[    4.990000] change HW-TRAP to 0x17ccf
[    5.000000] libphy: mdio: probed
[    5.020000] ralink_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    5.030000] ralink_soc_eth 1e100000.ethernet eth0: ralink at 0xbe100000, irq 11
[    5.050000] mt7621_wdt 1e000100.wdt: Initialized
[    5.060000] TCP: cubic registered
[    5.060000] NET: Registered protocol family 10
[    5.070000] NET: Registered protocol family 17
[    5.080000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    5.110000] 8021q: 802.1Q VLAN Support v1.8
[    5.120000] UBI: auto-attach mtd6
[    5.120000] UBI: attaching mtd6 to ubi0
[    6.150000] UBI: scanning is finished
[    6.170000] UBI: attached mtd6 (name "ubi", size 108 MiB) to ubi0
[    6.180000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    6.200000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    6.210000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[    6.220000] UBI: good PEBs: 866, bad PEBs: 4, corrupted PEBs: 0
[    6.240000] UBI: user volume: 2, internal volumes: 1, max. volumes count: 128
[    6.250000] UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 767279876
[    6.270000] UBI: available PEBs: 0, total reserved PEBs: 866, PEBs reserved for bad PEB handling: 16
[    6.290000] UBI: background thread "ubi_bgt0d" started, PID 294
[    6.290000] UBI: ubiblock0_0 created from ubi0:0(rootfs)
[    6.290000] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[    6.290000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    6.340000] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
...
[   12.630000] UBIFS: background thread "ubifs_bgt0_1" started, PID 368
[   12.700000] UBIFS: recovery needed
[   12.890000] UBIFS: recovery completed
[   12.900000] UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[   12.910000] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   12.930000] UBIFS: FS size: 103612416 bytes (98 MiB, 816 LEBs), journal size 5206016 bytes (4 MiB, 41 LEBs)
[   12.950000] UBIFS: reserved for root: 4893869 bytes (4779 KiB)
[   12.960000] UBIFS: media format: w4/r0 (latest is w4/r0), UUID D60F4AAC-41AA-43C1-9827-3B937BF6AF51, small LPT model
[   12.980000] mount_root: switching to jffs2 overlay

Is there any RootFS generated ??
Any Wiki page for Flash layout ??

elektroman wrote:

Is there any RootFS generated ??

Maybe some misunderstood.
From "Bad" log:

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

From "Good" log:

[    6.290000] UBI: ubiblock0_0 created from ubi0:0(rootfs)
[    6.290000] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[    6.290000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    6.340000] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.

The only difference in sources for this two firmware is aligning ubi partition to start address 0x0340000 for "good" boot in two sorce files:
/target/linux/ramips/image/mt7621.mk
/target/linux/ramips/dts/WF-2881.dts

grayelf wrote:
elektroman wrote:

Is there any RootFS generated ??

Maybe some misunderstood.

I know ...
I've build for a NAS System some LaCie device a firmware some time before.
I know they build also the RootFS for NAND Flash.
Also I've done some test build on my compile BOX to be sure, for a quick look I don't see any RooftFS Image for NAND.

Normally you get for NAND devices *two* images kernel and RootFS.

What version is busybox while you can boot normally ??

PKG_VERSION:=1.24.2

This is the latest version in openWRT

elektroman wrote:

What version is busybox while you can boot normally ??

Both images, normal and broken has 1.24.2-1.

Package: busybox
Version: 1.24.2-1
Depends: libc
Status: install user installed
Section: base
Essential: yes
Architecture: ramips
Maintainer: Felix Fietkau <nbd@nbd.name>
MD5Sum: ba7304c0844d5127c7fe9762be1b1ef7
Size: 203369
Filename: busybox_1.24.2-1_ramips.ipk
Source: package/utils/busybox
Description: The Swiss Army Knife of embedded Linux.
 It slices, it dices, it makes Julian Fries.
Installed-Time: 1484229447
diizzy wrote:

Is it also non-working on LEDE?

Yes, not working.
I built lede from trunk.After first reboot - bootloop

[    2.680000] 5 ofpart partitions found on MTD device MT7621-NAND
[    2.690000] Creating 5 MTD partitions on "MT7621-NAND":
[    2.700000] 0x000000000000-0x000000030000 : "u-boot"
[    2.710000] 0x000000030000-0x000000031000 : "u-boot-env"
[    2.720000] 0x000000080000-0x000000100000 : "config"
[    2.730000] 0x000000100000-0x000000140000 : "factory"
[    2.740000] 0x000000140000-0x000007f80000 : "firmware"
[    4.500000] 2 uimage-fw partitions found on MTD device firmware
[    4.520000] 0x000000140000-0x0000002c0000 : "kernel"
[    4.530000] 0x0000002c0000-0x000007f80000 : "ubi"
[    4.540000] [mtk_nand] probe successfully!
[    4.550000] Signature matched and data read!
[    4.550000] load_fact_bbt success 1023
[    4.560000] netif_napi_add() called with weight 128 on device eth%d
[    4.590000] libphy: mdio: probed
[    5.990000] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    6.000000] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 10
[    6.020000] mt7621_wdt 1e000100.wdt: Initialized
[    6.030000] NET: Registered protocol family 10
[    6.040000] NET: Registered protocol family 17
[    6.050000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    6.080000] 8021q: 802.1Q VLAN Support v1.8
[    6.090000] UBI: auto-attach mtd6
[    6.090000] ubi0: attaching mtd6
[    7.270000] ubi0: scanning is finished
[    7.280000] ubi0 error: ubi_read_volume_table: the layout volume was not found
[    7.290000] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd6, error -22
[    7.310000] UBI error: cannot attach mtd6
[    7.310000] hctosys: unable to open rtc device (rtc0)
[    7.330000] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    7.340000] Please append a correct "root=" boot option; here are the available partitions:
[    7.360000] 1f00             192 mtdblock0  (driver?)
[    7.370000] 1f01               4 mtdblock1  (driver?)
[    7.380000] 1f02             512 mtdblock2  (driver?)
[    7.390000] 1f03             256 mtdblock3  (driver?)
[    7.400000] 1f04          129280 mtdblock4  (driver?)
[    7.410000] 1f05            1536 mtdblock5  (driver?)
[    7.420000] 1f06          127744 mtdblock6  (driver?)
[    7.430000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    7.440000] Rebooting in 1 seconds..

After replacing code, like in my first post,  boots good:

[    2.680000] Creating 7 MTD partitions on "MT7621-NAND":
[    2.690000] 0x000000000000-0x000000030000 : "u-boot"
[    2.700000] 0x000000030000-0x000000031000 : "u-boot-env"
[    2.710000] 0x000000080000-0x000000100000 : "config"
[    2.720000] 0x000000100000-0x000000140000 : "factory"
[    2.740000] 0x000000140000-0x000007000000 : "firmware"
[    4.280000] 2 uimage-fw partitions found on MTD device firmware
[    4.300000] 0x000000140000-0x000000340000 : "kernel"
[    4.310000] 0x000000340000-0x000007000000 : "ubi"
[    4.320000] 0x000000140000-0x000000340000 : "kernel"
[    4.330000] 0x000000340000-0x000007000000 : "ubi"
[    4.340000] [mtk_nand] probe successfully!
[    4.350000] Signature matched and data read!
[    4.360000] load_fact_bbt success 1023
[    4.360000] netif_napi_add() called with weight 128 on device eth%d
[    4.390000] libphy: mdio: probed
[    5.800000] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    5.810000] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 10
[    5.830000] mt7621_wdt 1e000100.wdt: Initialized
[    5.840000] NET: Registered protocol family 10
[    5.850000] NET: Registered protocol family 17
[    5.860000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    5.880000] 8021q: 802.1Q VLAN Support v1.8
[    5.890000] UBI: auto-attach mtd6
[    5.900000] ubi0: attaching mtd6
[    6.240000] mtk_soc_eth 1e100000.ethernet eth0: port 4 link up
[    6.920000] ubi0: scanning is finished
[    6.950000] ubi0: attached mtd6 (name "ubi", size 108 MiB)
[    6.960000] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    6.970000] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    6.980000] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    7.000000] ubi0: good PEBs: 866, bad PEBs: 4, corrupted PEBs: 0
[    7.010000] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    7.020000] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 601498287
[    7.040000] ubi0: available PEBs: 0, total reserved PEBs: 866, PEBs reserved for bad PEB handling: 16
[    7.060000] ubi0: background thread "ubi_bgt0d" started, PID 330
[    7.070000] block ubiblock0_0: created from ubi0:0(rootfs)
[    7.080000] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[    7.100000] hctosys: unable to open rtc device (rtc0)
[    7.110000] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.

The discussion might have continued from here.