[BPI-R4] How to get an openwrt image to eMMC?

Hello! I have been building my own version of openwrt for a while and now I have been using that with the SD image flashed to… an SD.

Now, when I build I get all of these output files:

mt7981-ram-ddr3-bl2.bin
mt7981-ram-ddr4-bl2.bin
mt7986-ram-ddr3-bl2.bin
mt7986-ram-ddr4-bl2.bin
mt7988-ram-comb-bl2.bin
openwrt-mediatek-filogic-bananapi_bpi-r4-emmc-bl31-uboot.fip
openwrt-mediatek-filogic-bananapi_bpi-r4-emmc-preloader.bin
openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb
openwrt-mediatek-filogic-bananapi_bpi-r4.manifest
openwrt-mediatek-filogic-bananapi_bpi-r4-sdcard.img.gz
openwrt-mediatek-filogic-bananapi_bpi-r4-snand-bl31-uboot.fip
openwrt-mediatek-filogic-bananapi_bpi-r4-snand-preloader.bin
openwrt-mediatek-filogic-bananapi_bpi-r4-squashfs-sysupgrade.itb

How can I install the same build first on the NAND and then on the eMMC?

Thank you!

Afair it is designed to boot the sdcard one first and then install to nand from it,then boot this and install emmc

Yeah, I tried to use the process in Getting Started BPI-R4 | BananaPi Docs assuming is the same but then I get to:

root@OpenWrt:/mnt# mtd erase /dev/mtd0
Could not open mtd device: /dev/mtd0
Could not open mtd device: /dev/mtd0
root@OpenWrt:/mnt# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00020000 "bl2"
mtd1: 07e00000 00020000 "ubi"

Any clue on what am I missing?

Do not use the bpi way here…mainline openwrt is installed using uboot menu

But if I want to boot something else in NAND and install an OpenWRT directly to emmc anyone know which is the procedure? I’m having trouble with the bl31-uboot as well. I tried with mmcblk0p4 and mmcblk0p3 without success.

dd if=openwrt-mediatek-filogic-bananapi_bpi-r4-emmc-bl31-uboot.fip of=/dev/mmcblk0p4

I’m getting:

NOTICE:  BL2: v2.13.0(release):OpenWrt v2025.07.11~78a0dfd9-1 (mt7988-emmc-comb)
NOTICE:  BL2: Built : 23:20:01, Feb  4 2026
NOTICE:  WDT: Cold boot
NOTICE:  WDT: disabled
NOTICE:  CPU: MT7988
NOTICE:  EMI: Using DDR unknown settings
NOTICE:  EMI: Detected DRAM size: 4096 MB
NOTICE:  EMI: complex R/W mem test passed
NOTICE:  LVTS: Enable thermal HW reset
NOTICE:  Located partition 'fip' at 0x680000, size 0x400000
ERROR:   io_dev_init failed for FIP image id 0 (-2)
ERROR:   Image id 3 open failed with -2
ERROR:   BL2: Failed to load image id 3 (-2)

thanks!

all these images are loaded in the sdcard - using the uboot menu you can choose an option to copy the files to the nand, and then from the nand to the emmc

if you want to change the default images names you need to change the uboot env variables or otherwise look at the package uboot-mediatek there will be patches (450-add-bpi-r4.patch) there that set the env variables for each device

Openwrt uses fip (uboot+bl3) in ubi…so you have to create an ubifs,add a partition names “fip” and then flash the fip image there

Thanks, but emmc handles the translation. I don’t think ubi is used here. ubi works well for flash memories like NAND. Regarding the boot menu that’s what I was trying to avoid. Not having to flash NAND again, and directly flash a new verison to test to EMMC. Anyways I was able to make it work with something like this:

dd if=openwrt-mediatek-filogic-bananapi_bpi-r4-emmc-gpt.bin of=/dev/mmcblk0 bs=512 count=34 conv=fsync
blockdev --rereadpt /dev/mmcblk0
echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=/dev/zero of=/dev/mmcblk0boot0 bs=512 count=8192 conv=fsync
dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=13312 count=8192 conv=fsync
dd if=openwrt-mediatek-filogic-bananapi_bpi-r4-emmc-preloader.bin of=/dev/mmcblk0boot0 conv=fsync
dd if=openwrt-mediatek-filogic-bananapi_bpi-r4-emmc-bl31-uboot.fip of=/dev/mmcblk0p3 conv=fsync
dd if=openwrt-mediatek-filogic-bananapi_bpi-r4-initramfs-recovery.itb of=/dev/mmcblk0p4 conv=fsync
dd if=openwrt-mediatek-filogic-bananapi_bpi-r4-squashfs-sysupgrade.itb of=/dev/mmcblk0p5 conv=fsync

I’ll be updating the bpi-r4 openwrt installation page with this.

Sorry,misunderstood…thought you wanted nand installation…yes for emmc it should work like you posted. Did not know that gpt binary is also available from openwrt imagebuilder to be flashed.