Banana Pi BPI-R3 OpenWRT image

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"

Install to NAND:

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

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/
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

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 [email protected]: Winbond SPI NAND was found.
spi-nand: spi_nand [email protected]: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
jedec_spi_nor [email protected]: unrecognized JEDEC id bytes: 00, ef, aa
'spi-nand0' is now active device
* spi-nand0
  - device: [email protected]
  - parent: [email protected]
  - 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
[[email protected] lede]$ git log --oneline 2ad949b11d..ee38573093
ee38573093 ipq40xx: pakedge_wr-1: convert to DSA
70d9193b51 ipq40xx: luma_wrtq-329acn: convert to DSA
7df959449c move DOWNLOAD_CHECK_CERTIFICATE to include/
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 ...

But does the MT7975PN as AP mode works in 5 GHz or 6GHz? If it does work with just one band at a time I can live with it for now…

Did you hear about the Pineapple 6 M.2 key B+M radio card It is supposed to works in 2.4 GHz, 5 GHz and 6 GHz at the same time, I’m thinking about it now since you told that the MT7975PN won’t work with 5 and 6 GHz at the same time…

The link for this WiFi card:

5ghz only (5180-5865)

Have added full capability in my wiki:

1 Like

Can you tell if the internal WiFi 5 GHz will pass more then 1Gb speed since it is WiFi 6?

I guess i’m not able to test this as this needs a clean environment (no other wifi-ap), a optimized config to use all posssible channels in both bands and a wifi-client which can handle this and the speed too. I only do my work in private free time and have first and last. Maybe @dangowrt can test this

Yes, with 2T2R client (Intel AX220) on HE160 channel bandwidth I can easily reach about 1.3 GBit/s on the 5 GHz interface, even without any antennas connected to the R3 board, just holding the laptop somewhat near the board.

I’m testing the development snapshot from openwrt site and when I do a sysupgrade (sysupgrade -v /tmp/bananapi_bpi-r3-squashfs-sysupgrade.itb) it doesn’t keep my current config.

@dangowrt could you tell which SFP module are you using ? I’m trying ONTi’s (ONT-C1GE-R01) and it just stop working after some time (no errors, tested 2 modules in 2 different R3 boards, same problem…)

Thanks for pointing me to the bug with sysupgrade config restore on MMC (it worked on NAND and NOR, but I forgot to re-test MMC after adding NOR, which actually broke things…). Now it should work after

I’ve tried several 1000Base-T modules with mixed results and the recommended TP-LINK TL-SM410U which works fine. For xPON module it can be that it takes too much power…?

Wow ! that was fast :slight_smile: thanks… I will do some wire up tomorrow and test the current draw with some of these 1000 and 2500 modules and compare with R3’s regulator spec. If I remember well they’re 8A, it shouldn’t be a problem.

I’m now having problems finding the bluetooth, @dangowrt does the kernel config support it?