BPI-R4-MT76-OPENWRT-V21.02. build Error

1.git clone GitHub - BPI-SINOVOIP/BPI-R4-MT76-OPENWRT-V21.02

  1. ./scripts/feeds update -a

  2. ./scripts/feeds install -a

  3. make -j1 V=s

then display

In fact, the file is there

This is reported multiple times…

No feeds update / install as it breaks things and the you need old buildchain (ubuntu 18.4). Tried with ubuntu 22 and was not able to compile,u18 was working so far.

R4 is supported by mainline openwrt except rss+lro and the wifi7 card.

1.git clone GitHub - BPI-SINOVOIP/BPI-R4-MT76-OPENWRT-V21.02

  1. make -j1 V=s

compile environment is on ubuntu -18.04 x64.

you can refer to this file to build the image. https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/refs/heads/master/autobuild_mac80211_release/Release.md

I’ve written some steps and uploaded my build-environment (chroot) here:

Had not got fit images loaded via my uboot because of the size,but was able to build and flash in an ubuntu 18 chroot inside my ubuntu 22 :slight_smile:

thanks,default .config can build.

when i enable .config CONFIG_PACKAGE_kmod-mediatek_hnat=y

build error

the error infomation:

scripts/kconfig/conf  --syncconfig Kconfig
net/sched/Kconfig:45: warning: menuconfig statement without prompt
  CALL    scripts/atomic/check-atomics.sh
  CALL    scripts/checksyscalls.sh
  CC [M]  drivers/net/ethernet/mediatek/mtk_hnat/hnat.o
  CC [M]  drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.o
In file included from drivers/net/ethernet/mediatek/mtk_hnat/nf_hnat_mtk.h:19,
                 from drivers/net/ethernet/mediatek/mtk_hnat/hnat.c:25:
drivers/net/ethernet/mediatek/mtk_hnat/../mtk_eth_soc.h:2085:59: error: 'struct flow_block_offload' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 int mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f,
                                                           ^~~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/mediatek/mtk_hnat/hnat.c:26:
drivers/net/ethernet/mediatek/mtk_hnat/hnat.h:1256:17: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
          struct flow_offload_hw_path *hw_path,
                 ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:30:
drivers/net/ethernet/mediatek/mtk_hnat/hnat.h:1256:17: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
          struct flow_offload_hw_path *hw_path,
                 ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'nf_hnat_netdevice_event':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:244:25: error: 'const struct net_device_ops' has no member named 'ndo_flow_offload_check'; did you mean 'ndo_has_offload_stats'?
       !dev->netdev_ops->ndo_flow_offload_check)
                         ^~~~~~~~~~~~~~~~~~~~~~
                         ndo_has_offload_stats
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'hnat_set_iif':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:605:30: error: 'const struct net_device_ops' has no member named 'ndo_flow_offload_check'; did you mean 'ndo_has_offload_stats'?
   if (state->in->netdev_ops->ndo_flow_offload_check) {
                              ^~~~~~~~~~~~~~~~~~~~~~
                              ndo_has_offload_stats
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'mtk_hnat_ipv4_nf_pre_routing':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:835:30: error: storage size of 'hw_path' isn't known
  struct flow_offload_hw_path hw_path;
                              ^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:859:31: error: 'const struct net_device_ops' has no member named 'ndo_flow_offload_check'; did you mean 'ndo_has_offload_stats'?
      && skb->dev->netdev_ops->ndo_flow_offload_check) {
                               ^~~~~~~~~~~~~~~~~~~~~~
                               ndo_has_offload_stats
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:860:25: error: 'const struct net_device_ops' has no member named 'ndo_flow_offload_check'; did you mean 'ndo_has_offload_stats'?
   skb->dev->netdev_ops->ndo_flow_offload_check(&hw_path);
                         ^~~~~~~~~~~~~~~~~~~~~~
                         ndo_has_offload_stats
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:862:23: error: 'FLOW_OFFLOAD_PATH_TNL' undeclared (first use in this function); did you mean 'FLOW_OFFLOAD_DIR_MAX'?
   if (hw_path.flags & FLOW_OFFLOAD_PATH_TNL)
                       ^~~~~~~~~~~~~~~~~~~~~
                       FLOW_OFFLOAD_DIR_MAX
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:862:23: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:835:30: error: unused variable 'hw_path' [-Werror=unused-variable]
  struct flow_offload_hw_path hw_path;
                              ^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: At top level:
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:992:15: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
        struct flow_offload_hw_path *hw_path)
               ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'hnat_ipv6_get_nexthop':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1000:13: error: dereferencing pointer to incomplete type 'struct flow_offload_hw_path'
  if (hw_path->flags & FLOW_OFFLOAD_PATH_PPPOE) {
             ^~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1000:23: error: 'FLOW_OFFLOAD_PATH_PPPOE' undeclared (first use in this function); did you mean 'FLOW_OFFLOAD_DIR_REPLY'?
  if (hw_path->flags & FLOW_OFFLOAD_PATH_PPPOE) {
                       ^~~~~~~~~~~~~~~~~~~~~~~
                       FLOW_OFFLOAD_DIR_REPLY
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: At top level:
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1050:15: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
        struct flow_offload_hw_path *hw_path)
               ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'hnat_ipv4_get_nexthop':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1058:13: error: dereferencing pointer to incomplete type 'struct flow_offload_hw_path'
  if (hw_path->flags & FLOW_OFFLOAD_PATH_PPPOE) {
             ^~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1058:23: error: 'FLOW_OFFLOAD_PATH_PPPOE' undeclared (first use in this function); did you mean 'FLOW_OFFLOAD_DIR_REPLY'?
  if (hw_path->flags & FLOW_OFFLOAD_PATH_PPPOE) {
                       ^~~~~~~~~~~~~~~~~~~~~~~
                       FLOW_OFFLOAD_DIR_REPLY
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: At top level:
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1109:14: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
       struct flow_offload_hw_path *hw_path)
              ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'ppe_fill_L2_info':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1118:38: error: dereferencing pointer to incomplete type 'struct flow_offload_hw_path'
   entry.ipv4_hnapt.pppoe_id = hw_path->pppoe_sid;
                                      ^~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: At top level:
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1139:15: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
        struct flow_offload_hw_path *hw_path)
               ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'ppe_fill_info_blk':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1141:28: error: dereferencing pointer to incomplete type 'struct flow_offload_hw_path'
  entry.bfib1.psn = (hw_path->flags & FLOW_OFFLOAD_PATH_PPPOE) ? 1 : 0;
                            ^~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1141:38: error: 'FLOW_OFFLOAD_PATH_PPPOE' undeclared (first use in this function); did you mean 'FLOW_OFFLOAD_DIR_REPLY'?
  entry.bfib1.psn = (hw_path->flags & FLOW_OFFLOAD_PATH_PPPOE) ? 1 : 0;
                                      ^~~~~~~~~~~~~~~~~~~~~~~
                                      FLOW_OFFLOAD_DIR_REPLY
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1142:46: error: 'FLOW_OFFLOAD_PATH_VLAN' undeclared (first use in this function); did you mean 'FLOW_OFFLOAD_DIR_MAX'?
  entry.bfib1.vlan_layer += (hw_path->flags & FLOW_OFFLOAD_PATH_VLAN) ? 1 : 0;
                                              ^~~~~~~~~~~~~~~~~~~~~~
                                              FLOW_OFFLOAD_DIR_MAX
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: At top level:
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1195:16: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
         struct flow_offload_hw_path *hw_path)
                ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'get_ipv6_ipip_ethhdr':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1200:13: error: dereferencing pointer to incomplete type 'struct flow_offload_hw_path'
  if (hw_path->flags & FLOW_OFFLOAD_PATH_PPPOE)
             ^~
cc1: all warnings being treated as errors
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1200:23: error: 'FLOW_OFFLOAD_PATH_PPPOE' undeclared (first use in this function); did you mean 'FLOW_OFFLOAD_DIR_REPLY'?
  if (hw_path->flags & FLOW_OFFLOAD_PATH_PPPOE)
                       ^~~~~~~~~~~~~~~~~~~~~~~
                       FLOW_OFFLOAD_DIR_REPLY
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: At top level:
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1211:17: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
          struct flow_offload_hw_path *hw_path)
                 ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'skb_to_hnat_info':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1234:35: error: passing argument 2 of 'get_ipv6_ipip_ethhdr' from incompatible pointer type [-Werror=incompatible-pointer-types]
   eth = get_ipv6_ipip_ethhdr(skb, hw_path);
                                   ^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1195:38: note: expected 'struct flow_offload_hw_path *' but argument is of type 'struct flow_offload_hw_path *'
         struct flow_offload_hw_path *hw_path)
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1323:38: error: dereferencing pointer to incomplete type 'struct flow_offload_hw_path'
     entry.ipv4_dslite.vlan1 = hw_path->vlan_id;
                                      ^~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1689:39: error: passing argument 3 of 'ppe_fill_L2_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
  entry = ppe_fill_L2_info(eth, entry, hw_path);
                                       ^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1109:36: note: expected 'struct flow_offload_hw_path *' but argument is of type 'struct flow_offload_hw_path *'
       struct flow_offload_hw_path *hw_path)
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1692:40: error: passing argument 3 of 'ppe_fill_info_blk' from incompatible pointer type [-Werror=incompatible-pointer-types]
  entry = ppe_fill_info_blk(eth, entry, hw_path);
                                        ^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1139:37: note: expected 'struct flow_offload_hw_path *' but argument is of type 'struct flow_offload_hw_path *'
        struct flow_offload_hw_path *hw_path)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1696:46: error: passing argument 3 of 'hnat_dsa_fill_stag' from incompatible pointer type [-Werror=incompatible-pointer-types]
    port_id = hnat_dsa_fill_stag(dev, &entry, hw_path,
                                              ^~~~~~~
In file included from drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:30:
drivers/net/ethernet/mediatek/mtk_hnat/hnat.h:1256:39: note: expected 'struct flow_offload_hw_path *' but argument is of type 'struct flow_offload_hw_path *'
          struct flow_offload_hw_path *hw_path,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:1709:45: error: passing argument 3 of 'hnat_dsa_fill_stag' from incompatible pointer type [-Werror=incompatible-pointer-types]
    port_id = hnat_dsa_fill_stag(dev,&entry, hw_path,
                                             ^~~~~~~
In file included from drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:30:
drivers/net/ethernet/mediatek/mtk_hnat/hnat.h:1256:39: note: expected 'struct flow_offload_hw_path *' but argument is of type 'struct flow_offload_hw_path *'
          struct flow_offload_hw_path *hw_path,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
scripts/Makefile.build:262: recipe for target 'drivers/net/ethernet/mediatek/mtk_hnat/hnat.o' failed
make[10]: *** [drivers/net/ethernet/mediatek/mtk_hnat/hnat.o] Error 1
make[10]: *** Waiting for unfinished jobs....
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: At top level:
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2674:14: error: 'struct flow_offload_hw_path' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
       struct flow_offload_hw_path *),
              ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'mtk_hnat_nf_post_routing':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2678:9: error: variable 'hw_path' has initializer but incomplete type
  struct flow_offload_hw_path hw_path = { .dev = (struct net_device*)out,
         ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2678:43: error: 'struct flow_offload_hw_path' has no member named 'dev'
  struct flow_offload_hw_path hw_path = { .dev = (struct net_device*)out,
                                           ^~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2678:49: error: excess elements in struct initializer [-Werror]
  struct flow_offload_hw_path hw_path = { .dev = (struct net_device*)out,
                                                 ^
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2678:49: note: (near initialization for 'hw_path')
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2679:8: error: 'struct flow_offload_hw_path' has no member named 'virt_dev'
       .virt_dev = (struct net_device*)out };
        ^~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2679:19: error: excess elements in struct initializer [-Werror]
       .virt_dev = (struct net_device*)out };
                   ^
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2679:19: note: (near initialization for 'hw_path')
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2678:30: error: storage size of 'hw_path' isn't known
  struct flow_offload_hw_path hw_path = { .dev = (struct net_device*)out,
                              ^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2698:23: error: 'const struct net_device_ops' has no member named 'ndo_flow_offload_check'; did you mean 'ndo_has_offload_stats'?
  if (out->netdev_ops->ndo_flow_offload_check) {
                       ^~~~~~~~~~~~~~~~~~~~~~
                       ndo_has_offload_stats
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2699:20: error: 'const struct net_device_ops' has no member named 'ndo_flow_offload_check'; did you mean 'ndo_has_offload_stats'?
   out->netdev_ops->ndo_flow_offload_check(&hw_path);
                    ^~~~~~~~~~~~~~~~~~~~~~
                    ndo_has_offload_stats
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2678:30: error: unused variable 'hw_path' [-Werror=unused-variable]
  struct flow_offload_hw_path hw_path = { .dev = (struct net_device*)out,
                              ^~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'mtk_hnat_ipv6_nf_post_routing':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2848:49: error: passing argument 3 of 'mtk_hnat_nf_post_routing' from incompatible pointer type [-Werror=incompatible-pointer-types]
  if (!mtk_hnat_nf_post_routing(skb, state->out, hnat_ipv6_get_nexthop,
                                                 ^~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2673:17: note: expected 'unsigned int (*)(struct sk_buff *, const struct net_device *, struct flow_offload_hw_path *)' but argument is of type 'unsigned int (*)(struct sk_buff *, const struct net_device *, struct flow_offload_hw_path *)'
  unsigned int (*fn)(struct sk_buff *, const struct net_device *,
  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       struct flow_offload_hw_path *),
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c: In function 'mtk_hnat_ipv4_nf_post_routing':
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2874:49: error: passing argument 3 of 'mtk_hnat_nf_post_routing' from incompatible pointer type [-Werror=incompatible-pointer-types]
  if (!mtk_hnat_nf_post_routing(skb, state->out, hnat_ipv4_get_nexthop,
                                                 ^~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c:2673:17: note: expected 'unsigned int (*)(struct sk_buff *, const struct net_device *, struct flow_offload_hw_path *)' but argument is of type 'unsigned int (*)(struct sk_buff *, const struct net_device *, struct flow_offload_hw_path *)'
  unsigned int (*fn)(struct sk_buff *, const struct net_device *,
  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       struct flow_offload_hw_path *),
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:262: recipe for target 'drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.o' failed

Moderated…please use code formatting for better readability

Please don’t enable this compiler flag because it is the proptirtary hnat module to work with mtk proprietary wifi driver.

For open source mt76 wifi driver, it uses flowblock-based hnat instead and is enabled by default.

開源BSP並沒有使用到傳統的nf_hnat module, 而是使用upstream的flowblock hnat架構 預設都已經打開了,不用額外再去開啟nf_hnat, 那是搭配logan driver使用的…

上面是MTK原厂的回复

Do you mean that you do not choose to compile this, but also have the official HNAT ?

Please write in english

Translation by Google:

The open source BSP does not use the traditional nf_hnat module, but uses the upstream flowblock hnat architecture. The default is already turned on, so there is no need to turn on nf_hnat additionally. It is used with the logan driver…

The above is the reply from MTK original factory

Hello, please tell me that the firmware is turned on by default, please tell me: R4 Did he turn on 3 PPE by default? Is the number of connections 32K?

你好, 请问新驱动编译后的固件默認打開了硬件加速,那請問一下: R4 他是默認開了3 個PPE了嗎? 每个PPE的連接數有32K嗎?

Default setting is 3 x PPE with 4K table size.

with 4K table size is too small which file can i modify it?

try to trace mtk_ppe.h, then you can find the answer.