Table of Contents
BananaPi R4
Hardware
- MediaTek MT7988A (Filogic 880)
- MT7530 switch builtin (1 cpu-port with 4GBit/s + 1Gbit/s user-ports)
- 4G RAM
- 8GB eMMC flash
- 128MB SPI-NAND Flash
- either 2x SFP+ (10GBit/s USXGMII) or 1SFP+ and 2g5 rj45 with PoE (link)
- Wifi7 with additional module connected to the 2 PCIe slots at bottom of board
- MediaTek MT7996 + MT7975 (2.4G) + MT7977A (6G) + MT7977B (5G)
- powersupply 12V/5A required when using wifi card,2A (like on other BPi Routers) is not enough
v00:
v1.0:
Changes between v0 and v1 (pm): https://forum.banana-pi.org/t/bpi-r4-linux-bootup/15926/59
Network
GMAC0 (4GBit/s) is connected internally to mt7530 switch variant where the 4 user-Ports are exposed as rj45 on board (1xWan,3xLan).
The SFP(+) cages are connected to SerDes lanes of GMAC1 and GMAC2, and those can be switched between SGMII/1000Base-X/2500Base-X mode for 10M/100M/1000M/2500M (via mtk-pcs-lynxi, just like on MT7622 and MT7986) and USXGMII/10GBase-KR for 5000M and 10000M. Hence it should be possible to support both, SFP modules with 1000M and 2500M, as well as SFP+ modules with 5000M and 10000M.
Sfp-connections
USB-A | SFP1-WAN | SFP2-LAN | 4xRJ-45 | 12V | USB-C |
---|---|---|---|---|---|
USXGMII0 | USXGMII1 | GSW | |||
eth2 | eth1 | eth0 |
full 10G will need RSS+LRO implemented in mtk ethernet driver and enabled:
ethtool -K eth2 lro on # enable hw_lro
RSS: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/18f46a84d87308a4f56f9176ca166dc75c38bb20%5E%21/ LRO: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/ddc366751fad05dade79b09932a999c5d5ae890c%5E%21/#F0
NETSYS: V2 for mt7986 (bpi-r3) V3 for mt7988 (bpi-r4)
Wifi
wifi is realized with daughter board (Network Interface Card) in the 2 mPCIe-Slots at bottom of the board.
Wifi-Module needs 12V…v1 uses sw4 in on-position, v0 used devicetree-overlay which enables the WIFI_PWR_EN regulator. Be careful with this setting when using different card in mPCIe slots!
kernel-module: mt7996e.ko
Newer wifi card planned with reduced antenna-count (6 instead of 14): https://forum.banana-pi.org/t/bpi-r4-any-information/15404/83
PCIE
2x1Lane (M.2 slots) and 2x2lane. the 2x2lane is for wifi (mPCIe slots).
USB
Bootswitch
A | B | |
---|---|---|
nand | 0 | 1 |
eMMC | 1 | 0 |
SD | 1 | 1 |
switch down is “1”, so both down booting from sdcard (v0 had both up to boot from sdcard)
v0:
uboot/ATF
currently use these:
and bootup "my" kernel like this:
MT7988> setenv fit 6.5.0-rc1-mt7988.itb MT7988> setenv kaddr 0x48000000 MT7988> fatload mmc 0:5 ${kaddr} ${fit} 4970220 bytes read in 417 ms (11.4 MiB/s) MT7988> bootm ${kaddr}
kaddr 0x46000000 works too, if uncompressed kernelimage is smaller than 32M (fit size of 14M was too large)
in newer u-boot i have set kaddr to 0x46000000 (fit loadaddr 0x44000000, rdaddr 0x48000000)
swiotlb errors (in ethernet-driver) can be fixed with limiting ram in uboot/cmdline to 3G (32bit border)
tftp
BPI-R4> setenv bootfile 6.5.0-rc1-mt7988-r4.itb BPI-R4> run bootnetfit
linux
https://www.kernel.org/doc/html/v6.1/admin-guide/kernel-parameters.html
3GB Ram limit not needed anymore as ethernet driver now uses 36bit addressing
kernel
debug
# mount -t debugfs none /sys/kernel/debug/ # cat /sys/kernel/debug/gpio # cat /sys/kernel/debug/pinctrl/pinctrl-handles # cat /sys/kernel/debug/regulator/regulator_summary # cat /sys/kernel/debug/clk/clk_summary
interface config
ip link set lan0 up ip a a 192.168.0.19/24 dev lan0 ip r a default via 192.168.0.10 date -s "2023-08-23 19:37 CEST" #stats ip -s link show dev eth2 ethtool -S eth2
DNS needs to be set in /etc/resolv.conf or in systemd like this:
mkdir -p /etc/systemd/resolved.conf.d/ cp /etc/systemd/resolved.conf /etc/systemd/resolved.conf.d/TEST.conf echo "DNS = 192.168.0.10" >> /etc/systemd/resolved.conf.d/TEST.conf systemctl restart systemd-resolved.service
modules in initrd:
mount /dev/mmcblk0p6 /mnt mkdir /lib/modules mkdir /lib/firmware mount -o bind /mnt/lib/modules /lib/modules mount -o bind /mnt/lib/firmware /lib/firmware modprobe mt7996e
openwrt
- clone openwrt master
- add this to feeds.conf.default: “src-git mtksdk https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds”
- scripts/feeds update -f mtksdk
- make menuconfig:
- Target System (MediaTek Ralink ARM)
- Subtarget (Filogic 8×0 (MT798x))
- Target Profile (MediaTek MT7988a nand rfb) #here i see no sd-variant
adding additional options:
CONFIG_PACKAGE_f2fs-tools=y CONFIG_PACKAGE_e2fsprogs=y CONFIG_PACKAGE_dosfstools=y CONFIG_PACKAGE_resize2fs=y CONFIG_PACKAGE_nano=y CONFIG_PACKAGE_iperf3=y #CONFIG_PACKAGE_netcat CONFIG_PACKAGE_tcpdump=y CONFIG_BUSYBOX_CUSTOM=y CONFIG_BUSYBOX_CONFIG_TELNET=y
*-initramfs-kernel.bin is not the production image we’re using. We only use it for testing purpose since it contains rootfs and won’t read the flash.
*-sysupgrade.bin is the actual production image. It’s a tar ball for nand/emmc/sd boards. It contains separate kernel and rootfs that will be written to ubi volume for nand, or the partitions defined for sd/emmc.
tar -xf bin/targets/mediatek/filogic/openwrt-mediatek-filogic-mediatek_mt7988a-rfb-nand-squashfs-sysupgrade.bin sysupgrade-mediatek_mt7988a-rfb-nand/kernel dumpimage -l sysupgrade-mediatek_mt7988a-rfb-nand/kernel