[BPi-R3-Mini] Review and mainline ImmortalWrt firmware support

BananaPi BPi-R3 Mini is powered by MediaTek 830 (4x A53 up to 2.0 GHz), with 2x 2.5 GbE, AX4200 2.4G/5G wireless, and a USB 2.0 port. It also has two M.2 connectors can be used for NVMe SSD and 5G module (Nano SIM slot included on board).

This would be a good choice to use as a portable mini router and CPE.
With Mediatek PPE engine, you can reach to 2.5 Gb with zero cpu usage.
The SoC is also fast enough to handle en/decryption operations over gigabit networks (for aes-128-gcm it’s about to 1440 Mbps).

With the boot switch toggle, it’s also suitable for those who are new to OpenWrt/Mediatek and interested in it. The physical A/B slot design can help you recovery the system easily.

Unfortunately, there’s only one USB 2.0 port (3.0 PHY is taken by the M.2 connectors).

Highlights:

  SoC: MediaTek MT7986A 4x A53
  Flash: 128MB SPI-NAND, 8GB eMMC
  RAM: 2GB DDR4
  Ethernet: 2x 2.5GbE
  WiFi: MediaTek MT7976C 2x2 2.4G + 3x3 5G
  Interface: M.2 B-Key, M.2 M-Key, Nano SIM slot, USB 2.0
  LED: Power, Status, WLAN2G, WLAN5G, LTE, SSD
  Button: Reset, Boot switch
  Power: 12V Type-C PD
  Size: 65x65mm


ImmortalWrt has recently added support for this board, all basic features are working.

You can download the prebuilt firmware at: https://firmware-selector.immortalwrt.org/?version=SNAPSHOT&target=mediatek%2Ffilogic&id=bananapi_bpi-r3-mini

  • Note:
    1. LuCI is not included in snapshot builds by default.
    2. Make sure the initramfs file is named as immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-initramfs-recovery.itb.
    3. For TFTP recovery, you need to connect your PC to WAN port (close to edge)*.

eMMC Flash instructions:

  1. SSH to BPi-R3 Mini, and upload all necessary firmware:
    emmc-gpt.bin, emmc-preloader.bin, emmc-bl31-uboot.fip
  2. Write new GPT table:
    dd if=immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-emmc-gpt.bin of=/dev/mmcblk0 bs=512 seek=0 count=34 conv=fsync
    
  3. Erase and write new BL2:
    echo 0 > /sys/block/mmcblk0boot0/force_ro
    dd if=/dev/zero of=/dev/mmcblk0boot0 bs=512 count=8192 conv=fsync
    dd if=immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-emmc-preloader.bin of=/dev/mmcblk0boot0 bs=512 conv=fsync
    
  4. Erase and write new FIP:
    dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=13312 count=8192 conv=fsync
    dd if=immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-emmc-bl31-uboot.fip of=/dev/mmcblk0 bs=512 seek=13312 conv=fsync
    
  5. Set static IP on your PC:
    IP 192.168.1.254/24, GW 192.168.1.1
  6. Serve ImmortalWrt initramfs image using TFTP server.
  7. Cut off the power and re-engage, wait for TFTP recovery to complete.
  8. After ImmortalWrt has booted, perform sysupgrade.
  9. Additionally, if you want to have eMMC recovery boot feature:
    (Don’t worry! You will always have TFTP recovery boot feature.)
    dd if=immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-initramfs-recovery.itb of=/dev/mmcblk0p4 bs=512 conv=fsync
    

NAND Flash instructions:

  1. SSH to BPi-R3 Mini, and upload all necessary firmware:
    mtd-rw-a53-5.4.ko, snand-preloader.bin, snand-bl31-uboot.fip
  2. Erase and write new BL2:
    insmod mtd-rw-a53-5.4.ko i_want_a_brick=y
    mtd erase BL2
    mtd write immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-preloader.bin BL2
    
  3. Erase and write new FIP:
    mtd erase FIP
    mtd write immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-bl31-uboot.fip FIP
    
  4. Set static IP on your PC: IP 192.168.1.254/24, GW 192.168.1.1
  5. Serve ImmortalWrt initramfs image using TFTP server.
  6. Cut off the power and re-engage, wait for TFTP recovery to complete.
  7. After ImmortalWrt has booted, erase UBI volumes:
    umount /mnt/ubi0*
    ubidetach -p /dev/mtd4
    ubiformat -y /dev/mtd4
    ubiattach -p /dev/mtd4
    
  8. Create new ubootenv volumes:
    ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB
    ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB
    
  9. Additionally, if you want to have NAND recovery boot feature:
    (Don’t worry! You will always have TFTP recovery boot feature.)
    ubimkvol /dev/ubi0 -n 2 -N recovery -s 20MiB
    ubiupdatevol /dev/ubi0_2 immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-initramfs-recovery.itb
    
  10. Perform sysupgrade.

Screenshot

4 Likes

Question, I tried to tftp it ove with mobaxterm, but it can’t connect.

  1. Set static IP on your PC: IP 192.168.1.254/24, GW 192.168.1.1
  2. Serve ImmortalWrt initramfs image using TFTP server.
  3. Cut off the power and re-engage, wait for TFTP recovery to complete.

Once I have burnt immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-emmc-bl31-uboot.fip, do I need to setup the boot back to emmc?

Can you explain this a bit better, like I am five? Thanks.

Also, what software would you recommend for the TFTP? Maybe I need something better than Mobaxterm.

Thanks

Of course. If you don’t boot from emmc, how could the new uboot work?

tftpd64, old but reliable.

https://crates.io/crates/tftpd works fairly well in case you want an alternative.

@1715173329 do you plan to upstream the support to OpenWrt or it requires further changes?

Planned, but needs Airoha PHY driver goes to upstream kernel firstly. Unfortunately the PHY is a full black box.

So, I got it working with Mobaxterm, I had to reflash the image. I made the mistake that the first to time, I I tried to select from the uboot menu. The second time it found the image itself. Once it was up, I did the following

opkg update opkg install luci

Then when I was in the luci, I selected the sysupdate file, I am good now. I got my R3-Mini up and running on luci-ssl.

Thank you

That’s great. BTW we released 23.05.1 stable recently and it contains support for this board.

Awesome, I am about to finish my video and I am going to hi-lite how your image got mini up and running.

Why do you not write the image using dd?

It probably works, haven’t tested yet.

@1715173329 Should we pick your changes into official openwrt.org or are you going to take care of that yourself?

Edit: Just seeing you have answered that already here [BPi-R3-Mini] Review and mainline ImmortalWrt firmware support - #5 by 1715173329

@ericwoud Is taking care of the PHY driver, but Airoha/MediaTek will have to provide the firmware files under a redistributable license (and submit them to linux-firmware).

1 Like

Just a tip in case you ignored it ;)

Looks like the manufactory wrote a wrong value to the PHY register and resulted both rx polarity were reversed. I added a simple hack using OF to work around the issue, hope there’s a better way to do this.

I am trying to fix my nand, since uploading immortalwrt, when I try to boot from the nand, it keeps stating that it can’t find the lan devices

When I try to do this command

insmod mtd-rw-a53-5.4.ko i_want_a_brick=y

I get this error

insmod mtd-rw-a53-5.4.ko i_want_a_brick=y [ 282.941377] mtd_rw: Unknown symbol printk (err -2) failed to insert mtd-rw-a53-5.4.ko

This one is for kernel 5.4. You can get kmod-mtd-rw directly using opkg command.

Thanks, I want to share this incase someone else wonders how

root@edo:~# opkg install kmod-mtd-rw Installing kmod-mtd-rw (5.15.138+git-20160214-2) to root… Downloading https://downloads.immortalwrt.org/snapshots/targets/mediatek/filogic/kmods/5.15.138-1-29bca93017240d993199f4aae39827f0/kmod-mtd-rw_5.15.138%2Bgit-20160214-2_aarch64_cortex-a53.ipk Configuring kmod-mtd-rw.

root@edo:~# insmod mtd-rw i_want_a_brick=y

root@edo:~# lsmod | grep mtd

mtd_rw 16384 0

dd if=immortalwrt-mediatek-filogic-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb of=/dev/mmcblk0p5 bs=512 conv=fsync

I tried and I confirm that using dd works fine.

1 Like

Thanks for awesome work. I installed on eMMC and working great so far.

But overlay is only around 280MB and remaining 6GB is just don’t have any partition. So I tried extroot on OpenWrt Documentation but modifying /etc/config/fstab didn’t do anything.

Maybe I installed in wrong way or using dumb . Can you check the this overlay problem?


Edit: Sorry. Nevermind. I managed to fix myself both on extroot and small overlay problems by compile images myself.

@1715173329 what’s MD32 FW version in your tree?

071705 from mtk-openwrt-feeds

@1715173329 thanks for the great image. so far so good except two issues.

1- Follow your instructions to install on nand leads to system halt. Quick fix is to boot from EMMC, then from uboot CLI erase the nand and write bl2 and bl31 through tftpboot.

2- Got very weak signal using your image , trying multiple images (snapshot,23.05.1) leads to the same result. I had to revert back to the stock version to compare, the signal is very good. I think that issue might be related to the FW version. There is a new FW version (20230421120313a) which is closed to the source version. But I have no idea how to get it. Any Advice?