Banana Pi BPI-R3 OpenWRT image

Banana Pi BPI-R3 OpenWRT image : OpenWRT 21.02 linux kerne 5.4, wifi 6E 2.4G and 5G working fine.

https://wiki.banana-pi.org/Banana_Pi_BPI-R3#OpenWRT

3 Likes

#BananaPi BPI-R3 with #MediaTek #MT7986(#Filogic830) + #MT7531A ,#OpenWrt test #router function test

1 Like

Support for the BananaPi BPi-R3 is now available in vanilla OpenWrt since

boot log: https://termbin.com/de6q asciinema: https://asciinema.org/a/518024

Snapshot images are available for download at

https://downloads.openwrt.org/snapshots/targets/mediatek/filogic

To start using the R3 download openwrt-mediatek-filogic-bananapi_bpi-r3-sdcard.img.gz and write the decompressed content of this file to a microSD card, e.g.

gzip -cd openwrt-mediatek-filogic-bananapi_bpi-r3-sdcard.img.gz | dd of=/dev/mmcblk0

You can run OpenWrt directly from the microSD card or use the bootloader menu in the serial console to install OpenWrt on either the SPI-NAND or the SPI-NOR flash chip (depending on the position of the physical switch on the board).

As microSD and eMMC cannot be accessed at the same time (and space on SPI-NOR is more scarce), the option to install to eMMC is only available when booting from SPI-NAND.

bootloader update required when updating from OpenWrt snapshots before 2023-06-06

Users running OpenWrt before commit 7a0ec001ff of 2023-06-06 (or on the openwrt-23.05 branch commit a65ec9fea7 of 2023-06-09) have to re-install from SD card or manually update the U-Boot bootloader.

For more information, see the page about the Bananapi BPI-R3 on the OpenWrt wiki

At this point working (will keep editing):

  • all 4 boot methods incl. installation via U-Boot, sysupgrade, …
  • copper LAN and WAN ports
  • SFP1 (connected to MT7986A gmac1, eth1 in Linux, 1G and 2.5G modes supported)
  • SFP2 (connected to MT7531 switch, sfp2 DSA user port in Linux, 1G and 2.5G modes supported)
  • WiFi
  • LEDs
  • Buttons (RST clashes with M.2/NGFF slot on the back, at least on V1.0 board, hence disabled)
  • PSTORE/ramoops based dual-boot
  • M.2/NGFF slot (PCIe x2) (using it breaks RST button on my V1.0 board though)
  • mPCIe slot (USB 2.0 works, SIM works, no actual PCIe signals connected to that slot)
  • thermal zone using PWM0 to control 5V fan according the CPU temperature
  • PWM1 on pin 7 of the 26-pin GPIO header

Edit: SFP2 is now fully supported since https://github.com/openwrt/openwrt/commit/bd6783f4fb8f6171927e9067c0005a6d69fc13fe

Edit: @frank-w tested SIM slot and it works.

Edit 2: Thermal zone and PWM now works

For now only the R3 board layout variant with two SFP cages is supported. The board layout variant with only one SFP cage and Airoha EN8811 2.5G PHY with PoE is unsupported (please provide hardware sample!).

BPi-R3 as tri-band router with AMD RZ608 MT7921K WiFi 6E + Bluetooth module for 6GHz band:

signal-2022-09-09-185932_002

signal-2022-09-09-185932_003

Bootlog with MT7921K WiFi 6E module, doing speed test with 2.5G SFP on both SFP ports: https://termbin.com/tvss

8 Likes

Thanks for sharing the log. I don’t see 6Ghz bands on the other 2 radios. Does it mean Wifi 6E is not supported without add-on cards?

Yes, this is true. On the BPi-R3 there are two 4T4R WiFi 6 frontends:

  • MT7975N for 2.4 GHz
  • MT7975PN for 5 GHz

SinoVoip could have used MT7976A instead of the MT7975PN, that would support both 5 GHz and 6 GHz band. However, this is not the case, at least not on my V1.0 board. Also, even in that way the board would only support either 5 GHz or 6 GHz, while for an AP/Router you’d want them both.

So ideally you would have another MT7916E+MT7976A combination sitting in the PCIe bus, but I didn’t find any modules sold with that combination yet. So I resorted to MT7921 which is very available as it is used in many laptops. But it is only 2T2R and doesn’t support the wireless offloading features of the MT7986 SoC.

2 Likes

Shoot, that’s a disappointment. I was under impression 6e was supported OOB. It was the primary reason I bought this board. Their marketing is very misleading if lack of 6e support turns out to be the case.

1 Like

I have a production board and the openwrt snapshot and the sinovoip images in the wiki do not make the neither wifi to appear in the ifconfig, what should I do to try to debug it?

Seems like v1.1 has a issue where wifi is not recognized when debug-uart is connected

I confirm that the problem goes away once you reboot after you plugged away the debug-uart.

Is there any documentation on how to manually flash the nand/nor? I didn’t manage to flash from u-boot using the sd.

Can you explain and document what didn’t work with the installation via the U-Boot menu?

If the switch controlling the SPI chip-select is in the correct position selecting either SPI-NAND or SPI-NOR, the corresponding installation option in U-Boot should work and the board should boot from that once the switches controlling the bootstrap pins are in position to select either SPI-NAND or SPI-NOR flash. If there is a problem with the installation routine on V1.1 or later boards, I would definitely like to fix that, but I only got a V1.0 board myself.

Sure, do you prefer having a github issue open or should I write down here the bootlogs?

Paste a link to pastebin or the like here or PM me here.

I tried again and now the nand and nor install worked fine.

Either I made a mistake with the jumpers or something strange happened the time I tried to write the nand since the process returned strangely early.

nand install log nor install log

Still it would be great if there is a document or a script to flash nand/nor via the living system from emmc/sd

1 Like

If you are running OpenWrt, you can instruct the bootloader to carry out installation upon the next reboot. In this way you won’t need the serial console connected.

To install to NOR you can do:

fw_setenv bootcmd "run nor_init ; env default bootcmd ; saveenv ; reset"
reboot

Install to NAND:

fw_setenv bootcmd "run ubi_init ; env default bootcmd ; saveenv ; reset"
reboot

Alternatively you can also install the kmod-mtd-rw package and use it to remove write-protection from the bl2 and fip partitions.

For installation to NOR flash:

modprobe mtd-rw i_want_a_brick=1
mtd write openwrt-mediatek-filogic-bananapi_bpi-r3-nor-preloader.bin bl2
mtd write openwrt-mediatek-filogic-bananapi_bpi-r3-nor-bl31-uboot.fip fip
mtd write openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb recovery
mtd write openwrt-mediatek-filogic-bananapi_bpi-r3-squashfs-sysupgrade.itb fit

For installation to NAND flash:

modprobe mtd-rw i_want_a_brick=1
mtd write openwrt-mediatek-filogic-bananapi_bpi-r3-snand-preloader.bin bl2
mtd write openwrt-mediatek-filogic-bananapi_bpi-r3-snand-bl31-uboot.fip fip
. /lib/functions.sh
ubiformat /dev/mtd$(find_mtd_index ubi)
ubiattach -m $(find_mtd_index ubi)
ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 1M
ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 1M
set -- $(wc -c openwrt-mediatek-filogic-bananapi_bpi-r3-squashfs-sysupgrade.itb)
ubimkvol /dev/ubi0 -n 2 -N fit -s $1
ubiupdatevol -s $1 /dev/ubi0_2 openwrt-mediatek-filogic-bananapi_bpi-r3-squashfs-sysupgrade.itb
set -- $(wc -c openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb)
ubimkvol -n 3 -N recovery -s $1
ubiupdatevol -s $1 /dev/ubi0_3 openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb
2 Likes

I’m sorry to say that U-Boot 2022.07-OpenWrt-r20814-2ad949b11d (Oct 02 2022 - 09:39:13 +0000) works, while the current snapshot with ( ( ( OpenWrt ) ) ) [SD card] U-Boot 2022.07-OpenWrt-r20867-ee38573093 (Oct 05 2022 - 17:16:52 +0000) fail:

        ( ( ( OpenWrt ) ) )  [SD card]       U-Boot 2022.07-OpenWrt-r20867-ee38573093 (Oct 05 2022 - 17:16:52 +0000)

      1. Run default boot command.
      2. Boot system via TFTP.
      3. Boot production system from SD card.
      4. Boot recovery system from SD card.
      5. Load production system via TFTP then write to SD card.
      6. Load recovery system via TFTP then write to SD card.
      7. Install bootloader, recovery and production to NOR.
      8. Install bootloader, recovery and production to NAND.
      9. Reboot.
      a. Reset all settings to factory defaults.
      0. U-Boot console


  Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit
spi-nand: spi_nand spi_nand@1: Winbond SPI NAND was found.
spi-nand: spi_nand spi_nand@1: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: 00, ef, aa
'spi-nand0' is now active device
* spi-nand0
  - device: spi_nand@1
  - 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-0x000000080000 : "bl2"
          - 0x000000080000-0x000000380000 : "factory"
          - 0x000000380000-0x000000580000 : "fip"
          - 0x000000580000-0x000008000000 : "ubi"
Press ENTER to return to menu
[daniel@box lede]$ git log --oneline 2ad949b11d..ee38573093
ee38573093 ipq40xx: pakedge_wr-1: convert to DSA
70d9193b51 ipq40xx: luma_wrtq-329acn: convert to DSA
7df959449c rules.mk: move DOWNLOAD_CHECK_CERTIFICATE to include/download.mk
3bd04767ba build: prefer HTTPS if available (for packages)
dc51342d34 qoriq: fix typo in FEATURES
a5265497a4 kernel: fix possible mtd NULL pointer dereference
45109f69a6 mac80211: fix compile error when mesh is disabled
c27b439564 CI: Add workaround for github uppercase usernames
f1b7e1434f treewide: fix security issues by bumping all packages using libwolfssl
149fc3a269 ramips: fix switch setup for ASUS RT-AX53U
606eb43b72 ipq40xx: glinet-b1300: fix LAN and WAN MAC address assigments
2b4f12e55b rockchip: switch to 5.15 kernel
fcaf7b32da kernel: add missing config symbols for 5.15
c4f0781eae rockchip: refresh kernel 5.15 config
db19efee95 ipq40xx: disable boards not converted to DSA
116feb4a1c ipq40xx: remove non-converted network configs
132545785b ipq40xx: ipqess: enable threaded NAPI
b9b4c51b2b ipq40xx: Meraki MR33: convert MAC addresses to nvmem
550253bdf9 ipq40xx: convert some boards to DSA
ad9ecd33cc ipq40xx: qca8k: introduce proper PSGMII calibration
f5c62c6e91 ipq40xx: qca807x: drop kernel version checks
12eebe8871 ipq40xx: qca807x: add suspend and resume ops
5293c08290 ipq40xx: sxtsq-5-ac: correct TCSR ESS type
a4470685ac ipq40xx: enable ethernet and DSA driver combo
b1f21329d4 ipq40xx: add DSA switch driver
28b13bb157 ipq40xx: import qca8k from generic
17a55f9c9d ipq40xx: add PSGMII PHY mode define
a15ccc2fe0 ipq40xx: add IPQESS ethernet driver
45ad5beb80 ipq40xx: qca807x: always set PSGMII AZ WAR
acc4add9a7 ipq40xx: add shinfo based DSA tag driver
ccd08ef912 ipq40xx: disable nodes instead of deleting them
378d1a6569 ipq40xx: qca807x: add SFP improvements
27b441cbaf ipq40xx: drop ESSEDMA + AR40xx DTS nodes
6d24d10f3d ipq40xx: drop ESSEDMA + AR40xx
f96744ba6b mac80211: mask nested A-MSDU support for mesh
185541f50f uboot-mvebu: backport LibreSSL patches for older version of LibreSSL
9c7472950b uboot-mvebu: backport patch to fix compilation on non glibc system
17c1bf7e6c trace-cmd: update to v3.1.3
4f70380ff1 libtracefs: update to 1.5.0
cef2ec62ab libtraceevent: update to 1.6.3
d327466149 popt: update to 1.19
04119d7cce libcap: update to 2.66
fbd33d6164 lantiq: enable interrupts on second VPEs
a664d39c5b ramips: add support for SNR SNR-CPE-ME2-Lite
bf5b1a53d4 ramips: enable LZMA loader to fix Linksys RE6500 boot
eed0a31b90 kernel: bump 5.10 to 5.10.146
8fe67fae1d kernel: bump 5.10 to 5.10.145
e71a360f57 kernel: bump 5.15 to 5.15.71
e1b009c1fe kernel: bump 5.15 to 5.15.70
39c8beae32 tools/cmake: update to 3.24.2
107f82292b tools/expat: switch to tar.xz to save bandwidth
1b3a524e1d tools/expat: update to 2.4.9
875e17774b tools/meson: backport WSL2 fix

I can’t see anything related to U-Boot or ARM Trusted Firmware, nor touching the mediatek target image builds or anything. What exactly is failing?

It does not boot from SD, nor install to memory. gdisk claims that the image has a bogus gpt table.

*** ERROR: Can't read GPT Entries ***
find_valid_gpt: *** ERROR: Invalid GPT ***
*** ERROR: Can't read GPT header ***
find_valid_gpt: *** ERROR: Invalid Backup GPT ***

After some reboots everything works as intended. I wonder if it is yet another hardware glitch to be ironed out.

This can happen if there are still left-overs of previous things on the SD card. Try wiping all partition/filesystem headers before writing the OpenWrt sdcard image:

wipefs -a /dev/mmcblk0
dd ...