Good afternoon, thank you as well. If you ever upgrade to the pro version, I’d be happy to try your image.
Best regards
Good afternoon, thank you as well. If you ever upgrade to the pro version, I’d be happy to try your image.
Best regards
Please do not hijack this thread which is for r4 and nand errors
Hi Frank,
Here are the NAND/ubi/mtd references in the boot log,
000 [0x411fd090]
[ 0.000000] Linux version 6.12.85 (builder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 14.3.0 r32912-6639b15f62) 14.3.0, GNU ld (GNU Binutils) 2.44) #0 SMP Mon May 4 22:30:45 2026
[ 0.000000] Machine model: Banana Pi BPI-R4 (2x SFP+)
[ 0.000000] OF: reserved mem: 0x0000000042ff0000..0x0000000042ffffff (64 KiB) map non-reusable ramoops@42ff0000
[ 0.000000] OF: reserved mem: 0x0000000043000000..0x000000004304ffff (320 KiB) nomap non-reusable secmon@43000000
[ 0.000000] OF: reserved mem: 0x0000000047cc0000..0x0000000047dbffff (1024 KiB) nomap non-reusable wmcpu-reserved@47cc0000
[ 0.000000] OF: reserved mem: 0x000000004f600000..0x000000004f63ffff (256 KiB) nomap non-reusable wo-emi@4f600000
[ 0.000000] OF: reserved mem: 0x000000004f640000..0x000000004f67ffff (256 KiB) nomap non-reusable wo-emi@4f640000
[ 0.000000] OF: reserved mem: 0x000000004f680000..0x000000004f6bffff (256 KiB) nomap non-reusable wo-emi@4f680000
[ 0.000000] OF: reserved mem: 0x000000004f700000..0x000000004fefffff (8192 KiB) nomap non-reusable wo-data@4f700000
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000040000000-0x00000000ffffffff]
[ 0.000000] DMA32 empty
[ 0.000000] Normal [mem 0x0000000100000000-0x000000013fffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000040000000-0x0000000042ffffff]
[ 0.000000] node 0: [mem 0x0000000043000000-0x000000004304ffff]
[ 0.000000] node 0: [mem 0x0000000043050000-0x0000000047cbffff]
[ 0.000000] node 0: [mem 0x0000000047cc0000-0x0000000047dbffff]
[ 0.000000] node 0: [mem 0x0000000047dc0000-0x000000004f5fffff]
[ 0.000000] node 0: [mem 0x000000004f600000-0x000000004f6bffff]
[ 0.000000] node 0: [mem 0x000000004f6c0000-0x000000004f6fffff]
[ 0.000000] node 0: [mem 0x000000004f700000-0x000000004fefffff]
[ 0.000000] node 0: [mem 0x000000004ff00000-0x000000013fffffff]
.
.
.
[ 0.000000] Kernel command line: console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 rootwait ubi.block=0,fit
.
.
.
[ 0.040864] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
.
.
.
[ 1.160191] spi-nand spi0.0: Winbond SPI NAND was found.
[ 1.165541] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
[ 1.174019] 2 fixed-partitions partitions found on MTD device spi0.0
[ 1.180512] Creating 2 MTD partitions on "spi0.0":
[ 1.185308] 0x000000000000-0x000000200000 : "bl2"
[ 1.191341] 0x000000200000-0x000008000000 : "ubi"
[ 1.265400] ubi0: default fastmap pool size: 50
[ 1.269926] ubi0: default fastmap WL pool size: 25
[ 1.274715] ubi0: attaching mtd1
[ 1.623231] ubi0: scanning is finished
[ 1.630982] ubi0: attached mtd1 (name "ubi", size 126 MiB)
[ 1.636463] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 1.643330] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 1.650107] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 1.657060] ubi0: good PEBs: 1008, bad PEBs: 0, corrupted PEBs: 0
[ 1.663152] ubi0: user volume: 7, internal volumes: 1, max. volumes count: 128
[ 1.670362] ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
[ 1.678702] ubi0: available PEBs: 0, total reserved PEBs: 1008, PEBs reserved for bad PEB handling: 40
[ 1.688001] ubi0: background thread "ubi_bgt0d" started, PID 295
[ 1.688470] block ubiblock0_4: created from ubi0:4(fit)
.
.
.
[ 3.358672] FIT: Detected U-Boot 2025.10-OpenWrt-r32912-6639b15f62
[ 3.364853] FIT: Selected configuration: "config-mt7988a-bananapi-bpi-r4" (OpenWrt bananapi_bpi-r4)
[ 3.373896] FIT: kernel sub-image 0x00001000..0x0059c5da "kernel-1" (ARM64 OpenWrt Linux-6.12.85)
[ 3.383718] FIT: flat_dt sub-image 0x0059d000..0x005a7bc7 "fdt-1" (ARM64 OpenWrt bananapi_bpi-r4 device tree blob)
[ 3.394929] FIT: flat_dt sub-image 0x005a8000..0x005a85fd "fdt-mt7988a-bananapi-bpi-r4-emmc" (ARM64 OpenWrt bananapi_bpi-r4 device tree overlay mt7988a-bananapi-bpi-r4-emmc)
[ 3.411261] FIT: flat_dt sub-image 0x005a9000..0x005a911c "fdt-mt7988a-bananapi-bpi-r4-rtc" (ARM64 OpenWrt bananapi_bpi-r4 device tree overlay mt7988a-bananapi-bpi-r4-rtc)
[ 3.427417] FIT: flat_dt sub-image 0x005aa000..0x005aa5b5 "fdt-mt7988a-bananapi-bpi-r4-sd" (ARM64 OpenWrt bananapi_bpi-r4 device tree overlay mt7988a-bananapi-bpi-r4-sd)
[ 3.443399] FIT: flat_dt sub-image 0x005ab000..0x005ad0ca "fdt-mt798
8a-bananapi-bpi-r4-wifi-be14" (ARM64 OpenWrt bananapi_bpi-r4 device tree overlay mt7988a-bananapi-bpi-r4-wifi-be14)
[ 3.460593] FIT: filesystem sub-image 0x005ae000..0x01547fff "rootfs-1" (ARM64 OpenWrt bananapi_bpi-r4 rootfs)
[ 3.471424] block ubiblock0_4: mapped 1 uImage.FIT filesystem sub-image as /dev/fit0
.
.
.
[ 9.343728] UBIFS (ubi0:6): Mounting in unauthenticated mode
[ 9.349452] UBIFS (ubi0:6): background thread "ubifs_bgt0_6" started, PID 1014
[ 9.368243] UBIFS (ubi0:6): recovery needed
[ 9.446086] UBIFS (ubi0:6): recovery completed
[ 9.450557] UBIFS (ubi0:6): UBIFS: mounted UBI device 0, volume 6, name "rootfs_data"
[ 9.458381] UBIFS (ubi0:6): LEB size: 126976 bytes (124 KiB), min./max. I/O u
nit sizes: 2048 bytes/2048 bytes
[ 9.468285] UBIFS (ubi0:6): FS size: 70344704 bytes (67 MiB, 554 LEBs), max 564 LEBs, journal size 3555328 bytes (3 MiB, 28 LEBs)
[ 9.479924] UBIFS (ubi0:6): reserved for root: 3322554 bytes (3244 KiB)
[ 9.486530] UBIFS (ubi0:6): media format: w5/r0 (latest is w5/r0), UUID 4048392B-2587-4920-9C8C-98A3D0B86C67, small LPT model
[ 9.499830] mount_root: switching to ubifs overlay
[ 9.507392] overlayfs: null uuid detected in lower fs '/', falling back to xino=off,index=off,nfs_export=off.
Appreciate your time!
Then it would seem your ATF is build with the wrong NAND_TYPE
Hmm. I downloaded the OpenWRT files from the BPR4 firmware page,
https://firmware-selector.openwrt.org/?version=25.12.3&target=mediatek%2Ffilogic&id=bananapi_bpi-r4
I will try the previous release and see if this solves the issue, if indeed it is the firmware.
What I meant only involves bl2. So it would be enough to overwrite that only. See if it helps if you find one that has 128MB Nand instead of 256GB.
You linux nand detection says it is 256MB,but later it tells about 128Mb ubi partition (due to default bpi-r4 default size of 128MB)…this is not possible…ubi needs to be till end of nand.
Which image/source do you use? Please make sure you have the right nand chip matching your image config. Maybe somehow you really have a 256Mb nand and if this is true you have to change source in at least linux to initialize the ubi till end of nand.
Guess it is best to check the numbers on the chip and be sure which Nand chip size you have.
So then we know which of ATF/U-boot/linux needs to be corrected.
No
which board is this exactly (maybe one of the 8G variants phy/2sfp)?
which image/source do you use?
Which image/source do you use?
I’ve used the BPR4 firmware builder,
https://firmware-selector.openwrt.org/?version=25.12.2&target=mediatek%2Ffilogic&id=bananapi_bpi-r4
So far I’ve tried flashing 25.12.3 and 25.12.2, the 2 most recent images.
I’ll mention the following, though it shouldn’t impact our discussion, I’m using the SDcard image, and I’m downloading a small suite of packages like luci, lsblk etc.
mhm, using the image-builder makes it hard fixing this as you cannot change dts-code here.
which exact board do you have? we need to find a way to select the nand size somehow
Yes it is the 8G DDR variant with 2 sfp ports.
ok, are you able to compile image yourself?
basicly this part has to be changed in linux:
&spi_nand {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
...
partition@200000 {
compatible = "linux,ubi";
reg = <0x200000 0xfe00000>;
label = "ubi";
};
};
maybe we can do it via overlay in openwrt, @dangowrt what do you think? as far as i see the mainline dts only defined the bl2 partition, so ubi seems to be added only in openwrt
something like this:
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
* Copyright (C) 2025 MediaTek Inc.
* Author: Frank Wunderlich <[email protected]>
*/
/* This updates NAND size to 256MB on BPI-R4-8G */
/dts-v1/;
/plugin/;
/ {
compatible = "bananapi,bpi-r4", "mediatek,mt7988a";
};
&{/soc/spi@11007000/flash@0/partitions/partition@200000} {
reg = <0x200000 0xfe00000>;
};
I’m happy to update the source and compile, but I would likely need some help. I’ve compiled simple things for my desktop but setting the complier up for NAND is next level.
I’m up for it, but I’d need some resources and likely some message board support. That kind of thing…
What are the risks? I don’t want to brick the device.
imho there are no risks if you select the right board in openwrt, basicly clone openwrt source and install all needed packages in your build-host, the run “make menuconfig” and select the right board (Target System (MediaTek ARM), Subtarget (Filogic 8x0 (MT798x)), Target Profile (Bananapi BPi-R4)). let it compile completely and for quick test modify source and recompile
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/linux-6.18.28/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
&spi_nand {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bl2";
reg = <0x0 0x200000>;
read-only;
};
partition@200000 {
label = "ubi";
reg = <0x200000 0x7e00000>; //change this to <0x200000 0xfe00000>;
compatible = "linux,ubi";
If the device tree overlay is enough, my method, which I am using with the vanilla OpenWrt to add extra LEDs and to modify the CPU VRM to always-on (instead of only boot-on) to prevent turning off the power, is working fine without needing anything to recompile.
I simply created a “magic_bootm” variable in UBoot which contains all the required things which I mentioned in the post, then replaced the bootm command with the execution of the “magic_bootm” in the “boot_production”.
Yes yes yes, It worked.
[ 1.185065] spi-nand spi0.0: Winbond SPI NAND was found.
[ 1.190381] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
.
.
.
[ 1.903846] ubi0: attached mtd1 (name "ubi", size 254 MiB)
[ 1.909328] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 1.916199] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 1.922974] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 1.929927] ubi0: good PEBs: 2032, bad PEBs: 0, corrupted PEBs: 0
… at 254MB I’m still 2M shy of 256… but no more messages.
FWIW, the “Bad EC magic in block” messages appeared after the first boot, but the next boot went off without a hitch.
Thanks to you Frank, and to @ericwoud… and @czo for your suggestion… and @Xiaomi_ax3600 - I hope you are able to resolve your issue.
@frank-w or whoever. Should I submit an issue with OpenWRT? Be nice to have any future updates work for people with my species of board “out of the box”.