[BPI-R2] internal Wifi/BT (MT6625L) - Kernel

Hi, i make a separate Thread for Wifi-Integration because main-Thread gets confusing…

wifi-driver in 4.4.70 seems to work well…can anybody help me integrating Wifi-Driver from 4.4.70 to Mainline-Kernel?

i have tried to copy the drivers/misc/mediatek-folder from 4.4.70 to 4.14 and added that in Makefile and Kconfig

i can select the driver in menuconfig, but on build i end up in missing port_ipc.h, which i did not find also in 4.4.70

regards Frank

2 Likes

I can help,I got experience in developing but not kernel,if you will do a quick introduction I will try to help

i’m not a professional programmer, so my attempt is to copy the working driver from 4.4.70 into the sourcetree of 4.14/15 an try to integrate it.

  1. download 4.14:

    git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

  2. download source of bpi-r2-repo:

    git clone https://github.com/BPI-SINOVOIP/BPI-R2-bsp

  3. copy the folder “mediatek” to drivers/misc/ of kernel 4.14:

    cp -r BPI-R2-bsp/linux-mt/drivers/misc/mediatek linux-stable/drivers/misc/

  4. now add the mediatek-folder to Makefile and Kconfig:

Add line

source "drivers/misc/mediatek/Kconfig"

to linux-stable/drivers/misc/Kconfig before “endmenu” (like it’s done here)

Add line

obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/

to the end of linux-stable/drivers/misc/Makefile like it’s done here

  1. if you use my script to build (build.sh (1,6 KB) ) (in folder linux-stable) and my config mt7623n_evb_fwu_defconfig (5,0 KB) above “linux-stable”

you should be able to start build-process using this commands inside “linux-stable”:

./build.sh importconfig
./build.sh

you came till the point

CC      drivers/misc/mediatek/conn_md/conn_md.o
In file included from drivers/misc/mediatek/conn_md/include/conn_md.h:17:0,
                 from drivers/misc/mediatek/conn_md/conn_md.c:15:
drivers/misc/mediatek/conn_md/include/conn_md_exp.h:17:90: fatal error: port_ipc.h: Datei oder Verzeichnis nicht gefunden
 #include "port_ipc.h"  /*data structure is defined here, mediatek/kernel/drivers/eccci */

without doing anything else…but that file does not exist in 4.4.70 tree…

linux-stable$ find .. -name 'port_ipc.h'

regards frank

1 Like

Hi Frank!
I looked into this and conn_md is module which enables LTE support in MTK devices,so i suggest to disable it. Just comment line

source “drivers/misc/mediatek/conn_md/Kconfig”

In file

drivers/misc/mediatek/Kconfig

And it builds with success
Link where i found it LINK

1 Like

Nice next step is to enable the driver to be compiled

CONFIG_MTK_COMBO=y
CONFIG_MTK_COMBO_CHIP_CONSYS_7623=y
CONFIG_MTK_COMBO_COMM=y
CONFIG_MTK_COMBO_WIFI=y

And maybe CONFIG_MTK_BTIF=y and CONFIG_MTK_COMBO_BT=y for Bluetooth

mt7623n_evb_fwu_defconfig (5,2 KB)

now i added the DTS-Sections…

mt7623.dtsi_beforewifi (23,7 KB) mt7623n-bananapi-bpi-r2.dts_beforewifi (9,6 KB) mt7623n-bananapi-bpi-r2.dts_withwifi (10,6 KB) mt7623.dtsi_withwifi (26,6 KB)

dts(i) compiles without errors :slight_smile:

ok, some depencies have now be fixed…

  • enable_irq i’ve found in “linux/interrupt.h” is needed in drivers/misc/mediatek/connectivity/common/common_detect/mtk_wcn_stub_alps.c

  • linux/wakelock.h is missing:

    linux-stable$ cp …/BPI-R2-bsp/linux-mt/include/linux/wakelock.h include/linux/

now it comes back to conn_md :frowning:

  CC      drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.o
In file included from drivers/misc/mediatek/connectivity/common/conn_soc/core/include/wmt_lib.h:30:0,
                 from drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c:41:
drivers/misc/mediatek/connectivity/common/conn_soc/linux/include/wmt_idc.h:25:25: fatal error: conn_md_exp.h: Datei oder Verzeichnis nicht gefunden
 #include "conn_md_exp.h"

in the moment i add conn_md to makefile (not Kconfig), i got the error for “port_ipc.h”

before the include in wmt_idc.h there is a

if CFG_WMT_LTE_COEX_HANDLING

this seems no constant in menuconfig (did not found it)…must be defined in code…found it here:

drivers/misc/mediatek/connectivity/common/common_detect/wmt_stp_exp.h

#if (WMT_IDC_SUPPORT)
#define CFG_WMT_LTE_COEX_HANDLING 1
#define CFG_WMT_LTE_ENABLE_MSGID_MAPPING 0
#else
#define CFG_WMT_LTE_COEX_HANDLING 0
#endif

drivers/misc/mediatek/connectivity/Makefile

ifeq ($(CONFIG_MTK_CONN_LTE_IDC_SUPPORT),y)
    subdir-ccflags-y += -D WMT_IDC_SUPPORT=1
else
    subdir-ccflags-y += -D WMT_IDC_SUPPORT=0
endif

CONFIG_MTK_CONN_LTE_IDC_SUPPORT is now the kernel-option, which is set by default:

drivers/misc/mediatek/connectivity/Kconfig:

config MTK_CONN_LTE_IDC_SUPPORT
    bool "MediaTek CONN LTE IDC support"
    select MTK_CONN_MD
    default y      <<<<<<<<<<<<<<<<<
    help
      This option enables CONN LTE IDC support
  • #define GENL_ID_GENERATE 0” must be added to include/uapi/linux/genetlink.h:31
  • add functions “__genl_register_family” and “genl_register_family_with_ops” to include/net/genetlink.h genetlink.h (13,5 KB)
  • add “#include <linux/sched/debug.h>” to “drivers/misc/mediatek/connectivity/common/conn_soc/linux/include/osal.h” line 25

current codebase inside (without change in osal.h) drivers/misc/mediatek: https://drive.google.com/file/d/1jiecrynd2SjSI6kVK-fFyIp0x1269fYG/view?usp=sharing

now that:

cat: drivers/misc/mediatek/connectivity/common/conn_soc//modules.order: inputfile is outputfile

looked in drivers/misc/mediatek/connectivity/common/conn_soc/Makefile, but there is nothing be done with modules.order…where does this cat-command come from?? i see that between “conn_soc” and “modules.order” are 2 “/” so it seems that there is a undefined variable in the path

the cat seems to a generic command (maybe from main Makefile), but how to find the problematic line in code?

all changes in one patch (thanks to gary for most of that,added/changed my stuff): https://drive.google.com/file/d/1lLU8HxVOppntQVCtmG8PSpZq4jhAG1dP/view?usp=sharing

ok, fixed the modules.order-problem…

drivers/misc/mediatek/connectivity/common/conn_soc/Makefile:

- obj-y += $(subst ",,$(CONFIG_MTK_PLATFORM))/
+ obj-y += mt7623/

or set (maybe this should be done automaticly when selecting MTK_COMBO_CHIP_CONSYS_7623 in drivers/misc/_mediatek/connectivity/Kconfig)

CONFIG_MTK_PLATFORM="mt7623"

now build-progress continues…

changing “if CONFIG_NL80211_TESTMODE” to “ifdef CONFIG_NL80211_TESTMODE” in these 3 files:

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_p2p_os.h
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_os.h
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_p2p_ioctl.h

edit: added these to patch on google-drive till this point…

then you get the #error for that you need to set CONFIG_NL80211_TESTMODE in kernel-config

now the errors come that i’ expecting (compatibility issues from wireless-libs):

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:1839:2: error: too few arguments to function ‘cfg80211_sched_scan_stopped’
  cfg80211_sched_scan_stopped(priv_to_wiphy(prGlueInfo));
  ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_os.h:591:0,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:670:
./include/net/cfg80211.h:4621:6: note: declared here
 void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);

here i need help from someone which has more knowledge about wireless drivers…

@reqid: identifier for the related scheduled scan request

i assume that i can’t simply use any u64 as reqID :slight_smile: maybe i can…here it’s done (set to 0) for other chipsets: https://patchwork.kernel.org/patch/9573813/

added that 0-param :wink: next step is to add

WIPHY_FLAG_SUPPORTS_SCHED_SCAN      = BIT(11),

to include/net/cfg80211.h

  CC      drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.o
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:885:2: error: initialization from incompatible pointer type [-Werror]
  .change_virtual_intf = mtk_cfg80211_change_iface,
  ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:885:2: error: (near initialization for ‘mtk_wlan_ops.change_virtual_intf’) [-Werror]
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:920:2: error: initialization from incompatible pointer type [-Werror]
  .sched_scan_stop = mtk_cfg80211_sched_scan_stop,
  ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:920:2: error: (near initialization for ‘mtk_wlan_ops.sched_scan_stop’) [-Werror]

As i see mtk_cfg80211_change_iface has a param flags,which is not existent in 4.14… commented it out in both files:

$ nano drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_cfg80211.h
$ nano drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.c

mtk_cfg80211_sched_scan_stop is missing last param “u64 reqid”, added to above 2 files, changed in patch

  CC      drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c: In function ‘kalRxIndicatePkts’:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1602:11: error: ‘struct net_device’ has no member named ‘last_rx’
   prNetDev->last_rx = jiffies;
           ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c: In function ‘kalIndicateStatusAndComplete’:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1752:5: error: implicit declaration of function ‘cfg80211_roamed_bss’ [-Werror=implicit-function-declaration]
     cfg80211_roamed_bss(prGlueInfo->prDevHandler,
     ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c: In function ‘kalSchedScanResults’:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4424:2: error: too few arguments to function ‘cfg80211_sched_scan_results’
  cfg80211_sched_scan_results(priv_to_wiphy(prGlueInfo));
  ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_os.h:591:0,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:699:
./include/net/cfg80211.h:4609:6: note: declared here
 void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
      ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c: In function ‘kalHaltLock’:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4520:5: error: implicit declaration of function ‘show_stack’ [-Werror=implicit-function-declaration]
     show_stack(prGlueInfo->main_thread, NULL);
     ^

First one i have no idea to fix…adding the member to the struct seems not the right way,or am i wrong? The other errors should be easy.

Hi Frank

Just for you reference, we’ve merged the driver of MT6625 to lede project(Kernel 4.9.44), looks like both STA and AP are working, you can get the patch from below link:

Commits:

1 Like

thank you, cloning new 14.4 and patching with the new…

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c add “#include <linux/sched/debug.h>” (show_stack)

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4427 added 0-param for reqid:

 cfg80211_sched_scan_results(priv_to_wiphy(prGlueInfo),0);

added “cfg80211_roamed_bss” to include/net/cfg80211.h

still hang on

  CC      drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c: In function ‘kalRxIndicatePkts’:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1605:11: error: ‘struct net_device’ has no member named ‘last_rx’
   prNetDev->last_rx = jiffies;
           ^

Found that: https://patchwork.ozlabs.org/patch/716831/

@garywang is this field really needed (or “abused” like described on link), i found only 2 lines where last_rx is set, but nowhere it is read…

drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.c:221:	prNetDev->last_rx = jiffies;
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1605:		prNetDev->last_rx = jiffies;

full diff against 4.14.4 HEAD: https://drive.google.com/file/d/1E_hScEzwjD7Lu7UcmVy7xOP1pMX2GyOC/view?usp=sharing

if 2 lines of last_rx are commented out (not yet in patch) these are the following errors:

  CC      drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o
In file included from ./include/linux/netlink.h:10:0,
                 from ./include/net/netlink.h:6,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c: In function ‘mtk_cfg80211_vendor_set_config’:
./include/uapi/linux/netlink.h:231:52: error: too few arguments to function ‘nla_parse_nested’
 #define NLA_HDRLEN  ((int) NLA_ALIGN(sizeof(struct nlattr)))
                                                    ^
./include/uapi/linux/netlink.h:230:28: note: in definition of macro ‘NLA_ALIGN’
 #define NLA_ALIGN(len)  (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
                            ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:313:81: note: in expansion of macro ‘NLA_HDRLEN’
  nla_parse_nested(attr, GSCAN_ATTRIBUTE_REPORT_EVENTS, (struct nlattr *)(data - NLA_HDRLEN), nla_parse_policy);
                                                                                 ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:0:
./include/net/netlink.h:760:19: note: declared here
 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                   ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:336:4: error: too few arguments to function ‘nla_parse_nested’
    nla_parse_policy) < 0)
    ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:0:
./include/net/netlink.h:760:19: note: declared here
 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                   ^
In file included from ./include/linux/netlink.h:10:0,
                 from ./include/net/netlink.h:6,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c: In function ‘mtk_cfg80211_vendor_set_scan_config’:
./include/uapi/linux/netlink.h:231:52: error: too few arguments to function ‘nla_parse_nested’
 #define NLA_HDRLEN  ((int) NLA_ALIGN(sizeof(struct nlattr)))
                                                    ^
./include/uapi/linux/netlink.h:230:28: note: in definition of macro ‘NLA_ALIGN’
 #define NLA_ALIGN(len)  (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
                            ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:439:28: note: in expansion of macro ‘NLA_HDRLEN’
   (struct nlattr *)(data - NLA_HDRLEN), nla_parse_policy) < 0)
                            ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:0:
./include/net/netlink.h:760:19: note: declared here
 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                   ^
In file included from ./include/linux/netlink.h:10:0,
                 from ./include/net/netlink.h:6,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c: In function ‘mtk_cfg80211_vendor_set_significant_change’:
./include/uapi/linux/netlink.h:231:52: error: too few arguments to function ‘nla_parse_nested’
 #define NLA_HDRLEN  ((int) NLA_ALIGN(sizeof(struct nlattr)))
                                                    ^
./include/uapi/linux/netlink.h:230:28: note: in definition of macro ‘NLA_ALIGN’
 #define NLA_ALIGN(len)  (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
                            ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:508:28: note: in expansion of macro ‘NLA_HDRLEN’
   (struct nlattr *)(data - NLA_HDRLEN), nla_parse_policy) < 0)
                            ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:0:
./include/net/netlink.h:760:19: note: declared here
 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                   ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:546:65: error: too few arguments to function ‘nla_parse_nested’
   if (nla_parse_nested(attr, GSCAN_ATTRIBUTE_RSSI_HIGH, (struct nlattr *)paplist, nla_parse_policy) < 0)
                                                                 ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:0:
./include/net/netlink.h:760:19: note: declared here
 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                   ^
In file included from ./include/linux/netlink.h:10:0,
                 from ./include/net/netlink.h:6,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c: In function ‘mtk_cfg80211_vendor_set_hotlist’:
./include/uapi/linux/netlink.h:231:52: error: too few arguments to function ‘nla_parse_nested’
 #define NLA_HDRLEN  ((int) NLA_ALIGN(sizeof(struct nlattr)))
                                                    ^
./include/uapi/linux/netlink.h:230:28: note: in definition of macro ‘NLA_ALIGN’
 #define NLA_ALIGN(len)  (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
                            ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:630:78: note: in expansion of macro ‘NLA_HDRLEN’
  if (nla_parse_nested(attr, GSCAN_ATTRIBUTE_NUM_AP, (struct nlattr *)(data - NLA_HDRLEN), nla_parse_policy) < 0)
                                                                              ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:0:
./include/net/netlink.h:760:19: note: declared here
 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                   ^
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:660:65: error: too few arguments to function ‘nla_parse_nested’
   if (nla_parse_nested(attr, GSCAN_ATTRIBUTE_RSSI_HIGH, (struct nlattr *)paplist, nla_parse_policy) < 0)
                                                                 ^
In file included from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:49:0:
./include/net/netlink.h:760:19: note: declared here
 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                   ^

include/net/netlink.h:

static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                   const struct nlattr *nla,
                   const struct nla_policy *policy,
                   struct netlink_ext_ack *extack)

seems that the last param (struct netlink_ext_ack *extack) is missing…can do it like here (using NULL): http://elixir.free-electrons.com/linux/v4.14.4/source/net/core/rtnetlink.c#L1561 vendor.c.diff (4,1 KB)

  CC      drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_proc.o
In file included from ./include/asm-generic/preempt.h:5:0,
                 from ./arch/arm/include/generated/asm/preempt.h:1,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/ktime.h:24,
                 from ./include/linux/timer.h:6,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_os.h:536,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/include/precomp.h:171,
                 from drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_proc.c:65:
In function ‘check_copy_size’,
    inlined from ‘copy_from_user’ at ./include/linux/uaccess.h:146:6,
    inlined from ‘procDbgLevelWrite’ at drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_proc.c:509:20:
./include/linux/thread_info.h:141:17: error: call to ‘__bad_copy_to’ declared with attribute error: copy destination size is too small
    __bad_copy_to();
                 ^
In function ‘check_copy_size’,
    inlined from ‘copy_from_user’ at ./include/linux/uaccess.h:146:6,
    inlined from ‘procTxDoneCfgWrite’ at drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_proc.c:590:20:
./include/linux/thread_info.h:141:17: error: call to ‘__bad_copy_to’ declared with attribute error: copy destination size is too small
    __bad_copy_to();
                 ^

location seems to be here (drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_proc.c:201):

static ssize_t procDbgLevelWrite(struct file *file, const char *buffer, size_t count, loff_t *data)
{
    UINT_32 u4NewDbgModule, u4NewDbgLevel;
    UINT_8 i = 0;
    UINT_32 u4CopySize = sizeof(aucProcBuf);
    UINT_8 *temp = &aucProcBuf[0];

    kalMemSet(aucProcBuf, 0, u4CopySize);
    if (u4CopySize >= count + 1)
        u4CopySize = count;

    if (copy_from_user(aucProcBuf, buffer, u4CopySize)) {
        kalPrint("error of copy from user\n");
        return -EFAULT;
    }
    aucProcBuf[u4CopySize] = '\0';
...

static ssize_t procTxDoneCfgWrite(struct file *file, const char *buffer, size_t count, loff_t *data)
{
#define MODULE_NAME_LENGTH 6

    UINT_8 i = 0;
    UINT_32 u4CopySize = sizeof(aucProcBuf);
    UINT_8 *temp = &aucProcBuf[0];
    UINT_16 u2SetTxDoneCfg = 0;
    UINT_16 u2ClsTxDoneCfg = 0;
    UINT_8 aucModule[MODULE_NAME_LENGTH];
    UINT_32 u4Enabled;
    UINT_8 aucModuleArray[][MODULE_NAME_LENGTH] = {"ARP", "DNS", "TCP", "UDP", "EAPOL", "DHCP", "ICMP"};

    kalMemSet(aucProcBuf, 0, u4CopySize);
    if (u4CopySize >= count + 1)
        u4CopySize = count;

    if (copy_from_user(aucProcBuf, buffer, u4CopySize)) {
        kalPrint("error of copy from user\n");
        return -EFAULT;
    }
    aucProcBuf[u4CopySize] = '\0';
...

these 2 function use “aucProcBuf” as target…which is defined in same file as

static UINT_8 aucProcBuf[1536];

seems big enought but tested also array-size 2000, same error, i assume that it is the size of array-elements (needed more than 8bit), but find nothing where the buffer comes

seems that 2 functions are used as callbacks

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_proc.c:542:	.write = procDbgLevelWrite,

static const struct file_operations dbglevel_ops = {
	.owner = THIS_MODULE,
	.read = procDbgLevelRead,
	.write = procDbgLevelWrite,
};
...
prEntry = proc_create(PROC_DBG_LEVEL_NAME, 0664, gprProcRoot, &dbglevel_ops);

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_proc.c:627:	.write = procTxDoneCfgWrite,

static const struct file_operations proc_txdone_ops = {
	.owner = THIS_MODULE,
	.read = procTxDoneCfgRead,
	.write = procTxDoneCfgWrite,
};
...
prEntry = proc_create(PROC_NEED_TX_DONE, 0664, gprProcRoot, &proc_txdone_ops);

i’m not sure, but assume, that the problem is u4CopySize instead of the param “size_t count”

What does kalmemset exactly do?

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_kal.h:

/* Set memory block with specific pattern */
#define kalMemSet(pvAddr, ucPattern, u4Size)        memset(pvAddr, ucPattern, u4Size)

so it does not resize the mem, only change content…

The order of commands is strange (first memset,then adjust size,then copy),maybe kalmemset makes the targetbuffer aucProcBuf too small if count is larger than sizeof(aucProcBuf)…tried to move kalmemset after change of u4CopySize, but no success

Maybe i can show actual and needed values somehow…but i don’t know

currently fixed it by changing initialization of u4CopySize in both functions:

UINT_32 u4CopySize = kalStrLen(aucProcBuf);//sizeof(aucProcBuf);

is this the right way?? @garywang @Ryder.Lee @BitMaster @moore

  CC      drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.o
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.c:601:2: error: initialization from incompatible pointer type [-Werror]
  .change_virtual_intf = mtk_p2p_cfg80211_change_iface, /* 1st */
  ^

include/net/cfg80211.h

struct cfg80211_ops {
...
    int (*change_virtual_intf)(struct wiphy *wiphy,
                       struct net_device *dev,
                       enum nl80211_iftype type,
                       struct vif_params *params);

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_p2p_ioctl.h

int mtk_p2p_cfg80211_change_iface(struct wiphy *wiphy,
                  struct net_device *ndev,
                  enum nl80211_iftype type, u32 *flags, struct vif_params *params);  <<<< same as above, remove flags-param

and do the same in drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_cfg80211.c

  CC      drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.o
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c: In function ‘wfdAdjustThread’:
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3750:11: error: variable ‘param’ has initializer but incomplete type
    struct sched_param param = {.sched_priority = WFD_TX_THREAD_PRIORITY };
           ^
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3750:11: error: unknown field ‘sched_priority’ specified in initializer
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3750:11: error: excess elements in struct initializer [-Werror]
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3750:11: error: (near initialization for ‘param’) [-Werror]
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3750:23: error: storage size of ‘param’ isn’t known
    struct sched_param param = {.sched_priority = WFD_TX_THREAD_PRIORITY };
                       ^
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3750:23: error: unused variable ‘param’ [-Werror=unused-variable]
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3757:11: error: variable ‘param’ has initializer but incomplete type
    struct sched_param param = {.sched_priority = 0 };
           ^
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3757:11: error: unknown field ‘sched_priority’ specified in initializer
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3757:11: error: excess elements in struct initializer [-Werror]
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3757:11: error: (near initialization for ‘param’) [-Werror]
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3757:23: error: storage size of ‘param’ isn’t known
    struct sched_param param = {.sched_priority = 0 };
                       ^
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c:3757:23: error: unused variable ‘param’ [-Werror=unused-variable]

have done a new patch: https://drive.google.com/file/d/1yZSnLjRF6XP-asVR-YsIJdqRg-2C8_C1/view?usp=sharing

add

#include <uapi/linux/sched/types.h>

to drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_func.c

  CC      drivers/watchdog/mtk_wdt.o
drivers/watchdog/mtk_wdt.c: In function ‘wdt_report_info’:
drivers/watchdog/mtk_wdt.c:328:10: error: ‘init_task’ undeclared (first use in this function)
  task = &init_task;
          ^
drivers/watchdog/mtk_wdt.c:328:10: note: each undeclared identifier is reported only once for each function it appears in
drivers/watchdog/mtk_wdt.c:331:2: error: implicit declaration of function ‘for_each_process’ [-Werror=implicit-function-declaration]
  for_each_process(task) {
  ^
drivers/watchdog/mtk_wdt.c:331:25: error: expected ‘;’ before ‘{’ token
  for_each_process(task) {
                         ^
drivers/watchdog/mtk_wdt.c:340:2: error: implicit declaration of function ‘show_stack’ [-Werror=implicit-function-declaration]
  show_stack(NULL, NULL);
  ^

drivers/watchdog/mtk_wdt.c add “#include <linux/sched/debug.h>” (show_stack) and “#include <linux/sched/signal.h>” (for_each_process)

now compile is complete, but linking fails:

  MODPOST vmlinux.o
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_tx':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:155: undefined reference to `mtk_wcn_btif_write'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:170: undefined reference to `mtk_wcn_btif_write'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_open':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:81: undefined reference to `mtk_wcn_btif_open'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_close':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:101: undefined reference to `mtk_wcn_btif_close'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_rx_cb_register':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:121: undefined reference to `mtk_wcn_btif_rx_cb_register'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_wakeup':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:204: undefined reference to `mtk_wcn_btif_wakeup_consys'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_dpidle_ctrl':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:224: undefined reference to `mtk_wcn_btif_dpidle_ctrl'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_lpbk_ctrl':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:239: undefined reference to `mtk_wcn_btif_loopback_ctrl'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_logger_ctrl':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:259: undefined reference to `mtk_wcn_btif_dbg_ctrl'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_parser_wmt_evt':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:277: undefined reference to `mtk_wcn_btif_parser_wmt_evt'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_dbg.o: In function `is_btif_rxd_be_blocked':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_dbg.c:489: undefined reference to `mtk_btif_rxd_be_blocked_flag_get'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_dbg.o: In function `_genl_register_family_with_ops_grps':
/media/data_ext/test_4.14/linux-stable2/./include/net/genetlink.h:183: undefined reference to `__genl_register_family'
drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.o: In function `cfg80211_vendor_cmd_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5077: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.o: In function `nicRxProcessGSCNEvent':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c:1627: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.o: In function `wlanStop':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:2149: undefined reference to `cfg80211_scan_done'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.o: In function `wiphy_new':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:3944: undefined reference to `wiphy_new_nm'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.o: In function `createWirelessDevice':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:1640: undefined reference to `wiphy_register'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:1696: undefined reference to `wiphy_free'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.o: In function `destroyWirelessDevice':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:1707: undefined reference to `wiphy_unregister'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:1708: undefined reference to `wiphy_free'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.o: In function `wlanSchedScanStoppedWorkQueue':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:1839: undefined reference to `cfg80211_sched_scan_stopped'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.o: In function `wlanNetRegister':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_init.c:2249: undefined reference to `wiphy_unregister'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalIndicateStatusAndComplete':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1818: undefined reference to `cfg80211_scan_done'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1714: undefined reference to `ieee80211_channel_to_frequency'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1713: undefined reference to `ieee80211_get_channel'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1720: undefined reference to `cfg80211_get_bss'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1744: undefined reference to `cfg80211_get_bss'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1748: undefined reference to `cfg80211_unlink_bss'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `cfg80211_connect_bss':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5373: undefined reference to `cfg80211_connect_done'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalIndicateStatusAndComplete':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1883: undefined reference to `cfg80211_pmksa_candidate_notify'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `cfg80211_connect_bss':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5373: undefined reference to `cfg80211_connect_done'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalIndicateStatusAndComplete':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1795: undefined reference to `cfg80211_disconnected'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1852: undefined reference to `cfg80211_michael_mic_failure'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1755: undefined reference to `cfg80211_roamed_bss'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `cfg80211_inform_bss':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:4762: undefined reference to `cfg80211_inform_bss_data'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalReadyOnChannel':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:3988: undefined reference to `ieee80211_channel_to_frequency'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:3987: undefined reference to `ieee80211_get_channel'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4011: undefined reference to `cfg80211_ready_on_channel'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalRemainOnChannelExpired':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4044: undefined reference to `ieee80211_channel_to_frequency'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4043: undefined reference to `ieee80211_get_channel'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4067: undefined reference to `cfg80211_remain_on_channel_expired'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalIndicateMgmtTxStatus':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4097: undefined reference to `cfg80211_mgmt_tx_status'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalIndicateRxMgmtFrame':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4141: undefined reference to `cfg80211_rx_mgmt'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `cfg80211_testmode_alloc_event_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5221: undefined reference to `__cfg80211_alloc_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `cfg80211_testmode_event':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5238: undefined reference to `__cfg80211_send_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalIndicateBssInfo':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:3929: undefined reference to `ieee80211_channel_to_frequency'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:3928: undefined reference to `ieee80211_get_channel'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `cfg80211_inform_bss_frame':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:4684: undefined reference to `cfg80211_inform_bss_frame_data'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalIndicateBssInfo':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:3952: undefined reference to `cfg80211_put_bss'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalSchedScanResults':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:4427: undefined reference to `cfg80211_sched_scan_results'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.o: In function `cfg80211_testmode_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5176: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.o: In function `cfg80211_testmode_reply':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5194: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.o: In function `cfg80211_testmode_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5176: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.o: In function `cfg80211_testmode_reply':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5194: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.o: In function `cfg80211_testmode_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5176: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.o: In function `cfg80211_testmode_reply':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5194: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.o: In function `cfg80211_testmode_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5176: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_cfg80211.o: In function `cfg80211_testmode_reply':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5194: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_cmd_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5077: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `mtk_cfg80211_vendor_get_channel_list':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:185: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_cmd_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5077: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `mtk_cfg80211_vendor_get_gscan_capabilities':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:276: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_cmd_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5077: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `mtk_cfg80211_vendor_get_rtt_capabilities':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:942: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_cmd_alloc_reply_skb':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5077: undefined reference to `__cfg80211_alloc_reply_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `mtk_cfg80211_vendor_llstats_get_info':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.c:993: undefined reference to `cfg80211_vendor_cmd_reply'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event_alloc':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5120: undefined reference to `__cfg80211_alloc_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5135: undefined reference to `__cfg80211_send_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event_alloc':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5120: undefined reference to `__cfg80211_alloc_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5135: undefined reference to `__cfg80211_send_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event_alloc':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5120: undefined reference to `__cfg80211_alloc_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5135: undefined reference to `__cfg80211_send_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event_alloc':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5120: undefined reference to `__cfg80211_alloc_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5135: undefined reference to `__cfg80211_send_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event_alloc':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5120: undefined reference to `__cfg80211_alloc_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5135: undefined reference to `__cfg80211_send_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event_alloc':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5120: undefined reference to `__cfg80211_alloc_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_vendor.o: In function `cfg80211_vendor_event':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5135: undefined reference to `__cfg80211_send_event_skb'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.o: In function `p2pStop':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.c:1597: undefined reference to `cfg80211_scan_done'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.o: In function `wiphy_new':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:3944: undefined reference to `wiphy_new_nm'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.o: In function `glP2pCreateWirelessDevice':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.c:1205: undefined reference to `wiphy_register'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.c:1259: undefined reference to `wiphy_free'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.o: In function `glP2pDestroyWirelessDevice':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.c:1273: undefined reference to `wiphy_unregister'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.c:1274: undefined reference to `wiphy_free'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `kalP2PIndicateScanDone':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c:914: undefined reference to `cfg80211_scan_done'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `kalP2PIndicateMgmtTxStatus':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c:985: undefined reference to `cfg80211_mgmt_tx_status'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `kalP2PIndicateRxMgmtFrame':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c:1035: undefined reference to `cfg80211_rx_mgmt'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `cfg80211_connect_bss':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5373: undefined reference to `cfg80211_connect_done'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `kalP2PGCIndicateConnectionStatus':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c:1068: undefined reference to `cfg80211_disconnected'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `cfg80211_del_sta':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:5580: undefined reference to `cfg80211_del_sta_sinfo'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `kalP2PGOStationUpdate':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c:1099: undefined reference to `cfg80211_new_sta'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `kalP2PIndicateChannelReady':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c:826: undefined reference to `cfg80211_ready_on_channel'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `kalP2PIndicateChannelExpired':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c:866: undefined reference to `cfg80211_remain_on_channel_expired'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `cfg80211_inform_bss_frame':
/media/data_ext/test_4.14/linux-stable2/./include/net/cfg80211.h:4684: undefined reference to `cfg80211_inform_bss_frame_data'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.o: In function `kalP2PIndicateBssInfo':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c:961: undefined reference to `cfg80211_put_bss'
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.o: In function `TdlsEventTearDown':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.c:3591: undefined reference to `cfg80211_tdls_oper_request'
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.o: In function `TdlsexKeyHandle':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.c:4160: undefined reference to `cfg80211_tdls_oper_request'
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.o: In function `TdlsexPeerAdd':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.c:4552: undefined reference to `cfg80211_tdls_oper_request'
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.o: In function `TdlsexRxFrameDrop':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.c:4903: undefined reference to `cfg80211_tdls_oper_request'
drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.o: In function `TdlsexTxQuotaCheck':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/tdls.c:5174: undefined reference to `cfg80211_tdls_oper_request'

updated patch https://drive.google.com/file/d/1yZSnLjRF6XP-asVR-YsIJdqRg-2C8_C1/view?usp=sharing

most of them came, because i’ve set cfg8011 and mac80211 as module…make it build-in reduces errors to this:

/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:155: undefined reference to `mtk_wcn_btif_write'
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:170: undefined reference to `mtk_wcn_btif_write'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_open':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:81: undefined reference to `mtk_wcn_btif_open'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_close':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:101: undefined reference to `mtk_wcn_btif_close'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_rx_cb_register':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:121: undefined reference to `mtk_wcn_btif_rx_cb_register'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_wakeup':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:204: undefined reference to `mtk_wcn_btif_wakeup_consys'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_dpidle_ctrl':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:224: undefined reference to `mtk_wcn_btif_dpidle_ctrl'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_lpbk_ctrl':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:239: undefined reference to `mtk_wcn_btif_loopback_ctrl'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_logger_ctrl':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:259: undefined reference to `mtk_wcn_btif_dbg_ctrl'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o: In function `mtk_wcn_consys_stp_btif_parser_wmt_evt':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:277: undefined reference to `mtk_wcn_btif_parser_wmt_evt'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_dbg.o: In function `is_btif_rxd_be_blocked':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_dbg.c:489: undefined reference to `mtk_btif_rxd_be_blocked_flag_get'
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_dbg.o: In function `_genl_register_family_with_ops_grps':
/media/data_ext/test_4.14/linux-stable2/./include/net/genetlink.h:183: undefined reference to `__genl_register_family'
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.o: In function `kalIndicateStatusAndComplete':
/media/data_ext/test_4.14/linux-stable2/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c:1755: undefined reference to `cfg80211_roamed_bss'

i assume that there is an include missing in any makefile, but how to solve this??

e.g.

frank@Frank-Laptop:/media/data_ext/test_4.14/linux-stable2$ grep -Rn 'mtk_wcn_btif_dbg_ctrl'
drivers/misc/mediatek/btif/common/inc/mtk_btif_exp.h:244:int mtk_wcn_btif_dbg_ctrl(unsigned long u_id, ENUM_BTIF_DBG_ID flag);
drivers/misc/mediatek/btif/common/mtk_btif_exp.c:429:int mtk_wcn_btif_dbg_ctrl(unsigned long u_id, ENUM_BTIF_DBG_ID flag)
drivers/misc/mediatek/btif/common/mtk_btif_exp.c:491:EXPORT_SYMBOL(mtk_wcn_btif_dbg_ctrl);
Binary file drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.o matches
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:259:		iRet = mtk_wcn_btif_dbg_ctrl(stpBtifId, flag);
frank@Frank-Laptop:/media/data_ext/test_4.14/linux-stable2$ nano drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/Makefile 

function mtk_wcn_btif_dbg_ctrl is defined in drivers/misc/mediatek/btif/common/inc/mtk_btif_exp.h so i have to include it to drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/Makefile, right? but there is already a line including that dir

ccflags-y += \
    -I$(src)/../../linux/include \
    -I$(src)/../../linux/pri/include \
    -I$(src)/../../core/include \
    -I$(src)/../../include \
    -I$(src)/../include \
    -I$(src)/../../../common_detect \
    -I$(srctree)/drivers/misc/mediatek/btif/common/inc \ <<<<<<<<<<<
    -I$(srctree)/drivers/misc/mediatek/mach/$(MTK_PLATFORM)/include/mach

as you see the EXPORT_SYMBOL is done in c-file…tried to move to header, but without success :frowning: any idea?

as for cfg80211_roamed_bss, function is defined in cfg80211.h, but seems not be implemented anywhere…only called in drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_kal.c, same in kernel 4.4.70…maybe cfg80211_roamed must be used like here: https://www.spinics.net/lists/linux-wireless/msg161781.html

struct cfg80211_roam_info {
    struct ieee80211_channel *channel;
    struct cfg80211_bss *bss;
    const u8 *bssid;
    const u8 *req_ie;
    size_t req_ie_len;
    const u8 *resp_ie;
    size_t resp_ie_len;
    bool authorized;
};
void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
             gfp_t gfp);

instead of

void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
             const u8 *req_ie, size_t req_ie_len,
             const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);

so i fixed the cfg80211_roamed_bss-error:

    if (eStatus == WLAN_STATUS_ROAM_OUT_FIND_BEST) {
        /*cfg80211_roamed_bss(prGlueInfo->prDevHandler,
                    bss,
                    prGlueInfo->aucReqIe,
                    prGlueInfo->u4ReqIeLength,
                    prGlueInfo->aucRspIe, prGlueInfo->u4RspIeLength, GFP_KERNEL);
        */
        struct cfg80211_roam_info roam_info = {
                    .bss = bss,
                    .req_ie = prGlueInfo->aucReqIe,
                    .req_ie_len = prGlueInfo->u4ReqIeLength,
                    .resp_ie = prGlueInfo->aucRspIe,
                    .resp_ie_len = prGlueInfo->u4RspIeLength
        };
        cfg80211_roamed(prGlueInfo->prDevHandler,
                    &roam_info,
                    GFP_KERNEL);
    } else {

but the mtk_* functions are defined in drivers/misc/mediatek/btif/common/mtk_btif_exp.c and in makefile there is also a mtk_btif_exp.o :thinking:

any idea with the others?

the genetlink (must be reworked if all works, maybe the __functions are not needed) was also easy…simply change the call

static inline int
_genl_register_family_with_ops_grps(struct genl_family *family,
                                   const struct genl_ops *ops, size_t n_ops,
                                   const struct genl_multicast_group *mcgrps,
                                   size_t n_mcgrps)
{
       family->module = THIS_MODULE;
       family->ops = ops;
       family->n_ops = n_ops;
       family->mcgrps = mcgrps;
       family->n_mcgrps = n_mcgrps;
       return genl_register_family(family); //instead of __genl_register_family
}

anybody has an idea with the mtk_-functions??? here i have no clue, what’s the problem on linking

updated patch: https://drive.google.com/file/d/1yZSnLjRF6XP-asVR-YsIJdqRg-2C8_C1/view?usp=sharing

currently i have not enabled CONFIG_MTK_BTIF=y and CONFIG_MTK_COMBO_BT=y, assume thats the problem (no btif.o exists)…if i enable it i got

  CC      drivers/misc/mediatek/btif/common/mtk_btif.o
In file included from ./include/linux/module.h:10:0,
                 from drivers/misc/mediatek/btif/common/mtk_btif.c:16:
./include/linux/stat.h:11:18: error: expected ')' before '(' token
 #define S_IRUGO  (S_IRUSR|S_IRGRP|S_IROTH)
                  ^
drivers/misc/mediatek/btif/common/mtk_btif.c:887:26: note: in expansion of macro 'S_IRUGO'
 static DRIVER_ATTR(flag, S_IRUGO | S_IWUSR, driver_flag_read, driver_flag_set);
                          ^
drivers/misc/mediatek/btif/common/mtk_btif.c: In function 'BTIF_init':
drivers/misc/mediatek/btif/common/mtk_btif.c:3215:56: error: 'driver_attr_flag' undeclared (first use in this function)
  i_ret = driver_create_file(&mtk_btif_dev_drv.driver, &driver_attr_flag);
                                                        ^
drivers/misc/mediatek/btif/common/mtk_btif.c:3215:56: note: each undeclared identifier is reported only once for each function it appears in
drivers/misc/mediatek/btif/common/mtk_btif.c: In function 'BTIF_exit':
drivers/misc/mediatek/btif/common/mtk_btif.c:3442:48: error: 'driver_attr_flag' undeclared (first use in this function)
  driver_remove_file(&mtk_btif_dev_drv.driver, &driver_attr_flag);
                                                ^
drivers/misc/mediatek/btif/common/mtk_btif.c: At top level:
drivers/misc/mediatek/btif/common/mtk_btif.c:757:16: error: 'driver_flag_read' defined but not used [-Werror=unused-function]
 static ssize_t driver_flag_read(struct device_driver *drv, char *buf)
                ^
drivers/misc/mediatek/btif/common/mtk_btif.c:762:16: error: 'driver_flag_set' defined but not used [-Werror=unused-function]
 static ssize_t driver_flag_set(struct device_driver *drv,
                ^

found no definition of driver_attr_flag, also not in 4.4.70…

todo: drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/Makefile separate wifi+bt (bt should not be included if CONFIG_MTK_BTIF and CONFIG_MTK_COMBO_BT not set)

tried to fix this adding

struct driver_attribute driver_attr_flag {
  //.show=driver_flag_read;
  //.store=driver_flag_set;
}

now this error is gone…

  CC      drivers/misc/mediatek/btif/common/mtk_btif.o
In file included from ./include/linux/module.h:10:0,
                 from drivers/misc/mediatek/btif/common/mtk_btif.c:16:
./include/linux/stat.h:11:18: error: expected ')' before '(' token
 #define S_IRUGO  (S_IRUSR|S_IRGRP|S_IROTH)
                  ^
drivers/misc/mediatek/btif/common/mtk_btif.c:902:26: note: in expansion of macro 'S_IRUGO'
 static DRIVER_ATTR(flag, S_IRUGO | S_IWUSR, driver_flag_read, driver_flag_set);
                          ^
drivers/misc/mediatek/btif/common/mtk_btif.c:772:16: error: 'driver_flag_read' defined but not used [-Werror=unused-function]
 static ssize_t driver_flag_read(struct device_driver *drv, char *buf)
                ^
drivers/misc/mediatek/btif/common/mtk_btif.c:777:16: error: 'driver_flag_set' defined but not used [-Werror=unused-function]
 static ssize_t driver_flag_set(struct device_driver *drv,
                ^

i don’t understand the first error (./include/linux/stat.h:11:18: error: expected ‘)’ before ‘(’ token #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH))

First know I appreciate the work you do. Just as a suggestion, you could create a public fork of the kernel on github and commit the (not yet building) code there. Then it’s much easier for us to review the commits you do, help you with it, build it ourselves, do our own patches or provide you with pull requests and in the end merge it somewhere. You could also point to specific parts by linking to github. I’m really not trying to force you in a certain way of working, feel free to continue as you like :slightly_smiling_face:.

Hi

I’m not a pro in using git :frowning:

Have not done a fork before and don’t know how to held the kernel itself up-to-date (4.14.5 is recently released). So a complete patch seems to be the easiest way. Also have not done pull request and all the other maintaining.

If you give me a step-by-step guide how to do it i will try it

Forked it: https://github.com/frank-w/linux

How to set base to 4.14.y? Have only tag 4.14

How can i include the path there?

+1 was trying to keep up,but most time take me just setting up repo and applying patches.

Great! Looking good! Now you can create a branch from tag 4.14 online with github, call it as you like. Then git clone the repository to your development machine and change the branch with git checkout. Overwrite and git add the files with updated code (try to be conservative with changes as possible, to keep things readable, you can check with git diff --cached). When you finished git commit the code to your local ‘clone’ and then git push the code back to github. You should be able to view the result online.

You could use tools like SourceTree or TortoiseGit to support you in getting familiar with git. Another way is do the interactive tutorial at https://try.github.io/. It probably takes a few times back to google, but it will pay off eventually.

renamed repository:

  • main-branch is to get working kernel
  • wifi_mt6625l-branch is for testing the internal wifi-driver (currently does not compile complete)

edit: updated wifi-branch (fixed dts, config and add logging to build.sh…)

anyone tried to build? you have not make it compile complete…step by step

IMHO first we must separate wifi from BT in the common-dir (common/conn_soc/linux/pri) to get first wifi running without BT

I just successfully built the main branch (as a test), but didn’t try to run it yet. To be honest the build.sh isn’t really convenient for me because I have different paths, compiler settings, make flags and git usage. But it can be useful as a reference.

Later I will switch to the wifi branch and check out how I can contribute.

build.sh is only a start to get a working kernel :wink:

of course you can use your own script/environment…i want to make a small script to do the common tasks in building

tried to set function-calls to btif-functions in

#ifdef CONFIG_MTK_BTIF
...
#endif

to get rid of the depencies, till i come to drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_ctrl.c

/*do not need contol uart because B/G/F send/receive data by BTIF*/

B/G/F are the wifi-bands, right? seems that BTIF does not stand for BlueToothInterFace…whats the meaning?

https://lwn.net/Articles/729641/

MediaTek BTIF controller is the serial interface similar to UART but it works only as the digital device which is mainly used to communicate with the connectivity module also called CONNSYS inside the SoC which could be mostly found on those MediaTek SoCs with Bluetooth feature.

BTIF is needed for wifi and bt see Gary’s answer: 2.4Ghz and 5.6Ghz Wifi Working fine

as of the other errors, i’ve found out that in 4.4.70 there is

include/linux/device.h:303:#define DRIVER_ATTR(_name, _mode, _show, _store)

in 4.14 this is missing…

seems to be related: https://patchwork.kernel.org/patch/9851919/

then we must use one of these:

#define DRIVER_ATTR_RW(_name) \
    struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
#define DRIVER_ATTR_RO(_name) \
    struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
#define DRIVER_ATTR_WO(_name) \
    struct driver_attribute driver_attr_##_name = __ATTR_WO(_name)

but here the functions seems not to be given as params…how to set _show and _store? the macro builds the function-name together…see actual commit :wink: compiles fine

but throws a kernel-panic when wmt_launcher is running:

root@bpi-r2:~# wmt_loader                                                                                                      
init combo device                                                                                                              
Opened combo device                                                                                                            
get de[  282.101063] Internal error: Oops: 17 [#1] SMP ARM                                                                     
[  282.106861] Modules linked in:                                                                                              
                                                                                                                               
set device id [  282.111265] CPU: 3 PID: 12863 Comm: wmt_loader Not tainted 4.14.6-00012-g3bf8d6a #21                          
: 30243                                                                                                                        
[  282.120309] Hardware name: Mediatek Cortex-A7 (Device Tree)                                                                 
[  282.126687] task: db54e000 task.stack: dc228000                                                                             
[  282.131193] PC is at __list_del_entry_valid+0x28/0xdc                                                                       
[  282.136212] LR is at wakeup_source_remove+0x34/0x88                                                                         
[  282.141055] pc : [<c03c8534>]    lr : [<c04829a0>]    psr: 800e0093                                                         
[  282.147275] sp : dc229df8  ip : 00000000  fp : dc229e0c                                                                     
[  282.152461] r10: c0b01b40  r9 : ffffffff  r8 : c0f3eb9c                                                                     
[  282.157647] r7 : 0be00000  r6 : 00000001  r5 : a00e0013  r4 : c0f3f1b0                                                      
[  282.164128] r3 : c0f3f1b4  r2 : c0efc308  r1 : 00000000  r0 : c0f3f1b4                                                      
[  282.170609] Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none                                              
[  282.177781] Control: 10c5387d  Table: 9c53006a  DAC: 00000051                                                               
[  282.183484] Process wmt_loader (pid: 12863, stack limit = 0xdc228218)                                                       
[  282.189878] Stack: (0xdc229df8 to 0xdc22a000)                                                                               
[  282.194203] 9de0:                                                       c04c4b60 c0482994                                   
[  282.202328] 9e00: dc229e24 dc229e10 c04829a0 c03c8518 c0e538cc 00000000 dc229e3c dc229e28                                   
[  282.210453] 9e20: c04c3820 c0482978 c0f3eb9c c0e53868 dc229e64 dc229e40 c04a544c c04c3800                                   
[  282.218578] 9e40: ffffffff c047149c dc229ea4 c0f3eb9c c0e53868 c0e5384c dc229ea4 dc229e68                                   
[  282.226703] 9e60: c04c0548 c04a542c c0b01b40 c017672c dc229e94 00000000 c0177360 c0e53970                                   
[  282.234826] 9e80: 00007623 00007623 00007623 00007623 debeecb0 00000000 dc229ec4 dc229ea8                                   
[  282.242951] 9ea0: c04c7940 c04c02fc 00007623 80047704 00007623 00007623 dc229edc dc229ec8                                   
[  282.251076] 9ec0: c04c7794 c04c78d8 c0e5396c 80047704 dc229efc dc229ee0 c04c6c4c c04c7784                                   
[  282.259200] 9ee0: c04c6af8 dd9cf600 dd9cf600 80047704 dc229f7c dc229f00 c02776f8 c04c6b04                                   
[  282.267325] 9f00: 00000020 00000000 00000000 00000000 ddacd000 c0264c70 ddacd000 dd9c99c0                                   
[  282.275450] 9f20: 00000017 dedd57a0 00000000 00000002 dd9c99c8 00000000 dc229f74 dc229f48                                   
[  282.283575] 9f40: c0264d44 c02a9a40 00000000 00000000 00000000 dd9cf600 dd9cf600 80047704                                   
[  282.291700] 9f60: 00007623 00000003 dc228000 00000000 dc229fa4 dc229f80 c0277f88 c0277658                                   
[  282.299825] 9f80: 00000000 bea12c58 00000000 00000000 00000036 c0108d64 00000000 dc229fa8                                   
[  282.307950] 9fa0: c0108b80 c0277f50 bea12c58 00000000 00000003 80047704 00007623 00000000                                   
[  282.316075] 9fc0: bea12c58 00000000 00000000 00000036 00000000 00000000 b6ffa000 00000000                                   
[  282.324200] 9fe0: 00021010 bea12c1c 000105b7 b6f73766 20080030 00000003 00000000 00000000                                   
[  282.332338] [<c03c8534>] (__list_del_entry_valid) from [<c04829a0>] (wakeup_source_remove+0x34/0x88)                        
[  282.341418] [<c04829a0>] (wakeup_source_remove) from [<c04c3820>] (wmt_plat_deinit+0x2c/0xc0)                               
[  282.349892] [<c04c3820>] (wmt_plat_deinit) from [<c04a544c>] (wmt_lib_deinit+0x2c/0x178)                                    
[  282.357934] [<c04a544c>] (wmt_lib_deinit) from [<c04c0548>] (mtk_wcn_soc_common_drv_init+0x258/0x324)                       
[  282.367096] [<c04c0548>] (mtk_wcn_soc_common_drv_init) from [<c04c7940>] (do_common_drv_init+0x74/0x1c0)                    
[  282.376519] [<c04c7940>] (do_common_drv_init) from [<c04c7794>] (do_connectivity_driver_init+0x1c/0x154)                    
[  282.385940] [<c04c7794>] (do_connectivity_driver_init) from [<c04c6c4c>] (wmt_detect_unlocked_ioctl+0x154/0x1b0)            
[  282.396053] [<c04c6c4c>] (wmt_detect_unlocked_ioctl) from [<c02776f8>] (do_vfs_ioctl+0xac/0x8f8)                            
[  282.404785] [<c02776f8>] (do_vfs_ioctl) from [<c0277f88>] (SyS_ioctl+0x44/0x6c)                                             
[  282.412052] [<c0277f88>] (SyS_ioctl) from [<c0108b80>] (ret_fast_syscall+0x0/0x54)                                          
[  282.419575] Code: e3510c01 0a00000a e35c0c02 0a000023 (e59cc000)                                                            
[  282.425628] ---[ end trace a2052d2229096773 ]---                                                                            
[  282.430494] [WMT-DETECT][I]wmt_detect_close:close major 154 minor 0 (pid 12863)                                             
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.101063] Internal error: Oops: 17 [#1] SMP ARM                                                                   
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.183484] Process wmt_loader (pid: 12863, stack limit = 0xdc228218)                                               
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.189878] Stack: (0xdc229df8 to 0xdc22a000)                                                                       
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.194203] 9de0:                                                       c04c4b60 c0482994                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.202328] 9e00: dc229e24 dc229e10 c04829a0 c03c8518 c0e538cc 00000000 dc229e3c dc229e28                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.210453] 9e20: c04c3820 c0482978 c0f3eb9c c0e53868 dc229e64 dc229e40 c04a544c c04c3800                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.218578] 9e40: ffffffff c047149c dc229ea4 c0f3eb9c c0e53868 c0e5384c dc229ea4 dc229e68                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.226703] 9e60: c04c0548 c04a542c c0b01b40 c017672c dc229e94 00000000 c0177360 c0e53970                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.234826] 9e80: 00007623 00007623 00007623 00007623 debeecb0 00000000 dc229ec4 dc229ea8                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.242951] 9ea0: c04c7940 c04c02fc 00007623 80047704 00007623 00007623 dc229edc dc229ec8                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.251076] 9ec0: c04c7794 c04c78d8 c0e5396c 80047704 dc229efc dc229ee0 c04c6c4c c04c7784                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.259200] 9ee0: c04c6af8 dd9cf600 dd9cf600 80047704 dc229f7c dc229f00 c02776f8 c04c6b04                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.267325] 9f00: 00000020 00000000 00000000 00000000 ddacd000 c0264c70 ddacd000 dd9c99c0                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.275450] 9f20: 00000017 dedd57a0 00000000 00000002 dd9c99c8 00000000 dc229f74 dc229f48                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.283575] 9f40: c0264d44 c02a9a40 00000000 00000000 00000000 dd9cf600 dd9cf600 80047704                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.291700] 9f60: 00007623 00000003 dc228000 00000000 dc229fa4 dc229f80 c0277f88 c0277658                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.299825] 9f80: 00000000 bea12c58 00000000 00000000 00000036 c0108d64 00000000 dc229fa8                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.307950] 9fa0: c0108b80 c0277f50 bea12c58 00000000 00000003 80047704 00007623 00000000                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.316075] 9fc0: bea12c58 00000000 00000000 00000036 00000000 00000000 b6ffa000 00000000                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.324200] 9fe0: 00021010 bea12c1c 000105b7 b6f73766 20080030 00000003 00000000 00000000                           
                                                                                                                               
Message from syslogd@bpi-r2 at Dec 14 15:22:50 ...                                                                             
 kernel:[  282.419575] Code: e3510c01 0a00000a e35c0c02 0a000023 (e59cc000)                                                    
Segmentation fault                                                       

any idea? @garywang have the wifi-helper-tools/firmware changed?

wmt_plat_deinit is the first function from top i’ve found in source…

drivers/misc/mediatek/connectivity/common/combo/platform/alps/wmt_plat_alps.c

INT32 wmt_plat_deinit(VOID)
{
	INT32 iret;

	/* 1. de-init cmb_hw */
	iret = mtk_wcn_cmb_hw_deinit();
	/* 2. unreg to cmb_stub */
	iret += mtk_wcn_cmb_stub_unreg();
	/*3. wmt wakelock deinit */
#ifdef CFG_WMT_WAKELOCK_SUPPORT
	wake_lock_destroy(&wmtWakeLock);
	osal_sleepable_lock_deinit(&gOsSLock);
	WMT_DBG_FUNC("destroy wmtWakeLock\n");
#endif
	WMT_DBG_FUNC("WMT-PLAT: ALPS platform init (%d)\n", iret);

	return 0;
}

Last init-function (drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c):

int mtk_wcn_soc_common_drv_init(void)
{
	return WMT_init(); //this call is not in stacktrace
}

static int WMT_init(void)
{
	dev_t devID = MKDEV(gWmtMajor, 0);
	INT32 cdevErr = -1;
	INT32 ret = -1;

	WMT_INFO_FUNC("WMT Version= %s DATE=%s\n", MTK_WMT_VERSION, MTK_WMT_DATE);
	/* Prepare a UINT8 device */
	/*static allocate chrdev */
	gWmtInitDone = 0;
	init_waitqueue_head((wait_queue_head_t *) &gWmtInitWq);

	stp_drv_init();

	ret = register_chrdev_region(devID, WMT_DEV_NUM, WMT_DRIVER_NAME);
	if (ret) {
		WMT_ERR_FUNC("fail to register chrdev\n");
		return ret;
	}

	cdev_init(&gWmtCdev, &gWmtFops);
	gWmtCdev.owner = THIS_MODULE;

	cdevErr = cdev_add(&gWmtCdev, devID, WMT_DEV_NUM);
	if (cdevErr) {
		WMT_ERR_FUNC("cdev_add() fails (%d)\n", cdevErr);
		goto error;
	}
	WMT_INFO_FUNC("driver(major %d) installed\n", gWmtMajor);

#if WMT_CREATE_NODE_DYNAMIC
	wmt_class = class_create(THIS_MODULE, "stpwmt");
	if (IS_ERR(wmt_class))
		goto error;
	wmt_dev = device_create(wmt_class, NULL, devID, NULL, "stpwmt");
	if (IS_ERR(wmt_dev))
		goto error;
#endif

#if 0
	pWmtDevCtx = wmt_drv_create();
	if (!pWmtDevCtx) {
		WMT_ERR_FUNC("wmt_drv_create() fails\n");
		goto error;
	}

	ret = wmt_drv_init(pWmtDevCtx);
	if (ret) {
		WMT_ERR_FUNC("wmt_drv_init() fails (%d)\n", ret);
		goto error;
	}

	WMT_INFO_FUNC("stp_btmcb_reg\n");
	wmt_cdev_btmcb_reg();

	ret = wmt_drv_start(pWmtDevCtx);
	if (ret) {
		WMT_ERR_FUNC("wmt_drv_start() fails (%d)\n", ret);
		goto error;
	}
#endif
	ret = wmt_lib_init();
	if (ret) {
		WMT_ERR_FUNC("wmt_lib_init() fails (%d)\n", ret);
		goto error;
	}
#if CFG_WMT_DBG_SUPPORT
	wmt_dev_dbg_setup();
#endif

#if CFG_WMT_PROC_FOR_AEE
	wmt_dev_proc_for_aee_setup();
#endif

	WMT_INFO_FUNC("wmt_dev register thermal cb\n");
	wmt_lib_register_thermal_ctrl_cb(wmt_dev_tm_temp_query);

	wmt_dev_bgw_desense_init();

	gWmtInitDone = 1;
	wake_up(&gWmtInitWq);

	osal_sleepable_lock_init(&g_es_lr_lock);
	INIT_WORK(&gPwrOnOffWork, wmt_pwr_on_off_handler);
#ifdef CONFIG_EARLYSUSPEND
	register_early_suspend(&wmt_early_suspend_handler);
	WMT_INFO_FUNC("register_early_suspend finished\n");
#else
	wmt_fb_notifier.notifier_call = wmt_fb_notifier_callback;
	ret = fb_register_client(&wmt_fb_notifier);
	if (ret)
		WMT_ERR_FUNC("wmt register fb_notifier failed! ret(%d)\n", ret);
	else
		WMT_INFO_FUNC("wmt register fb_notifier OK!\n");
#endif
	WMT_INFO_FUNC("success\n");
	return 0;

error:
	wmt_lib_deinit();
#if CFG_WMT_DBG_SUPPORT
	wmt_dev_dbg_remove();
#endif
#if WMT_CREATE_NODE_DYNAMIC
	if (!(IS_ERR(wmt_dev)))
		device_destroy(wmt_class, devID);
	if (!(IS_ERR(wmt_class))) {
		class_destroy(wmt_class);
		wmt_class = NULL;
	}
#endif

	if (cdevErr == 0)
		cdev_del(&gWmtCdev);

	if (ret == 0) {
		unregister_chrdev_region(devID, WMT_DEV_NUM);
		gWmtMajor = -1;
	}

	WMT_ERR_FUNC("fail\n");

	return -1;
}

Is there any debug-mode to see on which step it failes? There are messages with WMT_INFO_FUNC and WMT_ERR_FUNC…how to display them?

try to add some printk’s like it’s recommended here: https://elinux.org/Debugging_by_printing (Author’s practical advice) oh, is see the messages only in dmesg :wink:

[   37.004665] [WMT-DETECT][I]wmt_detect_open:open major 154 minor 0 (pid 1339) 
[   37.004699] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191037),arg(0)
[   37.004763] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (1074034433),arg(302
43)                                                                             
[   37.004768] set current consys chipid (0x7623)                               
[   37.004783] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191036),arg(30
243)                                                                            
[   37.004789] [WMT-MOD-INIT][I]do_common_drv_init:start to do common driver ini
t, chipid:0x00007623                                                            
[   37.004796] DEBUG: Passed WMT_init 2396                                      
[   37.005267] DEBUG: Passed WMT_init 2404                                      
[   37.005274] DEBUG: Passed WMT_init 2407                                      
[   37.005282] DEBUG: Passed WMT_init 2414                                      
[   37.005358] DEBUG: Passed WMT_init 2419                                      
[   37.006734] DEBUG: Passed WMT_init 2423                                      
[   37.008914] [WMT-DEV][E]wmt_dev_read_file(1458):error code:-2                
[   37.008930] [WMT-DEV][E]wmt_dev_patch_get(1575):load file (/system/etc/firmwa
re/WMT_SOC.cfg) fail, iRet(-2)                                   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<               
[   37.008937] [WMT-CONF][E]wmt_conf_read_file(516):read /system/etc/firmware/WM
T_SOC.cfg file fails                                                            
[   37.008943] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_conf.
c, 517, (0)                                                                     
[   37.008949] [WMT-LIB][E]wmt_lib_init(179):read wmt config file fail(-1)      
[   37.008953] DEBUG: Passed WMT_init 2452                                      
[   37.008958] [WMT-DEV][E]WMT_init(2454):wmt_lib_init() fails (-1)             
[   37.008966] [WMT-LIB][E]wmt_lib_deinit(306):osal_thread_stop(0xc0efca60) fail
(-1)                                                                            
[   37.008970] [cmb_stub] unregistered                                          
[   37.008989] Unable to handle kernel NULL pointer dereference at virtual addre
ss 00000000

then comes the oops listed above…and also the WMT-mesages are here…

wmt_dev.c (68,8 KB) wmt_plat_alps.c (44,9 KB)

seems that the problem is that my cfg could not be loaded…have lowercase filename instead of uppercase (for whatever reason) after renaming, kernel hangs…seems that kernel has crashed more than i thought…the renaming was not present after a reset…so i renamed again and started wmt_loader:

root@bpi-r2:~# wmt_loader
init combo device
Opened combo device
get device id : 30243
set device id : 30243
do module init: 30243
failed to init module <<<< can be ignored, same as 4.4.70

second step:

root@bpi-r2:~# stp_uart_launcher -p /etc/firmware &                             
[1] 1482                                                                        
open device node[  263.950509] Internal error: Oops: 17 [#1] SMP ARM            
 succeed.(Node:/[  263.956093] Modules linked in:                               
dev/stpwmt, fd:3[  263.960498] CPU: 3 PID: 1118 Comm: mtk_wmtd Not tainted 4.14.
6-00012-g3bf8d6a-dirty #25                                                      
)                                                                               
chip id is 0[  263.969808] Hardware name: Mediatek Cortex-A7 (Device Tree)      
x7623                                                                           
chiId:0x7[  263.976704] task: debdd400 task.stack: dc87e000                     
623, setting to [  263.982574] PC is at mutex_lock+0x28/0x54                    
property((null))[  263.987917] LR is at regulator_set_mode+0x2c/0xb4            
                                                                                
chiId:0x7623                                                                    
[  263.993950] pc : [<c08d100c>]    lr : [<c0428ba0>]    psr: 60080013          
run SOC chip flo[  264.001538] sp : dc87fd80  ip : dc87fd90  fp : dc87fd8c      
w                                                                               
create pwr on[  264.008088] r10: 00000000  r9 : 00000000  r8 : 00000000         
 thread ok                                                                      
root[  264.014641] r7 : 00000001  r6 : c0efd204  r5 : 00000040  r4 : 00000000   
@bpi-r2:~# [  264.022488] r3 : debdd400  r2 : dc87fd80  r1 : 00000008  r0 : 0000
0040                                                                            
[  264.029901] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  264.036985] Control: 10c5387d  Table: 9df2806a  DAC: 00000051                
[  264.042688] Process mtk_wmtd (pid: 1118, stack limit = 0xdc87e218)           
[  264.048823] Stack: (0xdc87fd80 to 0xdc880000)                                
... (removed memory-dump)
[  264.215660] [<c08d100c>] (mutex_lock) from [<c0428ba0>] (regulator_set_mode+0
x2c/0xb4)                                                                       
[  264.223534] [<c0428ba0>] (regulator_set_mode) from [<c04c21e4>] (mtk_wcn_cons
ys_hw_reg_ctrl+0x84/0x69c)                                                      
[  264.232870] [<c04c21e4>] (mtk_wcn_consys_hw_reg_ctrl) from [<c04c29b0>] (mtk_
wcn_consys_hw_pwr_on+0x50/0xc4)                                                 
[  264.242636] [<c04c29b0>] (mtk_wcn_consys_hw_pwr_on) from [<c04c478c>] (wmt_pl
at_pwr_ctrl+0xa4/0x124)                                                         
[  264.251713] [<c04c478c>] (wmt_plat_pwr_ctrl) from [<c04a1c88>] (wmt_ctrl_hw_p
wr_on+0x68/0x88)                                                                
[  264.260186] [<c04a1c88>] (wmt_ctrl_hw_pwr_on) from [<c04a1d78>] (wmt_ctrl+0x4
4/0xc0)                                                                         
[  264.267882] [<c04a1d78>] (wmt_ctrl) from [<c049e2cc>] (wmt_core_ctrl+0x4c/0xc
c)                                                                              
[  264.275146] [<c049e2cc>] (wmt_core_ctrl) from [<c04a028c>] (opfunc_pwr_on+0x5
c/0x204)                                                                        
[  264.282928] [<c04a028c>] (opfunc_pwr_on) from [<c04a0490>] (opfunc_func_on+0x
5c/0x358)                                                                       
[  264.290795] [<c04a0490>] (opfunc_func_on) from [<c049e1f4>] (wmt_core_opid_ha
ndler+0x34/0x54)                                                                
[  264.299266] [<c049e1f4>] (wmt_core_opid_handler) from [<c049e240>] (wmt_core_
opid+0x2c/0x6c)                                                                 
[  264.307651] [<c049e240>] (wmt_core_opid) from [<c04a7508>] (wmtd_thread+0x18c
/0x244)                                                                         
[  264.315348] [<c04a7508>] (wmtd_thread) from [<c0146118>] (kthread+0x13c/0x16c
)                                                                               
[  264.322530] [<c0146118>] (kthread) from [<c0108c68>] (ret_from_fork+0x14/0x2c
)                                                                               

dmesg

[   26.210065] [WMT-MOD-INIT][I]do_common_drv_init:finish common driver init    
[   26.210070] [BT-MOD-INIT][I]do_bluetooth_drv_init:CONFIG_MTK_COMBO_BT is not 
defined                                                                         
[   26.210075] [WCN-MOD-INIT][E]do_connectivity_driver_init(57):do common driver
 init failed, ret:-1                                                            
[   26.210079] [GPS-MOD-INIT][I]do_gps_drv_init:CONFIG_MTK_COMBO_GPS is not defi
ned                                                                             
[   26.210083] [WCN-MOD-INIT][E]do_connectivity_driver_init(62):do common driver
 init failed, ret:-1                                                            
[   26.210086] [FM-MOD-INIT][I]do_fm_drv_init:start to do fm module init        
[   26.210089] [FM-MOD-INIT][I]do_fm_drv_init:finish fm module init             
[   26.210093] [WLAN-MOD-INIT][I]do_wlan_drv_init:start to do wlan module init 0
x7623                                                                           
[   26.213412] [MTK-WIFI] WIFI_init: mtk_wmt_WIFI_chrdev driver(major 153) insta
lled.                                                                           
[   26.213423] [WLAN-MOD-INIT][I]do_wlan_drv_init:WMT-WIFI char dev init, ret:0 
[   26.214325] [WLAN-MOD-INIT][I]do_wlan_drv_init:WLAN-GEN2 driver init, ret:0  
[   26.214333] [WLAN-MOD-INIT][I]do_wlan_drv_init:finish wlan module init       
[   26.214731] [WMT-DETECT][I]wmt_detect_close:close major 154 minor 0 (pid 1114
)                                                                               
[  263.950064] [WMT-DEV][W]WMT_unlocked_ioctl:chipid = 0x7623                   
[  263.950151] [WMT-LIB][W]wmt_lib_set_hif:new hifType: 2, fm:2                 
[  263.950203] [WMT-CORE][E]opfunc_hif_conf(874):WMT-CORE: WMT HIF info added   
[  263.950236] [WMT-DEV][W]WMT_unlocked_ioctl:unknown cmd (-2147180516)         
[  263.950486] Unable to handle kernel NULL pointer dereference at virtual addre
ss 00000040                                                                     
[  263.950491] pgd = c0004000                                                   
[  263.950496] [00000040] *pgd=00000000                                         
[  263.950509] Internal error: Oops: 17 [#1] SMP ARM                            
[  263.956093] Modules linked in:                                               
[  263.960498] CPU: 3 PID: 1118 Comm: mtk_wmtd Not tainted 4.14.6-00012-g3bf8d6a
-dirty #25                                                                      
[  263.969808] Hardware name: Mediatek Cortex-A7 (Device Tree)                  
[  263.976704] task: debdd400 task.stack: dc87e000                              
[  263.982574] PC is at mutex_lock+0x28/0x54                                    
[  263.987917] LR is at regulator_set_mode+0x2c/0xb4


root@bpi-r2:~# stp_uart_launcher -p /etc/firmware &                             
[1] 1308
root@bpi-r2:~# open device node succeed.(Node:/
[   33.157686] Internal error: Oops: 17 [#1] SMP ARM  << here the kernel oops, after that my r2 is not responsible
dev/stpwmt, fd:3
chip id is 0

have opened a ssh-session in second terminal looking live at dmesg:

root@bpi-r2:~# dmesg -wH
[Dec15 14:07] [WMT-DETECT][I]wmt_detect_open:open major 154 minor 0 (pid 1415)
[  +0.000034] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191037),arg(0)
[  +0.000062] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (1074034433),arg(30243)
[  +0.000005] set current consys chipid (0x7623)
[  +0.000014] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191036),arg(30243)
[  +0.000006] [WMT-MOD-INIT][I]do_common_drv_init:start to do common driver init, chipid:0x00007623
[  +0.000007] DEBUG: Passed WMT_init 2396 
[  +0.000483] DEBUG: Passed WMT_init 2404 
[  +0.000007] DEBUG: Passed WMT_init 2407 
[  +0.000007] DEBUG: Passed WMT_init 2414 
[  +0.000076] DEBUG: Passed WMT_init 2419 
[  +0.001493] DEBUG: Passed WMT_init 2423 
[  +0.001085] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[  +0.000012] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[  +0.000007] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[  +0.000007] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[  +0.000007] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[  +0.000007] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[  +0.002628] [WMT-CONSYS-HW][E]mtk_wmt_probe(122):Wmt Cannot find pinctrl default!
[  +0.000304] OF: /consys@18070000: could not get #reset-cells for /watchdog@10007000
[  +0.000008] [WMT-CONSYS-HW][E]mtk_wmt_probe(170):CanNot get consys reset. ret=-22
[  +0.000410] mt7623consys: probe of 18070000.consys failed with error -22
[  +0.000659] DEBUG: Passed WMT_init 2452 
[  +0.000006] DEBUG: Passed WMT_init 2457 
[  +0.000016] DEBUG: Passed WMT_init 2460 
[  +0.000011] DEBUG: Passed WMT_init 2465 
[  +0.000005] DEBUG: Passed WMT_init 2470 
[  +0.000025] DEBUG: Passed WMT_init 2472 
[  +0.000004] DEBUG: Passed WMT_init 2475 
[  +0.000004] DEBUG: Passed WMT_init 2477 
[  +0.000003] DEBUG: Passed WMT_init 2486 
[  +0.000007] [WMT-MOD-INIT][I]do_common_drv_init:finish common driver init
[  +0.000004] [BT-MOD-INIT][I]do_bluetooth_drv_init:CONFIG_MTK_COMBO_BT is not defined
[  +0.000006] [WCN-MOD-INIT][E]do_connectivity_driver_init(57):do common driver init failed, ret:-1
[  +0.000003] [GPS-MOD-INIT][I]do_gps_drv_init:CONFIG_MTK_COMBO_GPS is not defined
[  +0.000005] [WCN-MOD-INIT][E]do_connectivity_driver_init(62):do common driver init failed, ret:-1
[  +0.000003] [FM-MOD-INIT][I]do_fm_drv_init:start to do fm module init
[  +0.000003] [FM-MOD-INIT][I]do_fm_drv_init:finish fm module init
[  +0.000008] [WLAN-MOD-INIT][I]do_wlan_drv_init:start to do wlan module init 0x7623
[  +0.003067] [MTK-WIFI] WIFI_init: mtk_wmt_WIFI_chrdev driver(major 153) installed.
[  +0.000010] [WLAN-MOD-INIT][I]do_wlan_drv_init:WMT-WIFI char dev init, ret:0
[  +0.000870] [WLAN-MOD-INIT][I]do_wlan_drv_init:WLAN-GEN2 driver init, ret:0
[  +0.000010] [WLAN-MOD-INIT][I]do_wlan_drv_init:finish wlan module init
[  +0.000460] [WMT-DETECT][I]wmt_detect_close:close major 154 minor 0 (pid 1415)

Message from syslogd@bpi-r2 at Dec 15 14:08:14 ...
 kernel:[  131.083366] Internal error: Oops: 17 [#1] SMP ARM  <<<<oops happens here
[Dec15 14:08] [WMT-DEV][W]WMT_unlocked_ioctl:chipid = 0x7623
[  +0.000123] [WMT-LIB][W]wmt_lib_set_hif:new hifType: 2, fm:2
[  +0.000039] [WMT-DEV][W]WMT_unlocked_ioctl:unknown cmd (-2147180516)
[  +0.000036] [WMT-CORE][E]opfunc_hif_conf(874):WMT-CORE: WMT HIF info added
[  +0.000187] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 232       <<< beginning of mtk_wcn_consys_hw_reg_ctrl
[  +0.000016] vcn18: mode operation not allowed
[  +0.000004] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 236 
[  +0.000003] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 239 
[  +0.000007] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 241 
[  +0.000509] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 248 
[  +0.000316] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 275 
[  +0.000004] ------------[ cut here ]------------
[  +0.000017] WARNING: CPU: 0 PID: 1420 at drivers/reset/core.c:230 reset_control_reset+0x130/0x150
[  +0.000004] Modules linked in:
[  +0.000012] CPU: 0 PID: 1420 Comm: mtk_wmtd Not tainted 4.14.6-00012-g3bf8d6a-dirty #27
[  +0.000004] Hardware name: Mediatek Cortex-A7 (Device Tree)
[  +0.000023] [<c0113208>] (unwind_backtrace) from [<c010d6b0>] (show_stack+0x20/0x24)
[  +0.000014] [<c010d6b0>] (show_stack) from [<c08b91e0>] (dump_stack+0x9c/0xb0)
[  +0.000015] [<c08b91e0>] (dump_stack) from [<c0125478>] (__warn+0xf8/0x110)
[  +0.000012] [<c0125478>] (__warn) from [<c0125560>] (warn_slowpath_null+0x30/0x38)
[  +0.000011] [<c0125560>] (warn_slowpath_null) from [<c042e6a4>] (reset_control_reset+0x130/0x150)
[  +0.000013] [<c042e6a4>] (reset_control_reset) from [<c04c2374>] (mtk_wcn_consys_hw_reg_ctrl+0x214/0x6a0)
[  +0.000011] [<c04c2374>] (mtk_wcn_consys_hw_reg_ctrl) from [<c04c29b4>] (mtk_wcn_consys_hw_pwr_on+0x50/0xc4)
[  +0.000010] [<c04c29b4>] (mtk_wcn_consys_hw_pwr_on) from [<c04c4790>] (wmt_plat_pwr_ctrl+0xa4/0x124)  
[  +0.000012] [<c04c4790>] (wmt_plat_pwr_ctrl) from [<c04a1c88>] (wmt_ctrl_hw_pwr_on+0x68/0x88)
[  +0.000010] [<c04a1c88>] (wmt_ctrl_hw_pwr_on) from [<c04a1d78>] (wmt_ctrl+0x44/0xc0)
[  +0.000009] [<c04a1d78>] (wmt_ctrl) from [<c049e2cc>] (wmt_core_ctrl+0x4c/0xcc)
[  +0.000009] [<c049e2cc>] (wmt_core_ctrl) from [<c04a028c>] (opfunc_pwr_on+0x5c/0x204)
[  +0.000009] [<c04a028c>] (opfunc_pwr_on) from [<c04a0490>] (opfunc_func_on+0x5c/0x358)
[  +0.000009] [<c04a0490>] (opfunc_func_on) from [<c049e1f4>] (wmt_core_opid_handler+0x34/0x54)
[  +0.000009] [<c049e1f4>] (wmt_core_opid_handler) from [<c049e240>] (wmt_core_opid+0x2c/0x6c)
[  +0.000010] [<c049e240>] (wmt_core_opid) from [<c04a7508>] (wmtd_thread+0x18c/0x244)
[  +0.000012] [<c04a7508>] (wmtd_thread) from [<c0146118>] (kthread+0x13c/0x16c)
[  +0.000012] [<c0146118>] (kthread) from [<c0108c68>] (ret_from_fork+0x14/0x2c)
[  +0.000020] ---[ end trace ddb7121164b33204 ]---
[  +0.000004] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 277 
[  +0.000071] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 279 
[  +0.000025] Unable to handle kernel NULL pointer dereference at virtual address 00000010
[  +0.000004] pgd = c0004000
[  +0.000004] [00000010] *pgd=00000000
[  +0.000012] Internal error: Oops: 17 [#1] SMP ARM
[  +0.005920] Modules linked in:
[  +0.003039] CPU: 0 PID: 1420 Comm: mtk_wmtd Tainted: G        W       4.14.6-00012-g3bf8d6a-dirty #27
[  +0.009165] Hardware name: Mediatek Cortex-A7 (Device Tree)
[  +0.005536] task: db0f3c00 task.stack: dc688000
[  +0.004503] PC is at clk_core_enable+0x6c/0x234
[  +0.004498] LR is at clk_core_enable+0x4c/0x234
... removed memory dump
[  +0.008137] [<c0419228>] (clk_core_enable) from [<c0419564>] (clk_core_enable_lock+0x28/0x3c)
[  +0.008473] [<c0419564>] (clk_core_enable_lock) from [<c041959c>] (clk_enable+0x24/0x28)
[  +0.008041] [<c041959c>] (clk_enable) from [<c04c256c>] (mtk_wcn_consys_hw_reg_ctrl+0x40c/0x6a0)
[  +0.008731] [<c04c256c>] (mtk_wcn_consys_hw_reg_ctrl) from [<c04c29b4>] (mtk_wcn_consys_hw_pwr_on+0x50/0xc4)
[  +0.009765] [<c04c29b4>] (mtk_wcn_consys_hw_pwr_on) from [<c04c4790>] (wmt_plat_pwr_ctrl+0xa4/0x124)
[  +0.009075] [<c04c4790>] (wmt_plat_pwr_ctrl) from [<c04a1c88>] (wmt_ctrl_hw_pwr_on+0x68/0x88)
[  +0.008472] [<c04a1c88>] (wmt_ctrl_hw_pwr_on) from [<c04a1d78>] (wmt_ctrl+0x44/0xc0)
[  +0.007695] [<c04a1d78>] (wmt_ctrl) from [<c049e2cc>] (wmt_core_ctrl+0x4c/0xcc)
[  +0.007263] [<c049e2cc>] (wmt_core_ctrl) from [<c04a028c>] (opfunc_pwr_on+0x5c/0x204)
[  +0.007781] [<c04a028c>] (opfunc_pwr_on) from [<c04a0490>] (opfunc_func_on+0x5c/0x358)
[  +0.007866] [<c04a0490>] (opfunc_func_on) from [<c049e1f4>] (wmt_core_opid_handler+0x34/0x54)
[  +0.008469] [<c049e1f4>] (wmt_core_opid_handler) from [<c049e240>] (wmt_core_opid+0x2c/0x6c)
[  +0.008385] [<c049e240>] (wmt_core_opid) from [<c04a7508>] (wmtd_thread+0x18c/0x244)
[  +0.007697] [<c04a7508>] (wmtd_thread) from [<c0146118>] (kthread+0x13c/0x16c)
[  +0.007180] [<c0146118>] (kthread) from [<c0108c68>] (ret_from_fork+0x14/0x2c)
[  +0.007177] Code: e595307c e3530000 ca00003b e5943004 (e5933010) 
[  +0.006053] ---[ end trace ddb7121164b33205 ]---

seems that i must rework my dts(i)

after dts(i) rework (had to patch manually, patch have some hunks failed):

Debian GNU/Linux 9 bpi-r2 ttyS0

bpi-r2 login: root 
Password: 
Last login: Fri Dec 15 14:06:28 CET 2017 from 192.168.0.21 on pts/0
Linux bpi-r2 4.14.6-00012-g3bf8d6a-dirty #28 SMP Fri Dec 15 14:32:03 CET 2017 armv7l
root@bpi-r2:~# dmesg -C
root@bpi-r2:~# wmt_loader 
init combo device
Opened combo device
get device id : 30243
set device id : 30243
do module init: 30243
failed to init module 
root@bpi-r2:~# stp_uart_launcher -p /etc/firmware &
[1] 1434
open device node succeed.(Node:/dev/stpwmt, fd:3) 
chip id is 0x7623
chiId:0x7623, setting to property((null))
chiId:0x7623
run SOC chip flow
create pwr on thread ok
root@bpi-r2:~# enter power on connsys flowpatch name pre-fix:ROMv2_lm_patch
fwVersion:0x8a00
/etc/firmware/ROMv2_lm_patch_1_0_hdr.bin
fw Ver in patch: 0x8a00
read patch info:0x22,0x00,0x06,0x00
gpatchnum = [2]
gdwonseq = [2]
/etc/firmware/ROMv2_lm_patch_1_1_hdr.bin
fw Ver in patch: 0x8a00
read patch info:0x21,0x00,0x0e,0xf0
gdwonseq = [1]
cmd(srh_patch) resp(ok)

root@bpi-r2:~# ls /dev/wmt*
wmtdetect  wmtWifi
root@bpi-r2:~# 
root@bpi-r2:~# 
root@bpi-r2:~# echo A >/dev/wmtWifi
root@bpi-r2:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e6:fd:cf:08:11:dc brd ff:ff:ff:ff:ff:ff
    inet6 fe80::e4fd:cfff:fe08:11dc/64 scope link 
       valid_lft forever preferred_lft forever
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
4: wan@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether e6:fd:cf:08:11:dc brd ff:ff:ff:ff:ff:ff
5: lan0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 08:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.10/24 brd 192.168.0.255 scope global lan0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:ff:fe00:0/64 scope link 
       valid_lft forever preferred_lft forever
6: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default qlen 1000
    link/ether 08:00:00:00:00:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global lan1
       valid_lft forever preferred_lft forever
7: lan2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether e6:fd:cf:08:11:dc brd ff:ff:ff:ff:ff:ff
8: lan3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether e6:fd:cf:08:11:dc brd ff:ff:ff:ff:ff:ff
9: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:08:22:c2:81:02 brd ff:ff:ff:ff:ff:ff
10: ap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000   <<<<<<<<<<<<< ap0 exists :)
    link/ether 02:08:22:c2:81:02 brd ff:ff:ff:ff:ff:ff
root@bpi-r2:~# 

pushed current state to my github-wifi-branch

https://github.com/frank-w/BPI-R2-4.14/tree/wifi_mt6625l

and uploaded compiled Kernel to my gdrive

https://drive.google.com/drive/folders/1EGN1TvqCpDHdOAS-mjRg9ipi0kahnOUV

happy testing :wink:

some messages in log that should be fixed, if all is working and debug-kprints are removed: wifi_dmesg.log (6,5 KB)

configured hostapd, seems to run, see the AP “test”, but cannot connect to it (hostapd does not recognize connect-attempt)

http://www.fw-web.de/dokuwiki/doku.php?id=en/bpi-r2/wlan