Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build-boot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
- aarch64_qemu_boot
- bpi_r3_sd_boot
- bpi_r3_emmc_boot
- bpi_r64_sd_boot
- bpi_r64_emmc_boot
- cn9130_crb_boot
- fireant_boot
- nanopi_r2s_boot
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- raspberrypi-rpi2
- raspberrypi-rpi64
- bananapi-bpi-r3
- bananapi-bpi-r64
- friendlyarm-nanopi-r2s
- microchip-sama7g54-ek
default: 'raspberrypi-rpi64'
Expand Down Expand Up @@ -67,6 +68,12 @@ jobs:
echo "ARCH=aarch64" >> $GITHUB_ENV
echo "BUILD_EMMC=true" >> $GITHUB_ENV
;;
bananapi-bpi-r64)
echo "BOOTLOADER_SD=bpi-r64-sd-boot" >> $GITHUB_ENV
echo "BOOTLOADER_EMMC=bpi-r64-emmc-boot" >> $GITHUB_ENV
echo "ARCH=aarch64" >> $GITHUB_ENV
echo "BUILD_EMMC=true" >> $GITHUB_ENV
;;
friendlyarm-nanopi-r2s)
echo "BOOTLOADER=nanopi-r2s-boot" >> $GITHUB_ENV
echo "ARCH=aarch64" >> $GITHUB_ENV
Expand Down
1 change: 1 addition & 0 deletions board/aarch64/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ if BR2_aarch64

source "$BR2_EXTERNAL_INFIX_PATH/board/aarch64/alder-alder/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/aarch64/bananapi-bpi-r3/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/aarch64/bananapi-bpi-r64/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/aarch64/freescale-imx8mp-evk/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/aarch64/friendlyarm-nanopi-r2s/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/aarch64/marvell-cn9130-crb/Config.in"
Expand Down
3 changes: 2 additions & 1 deletion board/aarch64/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ aarch64
Board Specific Documentation
----------------------------

- [Banana Pi R3](banana-pi-r3/)
- [Banana Pi BPi-R3](banana-pi-r3/)
- [Banana Pi BPi-R64](banana-pi-r64/)
- [Marvell CN9130-CRB](cn9130-crb/)
- [Microchip SparX-5i PCB135 (eMMC)](sparx5-pcb135/)
- [NanoPi R2S](r2s/)
Expand Down
7 changes: 7 additions & 0 deletions board/aarch64/bananapi-bpi-r64/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config BR2_PACKAGE_BANANAPI_BPI_R64
bool "Banana Pi R64"
depends on BR2_aarch64
select BR2_PACKAGE_FEATURE_WIFI
select SDCARD_AUX
help
Build Banana PI R64 support
13 changes: 13 additions & 0 deletions board/aarch64/bananapi-bpi-r64/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (c) 2026 The KernelKit Authors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
188 changes: 188 additions & 0 deletions board/aarch64/bananapi-bpi-r64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
# Banana Pi BPI-R64

## Overview

<img align="right" src="banana_pi_bpi-r64_interface.jpg" alt="Board Overview" width=400 padding=10>

The Banana Pi BPI-R64 is a networking board based on the MediaTek MT7622
(dual Cortex-A53, AArch64) SoC.

### Hardware Features

- MediaTek MT7622 ARM Cortex-A53 dual-core processor @ 1.35 GHz
- 1 GB DDR3L RAM
- 8 GB eMMC storage
- microSD card slot
- MT7531 Gigabit Ethernet switch (4x LAN + 1x WAN)
- MT7603E built-in 2.4 GHz WiFi
- USB 3.0 port
- 2x Mini PCIe slots

### Default Network Configuration

Infix comes preconfigured with:

- **LAN ports** (lan0-lan3): Bridged for internal networking
- **WAN port**: DHCP client enabled for internet connectivity
- **WiFi** (wifi0-ap): Bridged to LAN (MT7615 PCIe card if fitted, otherwise MT7603E)

## Boot Switch Reference

<img align="right" src="bpi-r64-sw1.png" alt="SW1 Boot Switch" width=90 padding=10>

The BPI-R64 uses a 2-position DIP switch (SW1) to select the boot device
order. The MT7622 Boot ROM tries devices in the order listed and falls
back to the next if no valid BL2 is found at the expected location.

| SW1 | Boot device | Use case |
|-----|-------------|----------------------------|
| OFF | eMMC | Production eMMC boot |
| ON | SD card | SD card boot / development |

> [!NOTE]
> SinoVoip has exposed only one bit of the MT7622's two-bit `BOOT_SEL[1:0]`
> strapping field via SW1, with `BOOT_SEL[1]` hardwired high. This limits the
> board to eMMC (`10b`) and SD (`11b`) boot; the SPI-NOR and SPI-NAND modes
> available on the MT7622 reference board (`00b`, `01b`) are not selectable.

## Getting Started

### Quick Start with SD Card

1. **Flash the image to an SD card** (the filename includes the version, e.g.
`infix-25.01-bpi-r64-sdcard.img`):

<img align="right" src="debug-uart.png" alt="Debug UART" width=100 padding=10>

```sh
dd if=infix-*-bpi-r64-sdcard.img of=/dev/sdX bs=4M status=progress
```

2. **Set boot switch:** SW1 ON (SD card boot)
3. **Insert SD card and power on**
4. **Connect console:** 115200 8N1 — use the dedicated Debug UART header
just below the 40-pin GPIO header; pins are labeled GND, RX, TX on the board
5. **Default login:** `admin` / `admin`

## Installing to eMMC

### eMMC Boot ROM Behaviour

> [!IMPORTANT]
> The MT7622 Boot ROM reads BL2 from two possible locations depending on the
> eMMC configuration:
>
> - **eMMC BOOT0 hardware partition enabled** (factory default on most chips):
> Boot ROM reads BL2 from offset 0 of the BOOT0 partition. Our disk image
> (which puts BL2 in the User Data Area at sector 1024 / offset 0x80000) will
> **not** be found here — you must either write BL2 to BOOT0 separately or
> disable BOOT0.
>
> - **eMMC BOOT0 disabled:** Boot ROM falls through to the User Data Area (UDA)
> and reads BL2 from sector 1024 (offset 0x80000). The eMMC BL2 is built
> for BOOT0 (`hdroffset=0x0`) and will **not** match this location — BOOT0
> must be enabled for eMMC boot to work.
>
> The recommended installation procedure below writes BL2 to BOOT0 and enables
> BOOT0 as the boot source.

### Procedure

The easiest path is to boot from SD first and then write the eMMC image from
U-Boot.

#### Step 1: Boot from SD card

1. Set SW1 to ON (SD boot)
2. Insert SD card with Infix
3. Power on and break into U-Boot (press Ctrl-C during boot)

#### Step 2: Write the eMMC image from U-Boot

Place `infix-bpi-r64-emmc.img` and `bl2.img` on a FAT32-formatted USB drive,
then from the U-Boot prompt:

```
usb start
fatload usb 0:1 0x44000000 infix-bpi-r64-emmc.img
setexpr blocks ${filesize} / 0x200
mmc dev 0
mmc write 0x44000000 0x0 ${blocks}
```

#### Step 3: Write BL2 to eMMC BOOT0

This handles the BOOT0 case and ensures the Boot ROM can find BL2 regardless
of the chip's default BOOT0 state:

```
fatload usb 0:1 0x44000000 bl2.img
mmc partconf 0 1 1 1
setexpr blkcnt ${filesize} + 0x1ff
setexpr blkcnt ${blkcnt} / 0x200
mmc write 0x44000000 0x0 ${blkcnt}
mmc partconf 0 1 1 0
```

The `mmc partconf 0 1 1 1` command enables BOOT0 and routes boot reads there;
`mmc partconf 0 1 1 0` switches back to UDA access so U-Boot sees the full
partition table normally.

#### Step 4: Boot from eMMC

1. Power off the board
2. Set SW1 to OFF (eMMC boot)
3. Remove SD card
4. Remove USB drive
5. Power on

## Platform Notes

### BL2 Offset and GPT Requirement (sector 1024)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt this section just a wall of text what does it give to a infiux user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll clean it up.

The MT7622 Boot ROM locates BL2 via the **GPT partition table**: it reads the
GPT, finds the partition named `bl2`, and loads from its start sector. The
`bl2` partition must start at **sector 1024 = offset 0x80000** (same as the
MT7986/BPI-R3).

> [!IMPORTANT]
> The MT7622 Boot ROM reads the **legacy MBR partition table** to locate BL2,
> not the GPT. The disk image must use a **hybrid MBR/GPT** layout so that the
> `bl2` partition is visible in both tables. A pure GPT image causes `F5: 4801
> 0000` → `F5: 480A 0031` → halt. `genimage` is configured with
> `partition-table-type = "hybrid"` to produce the required layout.

The ATF SD build uses `DEVICE_HEADER_OFFSET=0x80000` so that `mkimage` encodes
the correct media position (sector 1024 of UDA) in the BRLYT `gfh_offset`
field. The eMMC build uses `DEVICE_HEADER_OFFSET=0x0` because BL2 lives at
offset 0 of the BOOT0 partition. Getting this wrong causes a `F5: 4801 0000`
failure (found but rejected) rather than `F5: 480A 0031` (not found).

### FIP Location

BL2 locates the FIP (containing BL31 + U-Boot) by name via the GPT partition
table — it looks for a partition labelled `fip`. No hardcoded FIP offset is
used, so FIP can be placed freely after BL2 in the partition table.

### mmc0 = eMMC, mmc1 = SD

On MT7622, MSDC0 (mmc0 in U-Boot and Linux) is the 8-bit eMMC controller and
MSDC1 (mmc1) is the 4-bit SD card controller. This is the reverse of many
other platforms. The SD U-Boot environment therefore sets `boot_targets =
"mmc1"` while the eMMC environment uses the default `mmc0`.

## Building

```sh
# Bootloader only (SD)
make O=x-boot-bpir64-sd bpi_r64_sd_boot_defconfig && make O=x-boot-bpir64-sd

# Bootloader only (eMMC)
make O=x-boot-bpir64-emmc bpi_r64_emmc_boot_defconfig && make O=x-boot-bpir64-emmc

# Compose SD image (pass the Infix rootfs output directory)
utils/mkimage.sh -b x-boot-bpir64-sd -r x-aarch64/images bananapi-bpi-r64

# Compose eMMC image
utils/mkimage.sh -b x-boot-bpir64-emmc -r x-aarch64/images -t emmc bananapi-bpi-r64
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions board/aarch64/bananapi-bpi-r64/bananapi-bpi-r64.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
define BANANAPI_BPI_R64_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_ARCH_MEDIATEK)
$(call KCONFIG_ENABLE_OPT,CONFIG_MACH_MT7622)
$(call KCONFIG_ENABLE_OPT,CONFIG_PINCTRL_MT7622)
$(call KCONFIG_ENABLE_OPT,CONFIG_SERIAL_8250_MT6577)
$(call KCONFIG_ENABLE_OPT,CONFIG_MTK_UART)
$(call KCONFIG_ENABLE_OPT,CONFIG_MEDIATEK_WATCHDOG)
# Ethernet subsystem clock controller — required for the eth MAC,
# MT7531 DSA switch, and HSDMA to get their clocks from &ethsys.
# Without this, eth probe fails and the switch is never detected.
$(call KCONFIG_ENABLE_OPT,CONFIG_COMMON_CLK_MT7622_ETHSYS)
# HIF subsystem clock controller — required for PCIe and USB.
$(call KCONFIG_ENABLE_OPT,CONFIG_COMMON_CLK_MT7622_HIFSYS)
$(call KCONFIG_ENABLE_OPT,CONFIG_MEDIATEK_GE_PHY)
$(call KCONFIG_ENABLE_OPT,CONFIG_REALTEK_PHY)
$(call KCONFIG_ENABLE_OPT,CONFIG_NET_VENDOR_MEDIATEK)
$(call KCONFIG_ENABLE_OPT,CONFIG_NET_MEDIATEK_SOC)
$(call KCONFIG_SET_OPT,CONFIG_NET_DSA_MT7530,m)
$(call KCONFIG_SET_OPT,CONFIG_MT7603E,m)
$(call KCONFIG_SET_OPT,CONFIG_PCIE_MEDIATEK,m)
$(call KCONFIG_ENABLE_OPT,CONFIG_MMC_MTK)
$(call KCONFIG_SET_OPT,CONFIG_USB_XHCI_MTK,m)
$(call KCONFIG_SET_OPT,CONFIG_PHY_MTK_TPHY,m)
$(call KCONFIG_SET_OPT,CONFIG_MTK_THERMAL,m)
$(call KCONFIG_SET_OPT,CONFIG_MTK_SOC_THERMAL,m)
$(call KCONFIG_SET_OPT,CONFIG_I2C_MT65XX,m)
$(call KCONFIG_SET_OPT,CONFIG_PWM_MEDIATEK,m)
$(call KCONFIG_SET_OPT,CONFIG_REGULATOR_MT6380,m)
$(call KCONFIG_SET_OPT,CONFIG_NVMEM_MTK_EFUSE,m)
$(call KCONFIG_SET_OPT,CONFIG_CRYPTO_DEV_SAFEXCEL,m)
$(call KCONFIG_ENABLE_OPT,CONFIG_RTC_DRV_MT7622)
endef

$(eval $(ix-board))
$(eval $(generic-package))
Binary file added board/aarch64/bananapi-bpi-r64/bpi-r64-sw1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added board/aarch64/bananapi-bpi-r64/debug-uart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions board/aarch64/bananapi-bpi-r64/dts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dtb-y += mediatek/mt7622-bananapi-bpi-r64.dtb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <arm64/mediatek/mt7622-bananapi-bpi-r64.dts>

#include "mt7622-bananapi-bpi-r64.dtsi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/ {
chosen {
infix {
/* Default admin user password: 'admin' */
factory-password-hash = "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A";
usb-ports = <&ssusb>;
usb-port-names = "USB";
};
};
};
Loading
Loading