BPI-R4 building with AsiaRF 7916 - Need help

With the openwrt git hub I was easily able to build openwrt for the R4. I don’t know how to get it to build the bl emmc image, emmc image, and the nand image though… What do I add to the .config to get these other images to build?

You boot from sdcard and can install from uboot menu to nand then booting from nand and install to emmc.

I follow you I think, but the uboot file for the nand is 1mb. Doesn’t seem right does it? I thought I’d have a full image to flash to the nand. When my build is finished I have a 31mb sd image and then several images for the nand and emmc that are all 1mb or smaller. When I built with the BPI openwrt git hub it created several full size images.

Are you aware of the download possibility from open wrt firmware selector? It is may be the same source that you use:

https://firmware-selector.openwrt.org/?version=SNAPSHOT&target=mediatek%2Ffilogic&id=bananapi_bpi-r4

Yes, I have that image too. That image was missing some of the modules I needed so I had to compile my own. It’s not a big deal, I just wanted to flash over to the EMMC.

Also their images are the same size as mine. I thought the EMMC image I flash would be a full size image, the ones you linked and mine are all 1mb.

The only reason I thought we needed full size images was from “Getting Started with BPI-R4 - Banana Pi Wiki

It refers to flashing the full size images, not the uboot. If I flash the uboot I still need to install the image there too some how.

Everything needed to install to NAND or eMMC is included in the SD card image. If you connect serial console you can install to SPI-NAND and then from there to eMMC using the bootloader menu. I know, 31 MiB doesn’t seem enough, but for OpenWrt terms this is a huge file :wink:

Edit: In mainline OpenWrt we do not need different images for SD card, NAND and eMMC. The same image can be used once the bootloader has been installed.

That was very helpful. Thank you.

Could you explain that a bit or link me to an explanation? I tried to find it in the OpenWRT wiki, but didn’t find anything that explains it.

Does this mean once I got U-Boot on the NAND installed, it can then install the “remaining” OpenWRT image to the other storage media?

It’s really dead simple and the only file you need from all the files created in bin/targets/mediatek/filogic is the sdcard image. The other files are meant for bootloader updates when everything is installed already.

There are generally two way to install bootloader and OpenWrt images to the device: Using OpenWrt/Linux (using command line, can be done via SSH) or using the U-Boot serial console (easy, menu driven, needs serial connection).

The generated SD card image basically also contains bootloader images for SPI-NAND and eMMC. And the same recovery (= with initramfs) and production (= using squashfs as rootfs) OpenWrt images used on the SD card can be used on SPI-NAND and eMMC.

So installation always starts with the SD card image written to a microSD which is then used to boot the R4 (and it’s the exact same procedure with mainline OpenWrt also on the R2, R64 and R3).

If you have the serial console connected it’s very easy, you just use the arrow-keys or numbers to chose the menu item Install bootloader, recovery and production to NAND. That will take care of installing everything to SPI-NAND. Then change the dip switches to boot from NAND, reset the board for that to take effect and be done if you are fine with OpenWrt running off the SPI-NAND. If you want to run OpenWrt from the eMMC, find the option Install bootloader, recovery and production to eMMC. in the bootloader menu when booting from SPI-NAND.

2 Likes

Have you got it running now with the AsiaRF card?

Which exact card do you have, AW7916-NPD?

Are you using it as a client or as an access point for other devices?

I’m thinking about buying it to have some wireless card until the official banana pi card becomes available to buy.

Yes I have the 7916 mini pci e. Compiled with 7916 firmware, 7915e driver, and wpa3.

It works as an access point or as a bridge.

1 Like

I’ve found that all of these (AsiaRF Wi-Fi 6E Module AW7916-NPD) work, using a mix of M.2/mPCIe adapters (ie. AEmPCIe, mPCIeM key, etc):

  • AW7916-AED
  • AW7916-NPD
  • AW7915-NP1
  • AW7915-AE1
  • AW7915-BMD (works in the B key slot)

The steps I’ve posted here work, with the following used for the customize package selection part:

#####################################################################################
#####################################################################################
#####################################################################################

# default packages (https://firmware-selector.openwrt.org/?version=SNAPSHOT&target=mediatek%2Ffilogic&id=bananapi_bpi-r4):

printf '
CONFIG_PACKAGE_base-files=y
CONFIG_PACKAGE_busybox=y
CONFIG_PACKAGE_ca-bundle=y
CONFIG_PACKAGE_dnsmasq=y
CONFIG_PACKAGE_dropbear=y
CONFIG_PACKAGE_e2fsprogs=y
CONFIG_PACKAGE_f2fsck=y
CONFIG_PACKAGE_firewall4=y
CONFIG_PACKAGE_fitblk=y
CONFIG_PACKAGE_fstools=y
CONFIG_PACKAGE_kmod-crypto-hw-safexcel=y
CONFIG_PACKAGE_kmod-eeprom-at24=y
CONFIG_PACKAGE_kmod-gpio-button-hotplug=y
CONFIG_PACKAGE_kmod-hwmon-pwmfan=y
CONFIG_PACKAGE_kmod-i2c-mux-pca954x=y
CONFIG_PACKAGE_kmod-leds-gpio=y
CONFIG_PACKAGE_kmod-mt7915e=y
CONFIG_PACKAGE_kmod-mt7996-firmware=y
CONFIG_PACKAGE_kmod-nft-offload=y
CONFIG_PACKAGE_kmod-phy-aquantia=y
CONFIG_PACKAGE_kmod-rtc-pcf8563=y
CONFIG_PACKAGE_kmod-sfp=y
CONFIG_PACKAGE_kmod-usb3=y
CONFIG_PACKAGE_libc=y
CONFIG_PACKAGE_libgcc=y
CONFIG_PACKAGE_libustream-mbedtls=y
CONFIG_PACKAGE_logd=y
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_mkf2fs=y
CONFIG_PACKAGE_mtd=y
CONFIG_PACKAGE_netifd=y
CONFIG_PACKAGE_nftables=y
CONFIG_PACKAGE_odhcp6c=y
CONFIG_PACKAGE_odhcpd-ipv6only=y
CONFIG_PACKAGE_opkg=y
CONFIG_PACKAGE_ppp=y
CONFIG_PACKAGE_ppp-mod-pppoe=y
CONFIG_PACKAGE_procd=y
CONFIG_PACKAGE_procd-seccomp=y
CONFIG_PACKAGE_procd-ujail=y
CONFIG_PACKAGE_uboot-envtools=y
CONFIG_PACKAGE_uci=y
CONFIG_PACKAGE_uclient-fetch=y
CONFIG_PACKAGE_urandom-seed=y
CONFIG_PACKAGE_urngd=y
CONFIG_PACKAGE_wpad-basic-mbedtls=y
' >> .config

#####################################################################################
#####################################################################################
#####################################################################################

# extra packages to include - pciutils:

printf '
CONFIG_PACKAGE_pciutils=y
' >> .config

#####################################################################################
#####################################################################################
#####################################################################################

# extra packages to include - mediatek wifi:

printf '
CONFIG_PACKAGE_kmod-mt76=y
CONFIG_PACKAGE_kmod-mt76-core=y
CONFIG_PACKAGE_kmod-mt76-connac=y
' >> .config

#####################################################################################

printf '
CONFIG_PACKAGE_kmod-mt7915e=y
' >> .config

#####################################################################################

printf '
CONFIG_PACKAGE_kmod-mt7996e=y
CONFIG_PACKAGE_kmod-mt7996-firmware=y
' >> .config

#####################################################################################

printf '
CONFIG_PACKAGE_kmod-mt7915-firmware=y
' >> .config

#####################################################################################

printf '
CONFIG_PACKAGE_kmod-mt7916-firmware=y
' >> .config

#####################################################################################
#####################################################################################
#####################################################################################

I’ve been waiting a few weeks for an E keymPCIe adapter to arrive; I’m hoping (but realistically not likely, considering their intentional breakage surrounding Location Aware Regulatory) a Intel BE200 module could be coerced into working in AP mode:

#####################################################################################
#####################################################################################
#####################################################################################

# extra packages to include - intel wifi:

printf '
CONFIG_PACKAGE_kmod-iwlwifi=y
' >> .config

#####################################################################################

printf '
CONFIG_PACKAGE_iwlwifi-firmware-ax200=y
' >> .config

#####################################################################################

printf '
CONFIG_PACKAGE_iwlwifi-firmware-ax210=y
' >> .config

#####################################################################################

printf '
CONFIG_PACKAGE_iwlwifi-firmware-be200=y
' >> .config

#####################################################################################
#####################################################################################
#####################################################################################

Lastly, a Quectel RM510Q-GL works well with the following:

#####################################################################################
#####################################################################################
#####################################################################################

# extra packages to include - Quectel RM510Q-GL:

printf '
CONFIG_PACKAGE_libevdev=y
CONFIG_PACKAGE_libatomic1=y
CONFIG_PACKAGE_libusb-1.0-0=y
CONFIG_PACKAGE_libudev-zero=y
CONFIG_PACKAGE_usbids=y
CONFIG_PACKAGE_usbutils=y
' >> .config

#####################################################################################

printf '
CONFIG_PACKAGE_uqmi=y
CONFIG_PACKAGE_picocom=y
CONFIG_PACKAGE_luci-proto-qmi=y
CONFIG_PACKAGE_kmod-usb-net-qmi-wwan=y
CONFIG_PACKAGE_kmod-usb-serial-option=y
' >> .config

#####################################################################################
#####################################################################################
#####################################################################################

The mPCIe variants also just work in the mPCIe slot(s), although I’ve only tested in the one slot (center of the board, vs closer to the edge), and I believe there may be issues with the second slot currently

Steps from the other thread, sans-cpu fan duck-punch/monkey-patch, to be easier to follow:

git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt/

./scripts/feeds update -a
./scripts/feeds install -a

curl "https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/config.buildinfo" > .config
make menuconfig # only changed: `Target Profile: Bananapi BPi-R4`
make defconfig

make -j $(nproc) toolchain/{clean,install}
### Executed in   34.42 mins

make -j $(nproc) target/linux/{prereq,clean,download,prepare}
make -j $(nproc) target/linux/compile
### Executed in  342.24 secs

# ensure `.vermagic` value matches, so `opkg` works with snapshot packages:
find build_dir/ -name .vermagic -exec cat {} \;
curl -s "https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-mediatek-filogic.manifest" \
    | sed -n 's/^kernel - .\+\(-\|~\)\([a-f0-9]\+\)\(-r[0-9]\+\)\?$/\2/p'

# customize package selection in resultant image (default packages can be retrieved from https://firmware-selector.openwrt.org/?version=SNAPSHOT&target=mediatek%2Ffilogic&id=bananapi_bpi-r4 ):
printf '
CONFIG_PACKAGE_...=y
' >> .config

make defconfig

# save customized `.config` for later builds:
./scripts/diffconfig.sh | awk '!seen[$0]++' > diffconfig
mv diffconfig .config

# customize files:
mkdir -p files/
#...

# customize first run image configuration:
printf $'#!/bin/sh

# fill in with `uci set ...` values from `uci show`

' > files/etc/uci-defaults/99-custom
chmod 0644 files/etc/uci-defaults/99-custom

# expand config:
make defconfig

# download stage:
make -j $(nproc) download
### Executed in   36.62 secs

# build:
make -j $(nproc) world
### Executed in  664.17 secs

This is super useful. Thank you for this! My only issue doing this on redhat 9.2 is the uci-defaults folder does not exist. Not sure what i need to install to get UCI on redhat 9.2.

Edit: Ended up using Debian 12.5 (bookworm). Not done yet, but so far looks better.

Last time i tried i got stuck on first boot from the SD card. Where it was trying to initialize/connect IPv6. Could not find an option to disable IPv6 in the menuconfig. I’m thinking of just running it via sd card, and maybe in the future switching to eMMC.

I also have one of the AsiaRF 7916 cards i’ve been trying to get working on the BPI-R4.Its a fun challenge. I have a couple of the MT7615’s on order. As well as the metal case for the BPI-R4.

Have you tried “make distclean” before updating the feeds? Had this in present when updating source…it was relying on older versions.

Do you use my debian script/image? I had no issue with ipv6,but not propagated in my lan. I guess you can disable it in systemd-networkd config.

I believe i have, but no harm in trying again.

Here is s a screenshot of where i keep getting “stuck”. Or maybe its a normal boot, but since i dont have control over the console its not passing.

I’ve been using Putty. I’ll try something like RealTerm.

Yep, after i sent a break, it loaded in fine. Sorry - i am kinda new to this type of thing.

Quick update. I did manage to get it up and running. So far so good! Now to wait for the wifi7 modules. Who know when they might be released to the public…

Hey Frank, You mentioned something about a script. Do you have a build script for the r4? I couldn’t find it if you do.

I am running into loads of issues, and i am no pro at this. I am willing to try anything at this point :slight_smile: .