After update OpenWRT, no boot from nand possible

After updating the Banana Pi R3mini on eMMC as decribed in OpenWrt-Wiki, the device does not longer boot from NAND.

Now i booted from UART while switch is set to eMMC.  I tried:
mtd write /mnt/usb/openwrt-24.10.3-mediatek-filogic-bananapi_bpi-r3-mini-snand-preloader.bin /dev/mtd0
Could not open mtd device: /dev/mtd0
Can't open device for writing!

What is to do, that the device can boot from nand again?

You can give it a try based on this.

I tried it as described in the articel. On first command it fails already.

mtd erase /dev/mtd0
Could not open mtd device: /dev/mtd0
Could not open mtd device: /dev/mtd0

In the referenced article i read: P.S.: in case write to MTD results in error, apply the following insmod mtd-rw.ko i_want_a_brick=1

If i do this, i got:

insmod mtd-rw.ko i_want_a_brick=1 
Failed to find mtd-rw. Maybe it is a built in module ?

I booted from eMMC (obviously…):

This is the current version.

cat /etc/os-release 
NAME="OpenWrt"
VERSION="24.10.3"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 24.10.3"
VERSION_ID="24.10.3"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r28872-daca7c049b"
OPENWRT_BOARD="mediatek/filogic"
OPENWRT_ARCH="aarch64_cortex-a53"
OPENWRT_TAINTS=""
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 24.10.3 r28872-daca7c049b"
OPENWRT_BUILD_DATE="1758316778"

I installed the kmod-mtd-rw module

opkg install kmod-mtd-rw

Erase /dev/mtd0 works so far.

mtd erase /dev/mtd0
Unlocking /dev/mtd0 ...
Erasing /dev/mtd0 ...

Here i am stuck again:

dd if=/tmp/mtk-bpi-r3mini-NAND-20231115-single-image.bin of=/dev/mtdblock0 
[  716.305518] mtdblock: MTD device 'bl2' is NAND, please consider using UBI block devices instead.
dd: error writing '/dev/mtdblock0': Operation not permitted
1+0 records in
0+0 records out

Now i didi it as described in the Link, mentioned in the first post. Thank you for advice and guidance!

You could use U-Boot commands to write to mtd0.

In U-Boot mtd0 is not write protected

In the firmware which is active there is no menu entry “U-Boot / U-Boot Console”. I also tried the mtk_uartboot. I was able to boot this, but for this i am overstrained. The necessary skils do i not have. I have to develop this.

I was able to fix this. I switched Bootdevice to eMMC, installed the kmod-mtd-rw. After that i proceed as described in this link OpenWRT-Wiki

#### Installation instructions for NAND
mtd write /tmp/openwrt-*-bananapi_bpi-r3-mini-snand-preloader.bin /dev/mtd0
ubidetach -m 1
ubiformat /dev/mtd1
ubiattach -m 1
volsize=$(wc -c < /tmp/openwrt-*-bananapi_bpi-r3-mini-snand-bl31-uboot.fip)
ubimkvol /dev/ubi0 -N fip -n 0 -s $volsize -t static
ubiupdatevol /dev/ubi0_0 /tmp/openwrt-*-bananapi_bpi-r3-mini-snand-bl31-uboot.fip
cd /lib/firmware/airoha
cat EthMD32.dm.bin EthMD32.DSP.bin > /tmp/en8811h-fw.bin
ubimkvol /dev/ubi0 -N en8811h-firmware -n 1 -s 147456 -t static
ubiupdatevol /dev/ubi0_1 /tmp/en8811h-fw.bin
ubimkvol /dev/ubi0 -n 2 -N ubootenv -s 126976
ubimkvol /dev/ubi0 -n 3 -N ubootenv2 -s 126976
volsize=$(wc -c < /tmp/openwrt-*-bananapi_bpi-r3-mini-initramfs-recovery.itb)
ubimkvol /dev/ubi0 -n 4 -N recovery -s $volsize
ubiupdatevol /dev/ubi0_4 /tmp/openwrt-*-bananapi_bpi-r3-mini-initramfs-recovery.itb
volsize=$(wc -c < /tmp/openwrt-*-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb)
ubimkvol /dev/ubi0 -n 5 -N fit -s $volsize
ubiupdatevol /dev/ubi0_5 /tmp/openwrt-*-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb

Now the NAND is restored and i promise never to touch it again. Lessons learned! :slight_smile: I wnat to thank all of you, every single hint or answer helped me to get further.

I have a uartboot binary that boots directly to linux, if you would ever need it.

https://ftp.woudstra.mywire.org/uartboot/

Dear Eric,

that is a generous offer! Thank you for this kind support. I downloaded the files already.