BPI-R3 Mini NAND flash problem

Hi all. I’m trying to restore nand on bpi r3 mini, but nothing works. I boot from emmc immortalwrt 23.05.1 and tried to reflash in two ways:

  1. Getting Started with BPI-R3 MINI - Banana Pi Wiki

insmod mtd-rw i_want_a_brick=y

mtd erase /dev/mtd0

dd if=/root/mtk-bpi-r3mini-NAND-20231116-single-image.bin of=/dev/mtdblock0

Result: dd: error writing ‘/dev/mtdblock0’ Operation not permitted

Nand boot: System halt!

  1. [BPi-R3-Mini] Review and mainline ImmortalWrt firmware support - #5 by 1715173329

I’m trying to install immortalwrt 23.05.1:

insmod mtd-rw i_want_a_brick=y

mtd erase bl2

mtd write immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-preloader.bin bl2

mtd erase fip

mtd write immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-bl31-uboot.fip fip

Result: all ok

NAND boot: System halt!

Can anyone help me? how to flash nand?

You need flash in the BananaPi OpenWrt

Yes You need recovery to original firmware

https://wiki.banana-pi.org/Banana_Pi_BPI-R3_Mini

Thanks, I know that, but how? flashing via dd gives an error, what should I do?

You need recovery emmc to original firmware

then flash nand in original firmware on emmc

@Mashiro this advice is completely useless, to update emmc you need to boot into nand, but it doesn’t work.

I tried to upload bl2 and fit from immortalwrt with the re-creation of the ubi partition and got the error from the screenshot.

I think can flash emmc from ram?(/tmp)

This is written about in the link: https://wiki.banana-pi.org/Getting_Started_with_BPI-R3_MINI

Because BPI-R3 MINI can’t support that it boot from SD, So the factory will flash one default image into Nand and EMMC Device. Anytime please confirm that one EMMC or Nand device include one bootable image, it’s very important!!

Flashing both at the same time is a very bad idea…boot from one and flash the other. Then boot the other and flash the first one. Else you can end of none bootable and you cannot get the device running again

@frank-w, hi, can you give me some advice on how to restore stock firmware on nand? Maybe upload dumps to mtd0-4? or flash it somehow from u-boot?

Thanks in advance.

I did it manually on r3 this way:

https://wiki.fw-web.de/doku.php?id=en:bpi-r3:uboot#nand_flash

R3mini should have same layout on nand,you only need to get files from usb or tftp (but i guess uboot does not support the airoha phy yet)

Make sure you erase the blocks first and then write the bl2/fip then you should be able to boot from nand till uboot and you can load linux kernel

My solution when I tried to restore to stock from immortalwrt (If ImmortalWrt’s U-boot is still accesible)

  1. Put stock firmware bin into USB memory
  2. In serial console, interrupt boot proccess in U-Boot, and enter U-boot command shell
  3. ls usb 0:1 to find the stock firmware bin
  4. fatload usb 0:1 $loadaddr firmware.bin to load firmware
  5. nand info? use this one to find out last address (mine was 0x8000000 I think)
  6. Use nand erase [blockname] command to erase all blocks (like bl2, uboot…) (or nand erase 0x0 0x8000000 could work too)
  7. nand write $loadaddr 0 0x8000000
  8. Reboot to NAND

I didn’t write down the my solution when I recover my R3 Mini. so please check the proper command usage. The point was, ERASE NAND FIRST and write as much as NAND’s size

@frank-w @windows10 Thank you very much, your advice helped, and I restored it.

Thanks for documenting this. Wrapping up for others that need it

  1. Get the Single NAND Image and place on a ext-fat drive. — referenced below as image.bin — Official BPI-R3-Mini Files → 2023-11-15 BPI-R3 Mini OpenWRT image with MTK Driver, Not Opensource - Google Drive

  2. Boot from EMMC, and get into the uboot command shell.

  3. usb start

  4. ls usb 0:1 – Your File (Image.bin) should show up

  5. fatload usb 0:1 $loadaddr image.bin

  6. nand erase 0x0 0x8000000

  7. nand write $loadaddr 0 0x8000000

  8. Boot to Nand now working.