[Solved] Wrong flash size R5010UNv2

Years ago I built a firmware (Bleeding Edge, r49395) for the R5010UNv2 device. I thought it was time to upgrade so I started to build a shiny new image.
I checked out openwrt-18.06, compiled, flashed and... it didn't boot. When I decided to leave out packages to find out which was responsible, I discovered the problem was the flash size. Somehow half of the flash seems to be ignored. The device has 16M flash, only 8M seem to be available. With a firmware of almost 8MB the device produces this kind of errors:

[   14.206274] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[   53.716004] jffs2: Too few erase blocks (2)

As you understand I am not a real developer althought I know how to build a firmware thanks to openwrt.
Can anybody tell me why this is happening?
In target/linux/brcm63xx/image/bcm63xx.mk the FLASH_MB is perfectly set to 16. I don't know were else to look.

Thanks Jeff!
It took me some time to understand what you sent and I don't know if I do now.
Does this mean that there is 7F0000-10000=7E0000 (8257536) bytes space for jffs2?
This could explain what's happening. But, if so, then why is more than half of the flash unused? It was used completely in Bleeding Edge.
Can I change this? With a patch or changing this file in my build environment?

It’s possible there was a transcription error in converting to DTS. You might be the first to notice it.

I believe that's the space for the kernel, ROM, and overlay.

I don't know what is in the "nvram" section, or even if it is at that location, or at the top of your 16 MB flash. If it's something critical, it would have to be relocated if in the middle, and referenced in the DTS one way or another.

Do you have a boot log from the older firmware?

(Yes, should be possible to “fix” in a from-source build.)

Hi, the dts files were adopted long time ago in brcm63xx. But BCM6328 still used partition autodetection. The transition to fixed partitions caused the error, not sure when this change was made . I'll send a patch in next hours for this board

--- a/target/linux/brcm63xx/dts/r5010unv2.dts
+++ b/target/linux/brcm63xx/dts/r5010unv2.dts
@@ -95,13 +95,13 @@
 			};
 
 			linux@10000 {
-				reg = <0x010000 0x7e0000>;
+				reg = <0x010000 0xfe0000>;
 				label = "linux";
 				compatible = "brcm,bcm963xx-imagetag";
 			};
 
-			nvram@7f0000 {
-				reg = <0x7f0000 0x010000>;
+			nvram@ff0000 {
+				reg = <0xff0000 0x010000>;
 				label = "nvram";
 			};
 		};

Regards

1 Like

Thank you both for your help. It's solved with Daniel's patch. The missing flash space is back. Phew :slightly_smiling_face:
Here is the relevant part of the Bleeding Edge (r49395) boot log if you're still interested:

root@nucom:~# dmesg | grep -i -e linux -e jffs -e partition -e nvram -e cfe -e mtd 
-e rootfs -e kernel
[    0.000000] Linux version 4.1.23 (user@host) (gcc version 5.3.0 (OpenWrt GCC 5.3.0 r49395) ) #3 Fri May 17 15:36:53 UTC 2019
[    0.000000] board_bcm963xx: CFE version: 1.0.37-106.24
[    0.000000] Kernel command line:  root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200
[    0.000000] Memory: 59328K/65536K available (3118K kernel code, 137K rwdata, 768K rodata, 1280K init, 197K bss, 6208K reserved, 0K cma-reserved)
[    0.543727] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.619419] bcm63xxpart: CFE boot tag found with version 6 and board type 96328ang
[    0.627309] bcm63xxpart: Partition 0 is CFE offset 0 and length 10000
[    0.633946] bcm63xxpart: Partition 1 is kernel offset 10100 and length 14a678
[    0.641273] bcm63xxpart: Partition 2 is rootfs offset 15a778 and length e95888
[    0.648699] bcm63xxpart: Partition 3 is nvram offset ff0000 and length 10000
[    0.655954] bcm63xxpart: Partition 4 is linux offset 10000 and length fe0000
[    0.663210] 5 bcm63xxpart partitions found on MTD device spi1.0
[    0.669300] Creating 5 MTD partitions on "spi1.0":
[    0.674246] 0x000000000000-0x000000010000 : "CFE"
[    0.680960] 0x000000010100-0x00000015a778 : "kernel"
[    0.687851] 0x00000015a778-0x000000ff0000 : "rootfs"
[    0.694743] mtd: device 2 (rootfs) set to be root filesystem
[    0.704318] 1 squashfs-split partitions found on MTD device rootfs
[    0.710718] 0x000000910000-0x000000ff0000 : "rootfs_data"
[    0.718081] 0x000000ff0000-0x000001000000 : "nvram"
[    0.724980] 0x000000010000-0x000000ff0000 : "linux"
[    0.912322] Freeing unused kernel memory: 1280K (80400000 - 80540000)
[   11.922782] jffs2: notice: (320) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   11.939827] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   12.028666] jffs2: notice: (315) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   12.369683] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   12.389603] mount_root: switching to jffs2 overlay
[   19.002653] Loading modules backported from Linux version v4.4-rc5-1913-gc8fdf68
[   19.329344] xt_time: kernel timezone is -0000

And with 18.06-SNAPSHOT, r7845-564d81e944 including Daniel's patch:

root@OpenWrt:~# dmesg | grep -i -e linux -e jffs -e partition -e nvram -e cfe -e mtd
 -e rootfs -e kernel
[    0.000000] Linux version 4.9.189 (user@host) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7845-564d81e944) ) #0 Sat Aug 17 15:23:17 2019
[    0.000000] board_bcm963xx: CFE version: 1.0.37-106.24
[    0.000000] Kernel command line: rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200
[    0.000000] Memory: 58920K/65536K available (3361K kernel code, 179K rwdata, 856K rodata, 1292K init, 208K bss, 6616K reserved, 0K cma-reserved)
[    0.569329] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.682298] 3 fixed-partitions partitions found on MTD device spi1.0
[    0.688878] Creating 3 MTD partitions on "spi1.0":
[    0.693806] 0x000000000000-0x000000010000 : "cfe"
[    0.702126] 0x000000010000-0x000000ff0000 : "linux"
[    0.712589] parser_imagetag: rootfs: CFE image tag found at 0x0 with version 6, board type 96328ang
[    0.721958] parser_imagetag: Partition 0 is kernel offset 100 and length 16405c
[    0.729473] parser_imagetag: Partition 1 is rootfs offset 16415c and length e7bea4
[    0.737258] parser_imagetag: Spare partition is offset 900004 and length 6dfffc
[    0.744878] 2 bcm963xx-imagetag partitions found on MTD device linux
[    0.751428] Creating 2 MTD partitions on "linux":
[    0.756255] 0x000000000100-0x00000016415c : "kernel"
[    0.764953] 0x00000016415c-0x000000fe0000 : "rootfs"
[    0.774219] mtd: device 3 (rootfs) set to be root filesystem
[    0.781175] 1 squashfs-split partitions found on MTD device rootfs
[    0.787586] 0x000000900000-0x000000fe0000 : "rootfs_data"
[    0.796654] 0x000000ff0000-0x000001000000 : "nvram"
[    0.990434] Freeing unused kernel memory: 1292K
[    0.995109] This architecture does not have kernel memory protection.
[    5.140996] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[   13.345162] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[   14.259506] jffs2: notice: (398) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   14.276756] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   14.338199] jffs2: notice: (394) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   14.647443] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   14.670692] mount_root: switching to jffs2 overlay
[   17.361591] kmodloader: loading kernel modules from /etc/modules.d/*
[   17.881488] Loading modules backported from Linux version wt-2017-11-01-0-gfe248fc2c180
[   18.144591] xt_time: kernel timezone is -0000

Thanks again for your rapid help.:+1::+1:

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

The r5010unv2.dts without this patch shows up in 19.07. Is this alright? Or does it leave half of the flash unusable again?

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.