[Banana Pi BPI-R64] Mainline OpenWRT image

Thank you, this worked.

I’ve got confused with paths like feeds/base/package/...

Furthermore the resulting package is located in

bin/targets/mediatek/mt7622/packages

instead of

bin/packages/aarch64_cortex-a53/base 

which I can’t figure out why.

After executing make package/mt76/{clean,prepare} QUILT=1 source code appears in

build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/mt76-2021-07-15-bbebea7d

BTW do you know if it’s possible to include binary files in patches? The idea is to have a mt76-firmware package which would put two additional calibration data files in /lib/firmware/mediatek/ directory.

The package is built per target (intead of per architecture) due to PKG_NONSHARED:=1 being set. This is because it’s a kernel module and needs to match the exact kernel build of the target, and not just the architecture.

I don’t think it’s possible to include binaries in patches, and it’s also just something nobody should do imho. You can, however, place the files in package/kernel/mt76/files and edit package/kernel/mt76/Makefile to have them included in the a generated package mt7622-default-eeprom (or something like that).

Maybe you can put your files directly to https://github.com/openwrt/openwrt/tree/master/target/linux/mediatek/base-files

1 Like

I don’t think they should go into base-files as they are board-specific for the BPi-R64. All other MT7622 boards do have proper populated calibration data.

If he creates an own fork and there is no other way to get these file(s) into the image?

If you build locally (using the buildroot or ImageBuilder) you can pass a list of files to be added to the images using the FILES env variable. I was assuming @svintuss would like to also push what ever is needed upstream.

Is it correct that the R64 has a mt7615? I can only use the 2.4 GHz band of the onboard module?

an older version (with realtek switch) had mt7615 on board, but these are only developement boards, not for sale.

boards with mt7531 have only the mt7622 wifi (2.4GHz) on board

1 Like

Ah okay sad. :confused: Thanks!

1 Like
  1. I don’t know if patch from @frank-w can be pushed upstream. It solves the problem of development boards (like mine) with both mt7622 and mt7615 without calibration data.
  2. I doubt that the calibration data itself could or should be pushed in OpenWRT. It may be copyrighted material of BananaPi and most important it contains a MAC-address.

That being said I would like to make a package that would update mt76 driver to a patched version and at the same time place calibration data files to /lib/firmware/mediatek Is it possible to make a patch to mt76 package Makefile so that upon updating I would only need to place it in patch directory?

Having a package containing the default calibration data for a specific board is acceptable – we do that for the brcmfmac on some RasbPi models in the same way. It just shouldn’t break boards which got proper calibration in flash, so patching mt76 to always load calibration data from a file is not acceptable hence. I don’t think these collection of numerical constants can even be subject to copyright law. And regarding the mac address, we got ways to discard invalid mac and use random instead. For that we just need to make sure that the mac address in the file loaded is actually invalid.

The way @frank-w wrote it should the driver not find a corresponding file in /lib/mediatek/firmware it defaults to EEPROM.

1000-mt76_load_EEPROM_from_file.patch (1.7 KB)

In OpenWrt the root filesystem of all boards of a subtarget is usually shared, hence the mere presence of that file is not a good indicator, as it would either never or always be present for all MT7622 boards (in snapshots and initramfs; for release builds we generate per-device rootfs), ie. as-is this patch will still break wifi on all other MT7622 boards. A (quick and dirty) solution could be to handle the acquisition of the file by the driver in /etc/hotplug.d/firmware and there handle the BPi-R64 as the only case returning the file.

However, the best would actually be to embed the EEPROM into the device-tree or at least hint to an external EEPROM file there, so differentiation would not have to be done in user-space.

Hi, I just received a R64 and am having trouble getting OpenWRT running. Initially, per the OpenWRT wiki, I used the sdcard.img snapshot (built 26/9) which fails with warning that partition fip not found. Building current git head (today 28/9) I still get the same error. Thought it might a SD card incompatibility issue but it still happens with another card.

NOTICE:  BL2: v2.4(release):OpenWrt v2021-05-08-d2c75b21-1 (mt7622-sdmmc-2ddr)
NOTICE:  BL2: Built : 13:38:01, Sep 26 2021
ERROR:   Partition 'fip' not found
PANIC at PC : 0x000000000020473c

Checking with fdisk there is definitely fip partition.

Disk /dev/sdc: 1.87 GiB, 2002780160 bytes, 3911680 sectors
Device      Start    End Sectors  Size Type
/dev/sdc1    1024   2047    1024  512K Linux filesystem (named "bl2")
/dev/sdc2    4096   8191    4096    2M EFI System (named "fip")
/dev/sdc3    8192  10239    2048    1M Linux filesystem (named "ubootenv")
/dev/sdc4   12288  77823   65536   32M Linux filesystem (named "recovery")
/dev/sdc5   77824  92159   14336    7M Linux filesystem (named "install")
/dev/sdc6   92160 524287  432128  211M unknown (named "production")
/dev/sdc128    34   1023     990  495K BIOS boot

There are no recent r64 or mt7622 commits that would appear to cause this other than perhaps uboot mediatek: several fixes for MT7622 from 11/7 but which I’d assume others would have noticed?

Can you get env variables from u-boot?

This error is happening in ATF, trying to load fip image that holds BL31 + U-Boot. So it is before uboot is started…

Make sure you have wiped all remains of previous MBR or GPT partitions before, ie. use

wipefs -a /dev/sdc

before writing to the SD card using

gzip -cd openwrt-mediatek-mt7622-bananapi_bpi-r64-sdcard.img.gz | dd of=/dev/sdc

(both assuming that the SD card was mapped to /dev/sdc on your system)

Running wipefs didn’t make a difference unfortunately. However, using another (much) newer SD card did work using exactly the same image. The other older SD cards were pre-SDHC/SDXC but still working without errors so it may indeed have been a compatibility issue.

Now to see if I can get my untested second hand WLE900VX card recognised given it’s known PCI compatibility issues.

1 Like

As the in-SoC bootrom was able to load ARM Trusted Firmware bl2 even from the older/slower SD card, I wonder if we can improve the mmc driver in TF-A (and possibly U-Boot) to also be a bit more tolerant… @hackpascal ?

Seems to be similar to this: [BPI-R64] New bootchain without U-Boot

Maybe skipping uboot (by using patched atf) is an option?