BPI-R4 BSP与U-Boot使用求助

我使用这里的代码编译U-Boot成功,但是编译Kernel失败了(wifi-mt7996e驱动)。错误如下:

> make[1]: Entering directory '/home/openwrt/src/BPI-R4-bsp-5.4/linux-mt'
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mmio.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/util.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/trace.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/dma.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mt7996/pci.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mac80211.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/debugfs.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mt7996/init.o
In file included from /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/backports-6.5/backport-include/linux/kernel.h:3,
                 from /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mt76.h:9,
                 from /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mmio.c:6:
./include/linux/kernel.h:6:10: fatal error: stdarg.h: No such file or directory

我使用这里的代码编译U-Boot失败,但是编译Kernel成功了。错误如下

> make -C u-boot-mt O=build_sdmmc mt7988a_bananapi_bpi-r4-sdmmc_config CROSS_COMPILE=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/aarch64-linux-gnu- -j12
make[1]: Entering directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt'
make[2]: Entering directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/build_sdmmc'
  GEN     Makefile
arch/../configs/mt7988a_bananapi_bpi-r4-sdmmc_defconfig:163:warning: override: reassigning to symbol PINCTRL_MT7988
#
# configuration written to .config
#
make[2]: Leaving directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/build_sdmmc'
make[1]: Leaving directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt'
make -C u-boot-mt O=build_sdmmc CROSS_COMPILE=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/aarch64-linux-gnu- -j12 LOCALVERSION="-BPI-R4-r24894-4d30d371e7" PKG_CONFIG_EXTRAARGS="--static" V='' u-boot.bin
make[1]: Entering directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt'
make[2]: Entering directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/build_sdmmc'
  GEN     Makefile
scripts/kconfig/conf  --syncconfig Kconfig
  CFG     u-boot.cfg
  GEN     include/autoconf.mk.dep
  GEN     include/autoconf.mk
  GEN     Makefile
  UPD     include/generated/timestamp_autogenerated.h
  ENVC    include/generated/env.txt
  Using .. as source for U-Boot
  .. is not clean, please run 'make mrproper'
  in the '..' directory.
make[2]: *** [/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/Makefile:1891: prepare3] Error 1
make[2]: Leaving directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/build_sdmmc'
make[1]: *** [Makefile:177: sub-make] Error 2
make[1]: Leaving directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt'
make: *** [Makefile:56: u-boot_sdmmc] Error 2

Build failed!

U-Boot编译成功后会产生u-boot-mt/build_emmc/u-boot.bin,u-boot-mt/build_sdmmc/u-boot.bin两个uboot镜像,我怎么把u-boot.bin刷到nand flash中,另外bsp 6.1中的u-boot和bsp 5.4中的kernel如何才能编译成功。

这个6.1的bsp似乎没有wifi的驱动支持?

还有nand flash中的u-boot损坏是否会影响sd卡启动功能?

I used the code here to compile U-Boot successfully, but failed to compile the kernel (wifi-mt7996e driver).The error is as follows:

make[1]: Entering directory '/home/openwrt/src/BPI-R4-bsp-5.4/linux-mt'
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mmio.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/util.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/trace.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/dma.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mt7996/pci.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mac80211.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/debugfs.o
  CC [M]  /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mt7996/init.o
In file included from /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/backports-6.5/backport-include/linux/kernel.h:3,
                 from /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mt76.h:9,
                 from /home/openwrt/src/BPI-R4-bsp-5.4/wifi-mt7996e/mt76-2023-12-18-bebd9cff/mmio.c:6:
./include/linux/kernel.h:6:10: fatal error: stdarg.h: No such file or directory

I used the code here to compile U-Boot failed, but compiled the kernel successfully.

make -C u-boot-mt O=build_sdmmc mt7988a_bananapi_bpi-r4-sdmmc_config CROSS_COMPILE=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/aarch64-linux-gnu- -j12
make[1]: Entering directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt'
make[2]: Entering directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/build_sdmmc'
  GEN     Makefile
arch/../configs/mt7988a_bananapi_bpi-r4-sdmmc_defconfig:163:warning: override: reassigning to symbol PINCTRL_MT7988
#
# configuration written to .config
#
make[2]: Leaving directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/build_sdmmc'
make[1]: Leaving directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt'
make -C u-boot-mt O=build_sdmmc CROSS_COMPILE=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/aarch64-linux-gnu- -j12 LOCALVERSION="-BPI-R4-r24894-4d30d371e7" PKG_CONFIG_EXTRAARGS="--static" V='' u-boot.bin
make[1]: Entering directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt'
make[2]: Entering directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/build_sdmmc'
  GEN     Makefile
scripts/kconfig/conf  --syncconfig Kconfig
  CFG     u-boot.cfg
  GEN     include/autoconf.mk.dep
  GEN     include/autoconf.mk
  GEN     Makefile
  UPD     include/generated/timestamp_autogenerated.h
  ENVC    include/generated/env.txt
  Using .. as source for U-Boot
  .. is not clean, please run 'make mrproper'
  in the '..' directory.
make[2]: *** [/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/Makefile:1891: prepare3] Error 1
make[2]: Leaving directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt/build_sdmmc'
make[1]: *** [Makefile:177: sub-make] Error 2
make[1]: Leaving directory '/home/openwrt/src/BPI-R4-bsp-6.1/u-boot-mt'
make: *** [Makefile:56: u-boot_sdmmc] Error 2

 Build failed!

After U-Boot is successfully compiled, two uboot images will be generated: u-boot-mt/build_emmc/u-boot.bin and u-boot-mt/build_sdmmc/u-boot.bin. How can I flash u-boot.bin to nand flash? In addition, how can the u-boot in bsp 6.1 and the kernel in bsp 5.4 be compiled successfully?

This 6.1 bsp does not seem to have wifi driver support?

Also, will the damage of u-boot in nand flash affect the sd card boot function?

It is stated in the BPI document that there is no MT76 wifi driver in the 6.1 kernel

please use the build.sh script to compile all images.

I always use build.sh.

fatal error: stdarg.h: No such file or directory

I solved this problem by create stdarg.h in wifi-mt7996e/backports-6.5/include,the stdarg.h file contents is:

// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef _LINUX_STDARG_H
#define _LINUX_STDARG_H

typedef __builtin_va_list va_list;
#define va_start(v, l)	__builtin_va_start(v, l)
#define va_end(v)	__builtin_va_end(v)
#define va_arg(v, T)	__builtin_va_arg(v, T)
#define va_copy(d, s)	__builtin_va_copy(d, s)

#endif
is not clean, please run 'make mrproper'

There is no solution to this problem