BPI-R4 | Compilation error. Please help me!


I followed the steps to compile and a compile error occurred:

make[5]: Entering directory ‘/home/slc/BPI-R4-MT76-OPENWRT-V21.02/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/linux-5.4.260’

make[5]: Entering directory ‘/home/slc/BPI-R4-MT76-OPENWRT-V21.02/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/linux-5.4.260’

scripts/Makefile.build:42: /scripts/basic/Makefile: No such file or directory

make[5]: *** No rule to make target ‘/scripts/basic/Makefile’. Stop.

make[5]: Leaving directory ‘/home/slc/BPI-R4-MT76-OPENWRT-V21.02/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/linux-5.4.260’

make[5]: *** [Makefile:530: scripts_basic] Error 2

make[5]: Leaving directory ‘/home/slc/BPI-R4-MT76-OPENWRT-V21.02/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/linux-5.4.260’

make[4]: *** [Makefile:32: /home/slc/BPI-R4-MT76-OPENWRT-V21.02/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/linux-5.4.260/.configured] Error 2

make[4]: Leaving directory ‘/home/slc/BPI-R4-MT76-OPENWRT-V21.02/target/linux/mediatek’

make[3]: *** [Makefile:11: compile] Error 2

Please let me know, how to compile through

dont use the sinovoip version, this will fail if u do a ./scripts/feeds call. either check it out and built it as it is, or use the official openwrt repo and use ./scripts/feeds script. and i highly recommend you to do the later, use the openwrt repo (master/main branch), because the sinovoip version is lacking support of many things (e.g. thermal stuff etc.)

Does it not fail in other place? I commented those two lines: BPI-R4-MT76-OPENWRT-V21.02/package/Makefile at main · BPI-SINOVOIP/BPI-R4-MT76-OPENWRT-V21.02 · GitHub . For me that was an issue.

Also this feed: BPI-R4-MT76-OPENWRT-V21.02/feeds.conf at main · BPI-SINOVOIP/BPI-R4-MT76-OPENWRT-V21.02 · GitHub is wrong, it should be:

src-git mtk_openwrt_feed https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds

You can take a look on my fork (but without mt76) GitHub - danpawlik/BPI-R4-OPENWRT-V21.02 - it was working some time ago

The BPI-R4-MT76-OPENWRT-V21.02 is very hard to compile (like all other repos done in BPI-SINOVOIP are very difficult to build) and it require more internal access for MediaTek resources.

And one more hint: do not do make clean, due it will remove BPI-R4-MT76-OPENWRT-V21.02/staging_dir/target-aarch64_cortex-a53_musl/image at main · BPI-SINOVOIP/BPI-R4-MT76-OPENWRT-V21.02 · GitHub

EDIT: Some time ago I was trying to compile with mt76 and then I spotted an issue: Compilation error · Issue #1 · BPI-SINOVOIP/BPI-R4-MT76-OPENWRT-V21.02 · GitHub - which normally is just ignored by the project maintainers. I continue working on building the image in my fork - you can check my commit message - Make the build pass · danpawlik/BPI-R4-MT76-OPENWRT-V21.02@18a60b6 · GitHub maybe it would be helpful.

1 Like

Thank you very much. I’ll try it

can you tell me whats the reason for using the sinovoip version and not the openwrt main branch? openwrt 21.x is btw. EOL

Mediatek feed provides some features that are not available in OpenWRT (probably because of the license) and also provide some patches that are not backported yet (or maybe they are not needed) to main OpenWRT project.

can you list the features and patches?

You can check openwrt/feeds/mtk-openwrt-feeds - Gitiles .

thanks @danpawlik but i still have this error (used bpi repo which failed, added your repo as remote and cherry-picked your commit):

build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/backports-6.5/net/mac80211/iface.c:942:3: error: 'const struct net_device_ops' has no member named 'ndo_fill_forward_path'; did you mean 'ndo_fill_metadata_dst'?
  .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/backports-6.5/net/mac80211/iface.c:942:27: error: initialization of 'bool (*)(const struct net_device *, int)' {aka '_Bool (*)(const struct net_device *, int)'} from incompatible pointer type 'int (*)(struct net_device_path_ctx *, struct net_device_path *)' [-Werror=incompatible-pointer-types]
  .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/backports-6.5/net/mac80211/iface.c:942:27: note: (near initialization for 'ieee80211_dataif_8023_ops.ndo_has_offload_stats')
cc1: some warnings being treated as errors

any idea?

Hey, I stuck in the same place (or even earlier).

Ok,i thought you have it compilable with your changes

tried fix from @graphine (resetted tree to bpi version)

but it fails in ftdlib

In file included from fdtdump.c:14:
fdtdump.c: In function 'main':
libfdt/libfdt.h:251:28: error: array subscript 'struct fdt_header[0]' is partly outside array bounds of 'unsigned char[4]' [-Werror=array-bounds]
  251 |                 fdth->name = cpu_to_fdt32(val); \
      |                 ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
libfdt/libfdt.h:253:1: note: in expansion of macro 'fdt_set_hdr_'
  253 | fdt_set_hdr_(magic);
      | ^~~~~~~~~~~~
fdtdump.c:216:31: note: while referencing 'smagic'
  216 |                 unsigned char smagic[FDT_MAGIC_SIZE];
      |                               ^~~~~~

anyone got this tree built?

@zuowei8 can you please try to compile with ubuntu 22.04 and cleaned git tree (only public version).

I have addded the patches to an own mt76 repo

And added this as submodule to my kernel-repo…but at least on 6.9 i still get many compile errors

1 Like

Are you still trying to compile the mt76 on bpi’s repo? What do you want done and I can just build it for you with your needed options. If you want to send me your address I can send you a flash drive with a live environment and the image already there and buildable, if it will help development.

I could also build you a working environment with the mt76 bpi repo there and working. I can then use dd to create you a working live image. From there you can flash it to a flash drive and direct grub to boot it.

No,i applied their patches to a mt76 branch for easier following code and added the firmware loading to mainline code. At least the message timeouts are gone now,but i see only 2 phys and get a trace when i try to enable the interfaces

You use ubuntu18 for building? You could upload the original image built from source so i can verify the card works as expected and shows 3 phys

Maybe you can create docker-image which allows building?

Not sure what a docker image is, but explain exactly what you want and I’ll do it. Bringing my build server online now.

A docker image uses https://www.docker.com or https://podman.io to run containerized operating systems on top of your host OS. Similar to a VM, but without the overhead of virtualizing the whole machine.

It allows to keep a well-defined state in a container, without having to change things on your host OS. Useful for building kernel images when you need an older ubuntu version. Or when you want to build U-Boot/OpenWrt on Windows.

Then you also don’t necessarily need a build server, but can instead use the container image in GitHub workflows or locally on your machine.

Interesting. I use a build server because I have two servers at my home. One is for data backup/VPN/media streaming and the other is for building. It builds faster than my laptop. It has 48GB running at 8000mhz and a 14900K. My laptop would take an hour to build an image. That being said I’ll try to make a Docker image. I’ve made many VMs so this shouldn’t be hard.


This is the MT76 BPI r4 I built a couple months ago

I wasted about an hour on podman. Running a vm or running off a flash drive is more dependable.

Can you build the actual code and post image here?

You could setup ubuntu18 in a chroot?

1 Like