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)
- Put stock firmware bin into USB memory
- In serial console, interrupt boot proccess in U-Boot, and enter U-boot command shell
ls usb 0:1
to find the stock firmware binfatload usb 0:1 $loadaddr firmware.bin
to load firmwarenand info
? use this one to find out last address (mine was 0x8000000 I think)- Use
nand erase [blockname]
command to erase all blocks (like bl2, uboot…) (ornand erase 0x0 0x8000000
could work too) nand write $loadaddr 0 0x8000000
- 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
Thanks for documenting this. Wrapping up for others that need it
-
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
-
Boot from EMMC, and get into the uboot command shell.
-
usb start
-
ls usb 0:1 – Your File (Image.bin) should show up
-
fatload usb 0:1 $loadaddr image.bin
-
nand erase 0x0 0x8000000
-
nand write $loadaddr 0 0x8000000
-
Boot to Nand now working.
Can i flash image from ssh without USB Serial ? Like use image from /tmp for flash ?
You have no ssh in uboot…you need uart to get into uboot and then you either boot a linux-kernel with initrd for flashing or you need to flash from uboot
I have flashed image from here
But after flash eMMC, switch back and flash NAND, it can be boot. But after boot device infinity restart after few seconds. Im using Quectel RM520N-GL for connect 5G, so hard cuz stock image cannot activate 5G and after flash same error. Thanks for response frank-wI’d like to recommend checking out the ImmortalWrt
If you want to flash to nand, then emmc needs to be able to boot to openwrt/debian/archlinux. From there you can flash with ssh to nand.
Or boot openwrt/debian/archlinux from nand and then flash emmc with ssh.
Looks like its been a while, couldnt be sure the same problem, please feel to suggest another/new thread: If we flash the upstream OpenWrt emmc image to R3Mini, it works fine with emmc boot, however fails to boot from NAND. I see some messages related to flashing to NAND at uboot stage (from usb or tftd), but couldnt be sure.
How can we make NAND bootable again, preferably with current OpenWrt NAND image? but BPI stock images are also fine.
Thanks for this write up. I am trying to reflash my NAND, but I can’t seem to read the exFat file system on my USB drive.
I am able to enter uboot, start usb and scan devices. I can see the usbstick, but ls usb 0:1 does not list the files that should be there.
Any ideas?
MT7986> usb dev
IDE device 0: Vendor: PNY Rev: 1100 Prod: USB 2.0 FD Type: Removable Hard Disk Capacity: 7788.3 MB = 7.6 GB (15950592 x 512) MT7986> usb part
Partition Map for USB device 0 – Partition Type: DOS
Part Start Sector Num Sectors UUID Type 1 2048 15947776 9ee80019-01 07 MT7986> ls usb 0:1
Exfat is not supported by uboot…use fat16/fat32
Ok. So playing around with help I ended up with ext4 for the file system and was able to reflash my NAND.
Here is the weird bit.
I had tried flashing OpenWRT 24 onto EMMC prior to my NAND going down…I was able to boot to it, but it quit working after a couple of days and I was left with a bricked device.
Once I recovered NAND, I tried GoldenOrb for EMMC. Same thing. It worked great for like 2 days and then whammo…Wifi and the like just stopped working…and NAND was once again corrupted.
For funsies, I tried booting to the recovery in EMMC…only to discover that was my old OpenWRT 24 build.
I have restored NAND once more. Advice on moving forward?
I would like to run latest OpenWRT or GoldenOrb on EMMC…but don’t want to keep corrupting the NAND disk?
Thanks
MT7986> nand info ‘spi-nand0’ is now active device
- spi-nand0
- device: spi_nand@0
- parent: spi@1100a000
- driver: spi_nand
- type: NAND flash
- block size: 0x20000 bytes
- page size: 0x800 bytes
- OOB size: 64 bytes
- OOB available: 24 bytes
- 0x000000000000-0x000008000000 : “spi-nand0” - 0x000000000000-0x000000200000 : “bl2” - 0x000000200000-0x000008000000 : “ubi”
After I flash EMMC, when I boot to NAND, this is what I see:
F0: 102B 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 2400 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [1000]
T0: 0000 021E [010F]
Jump to BL
NOTICE: BL2: v2.6(release):
NOTICE: BL2: Built : 20:18:14, May 7 2023
NOTICE: WDT: disabled
NOTICE: CPU: MT7986 (2000MHz)
NOTICE: EMI: Using DDR4 settings
NOTICE: EMI: Detected DRAM size: 2048MB
NOTICE: EMI: complex R/W mem test passed
NOTICE: SPI_NAND parses attributes from parameter page.
NOTICE: SPI_NAND Detected ID 0xef
NOTICE: Page size 2048, Block size 131072, size 134217728
NOTICE: Initializing NMBM ...
NOTICE: NMBM management region starts at block 960 [0x07800000]
NOTICE: NMBM has been initialized in read-only mode
ERROR: BL2: Failed to load image id 3 (-2)
I guess your nand has bpi-openwrt,right? At least bl2 seems old and where bpi bl2 use propritary nmbm and maybe fixed offset to search for fip openwrt does use ubi. So maybe your nand is good again when flashing openwrt bl2 to your nand (should be offset 0x0).