OpenWrt Forum Archive

Topic: Lantiq XWAY WAVE300

The content of this topic has been archived between 30 Mar 2018 and 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello Vittorio,

Yes, sources as-is need a lot to tweaks to get them compiled. Also it took me some time to figure out how the whole thing works more or less.

Anyway, I didn't want to push my changes in case Lantiq had any issues with the publication of sources.

So far no complains so I guess I can proceed to dump all patches.

Please stay tune for the next weeks. I'll let you know when everything is ready.

On the other hand, thank you for the patch. I will probably push the same to my platform.

Mandrake

vittorio88 wrote:

Hello Mandrake,

I downloaded your Github repo, however was unable to compile it.

Can you provide some build steps?

FWIW, here is the final patch I used to enable the WAV300 on my TP-Link VR200:

diff --git a/target/linux/lantiq/dts/VR200v.dts b/target/linux/lantiq/dts/VR200v.dts
index e281042..ecb2455 100644
--- a/target/linux/lantiq/dts/VR200v.dts
+++ b/target/linux/lantiq/dts/VR200v.dts
@@ -76,6 +76,10 @@
                        status = "okay";
                        gpios = <&gpio 33 0>;
                };
+               pci0: pci@E105400 {
+                       status = "okay";
+                       gpio-reset = <&gpio 21 0>;
+               };
        };
 
        gphy-xrx200 {

Staying tuned!

Hello Vittorio and whoever listening,

I'm already pushing changes to the github branch Dual-license-BSD_GPL.

Up to day, you should be able to run "make menuconfig" and have the system ready for compilation under /builds.

I have also added a "instructions.txt" file for help. I believe everything should be self-explanatory.

However I'd appreciate if you can update with these changes and check if everything is fine for you.

The following days I'll be addresing the real problem, up-port sources to Linux ≥4.4

Best regards

Dears,

I have pushed all my changes to the branch "Dual-license-BSD_GPL".

I have tested compilation and it's fine in my local machine so I expect to be the same for whoever downloads the sources.

On the other hand, I have added a better documentation so everything can be run with just changing a few lines. Or so I hope.

Don't be fooled. The driver is not working as per today. The major roadblock I have is the interrupt request (PCI MSI). It's simply not working with my LEDE distro but I have the suspicious that this is nothing to do with the driver itself but my system so I would like to have the feedback of this driver in other machines than Livebox 2.1 Linux 4.4

At last, it is not my aim to continue fighthing with this driver. I've spent a lot of my free time during one year trying to bring to life this code and this is my best. I will move now to other hobbies although I will keep an eye every now and then to this thread.

Take care and enjoy summer!

Hello Mandrake,

I have been working on the driver as well.

I was trying to get a working build, but your latest code push fixes what I've been working on myself.
Specifically up-porting proc_fs on ./wireless/driver/linux/mtlk_df_proc_impl.c

I have seen your modifications. Excellent work! I can now throw mine away...

You have already done a lot, I don't expect you to work on it all summer, however I would like to talk to you if possible. If you send me an email to my username @ gmail dot com, we could exchange contact details, and possibly have a phone conversation so that I may pick up where you left off.

Thanks,
Vittorio

I built, and inserted the driver, however upon inserting mtlk.ko after mtlkroot.ko I get no output.
lspci -k doesn't show anything under the WAV300.

mtlkroot.ko does print a statement about proprietary and version number, but that's it.

Any suggestions?

Thanks for yours efforts guys, hope to see soon all your work working!!!!

Hello,

I am writing to check-in. I have forked and further developed Mandrake's code.
To anybody interested, this branch has stable (minor) fixes:
  https://github.com/vittorio88/WAVE300/tree/vitto_fixes
  Mandrake: I would consider this branch safe to merge.

This branch has some heavy changes that are quite different from Mandrake's code:
  https://github.com/vittorio88/WAVE300/t … ld_x86_64.
The differences in this branch is that:
  1. Enable debug w/ VRX288 target in menuconfig builds successfully
  2. Can select x86 target and build successfully.

I have the following issues, and don't know where to go from here:
  1. Cross-compiling for my VR200v target, I can insmod mtlkroot.ko and mtlk.ko, but cannot for the life of me get it to print anything, and I don't believe it's working due to few /proc entries.
  2. Building x86 natively on Ubuntu w/ linux 4.10 causes a crash when I run insmod mtlkroot.ko

Help would be appreciated with testing for either of these two targets.

Thanks,
Vittorio

Hi,

Thank you for all the hard work you've put in so far. Very impressive.

I'm happy to help out with this on my hardware - a TD-W8980.

I've compiled the openwrt from source. No modification is needed to the dts for TD-W8980. The PCI bus is already active:

Linux OpenWrt 4.4.14 #2 SMP Tue Aug 15 18:55:50 UTC 2017 mips GNU/Linux

root@OpenWrt:~# lspci -v
00:0e.0 Wireless controller: Lantiq Wave300 PSB8224 [Hyperion III] (rev 01)
    Subsystem: Lantiq Device 0680
    Flags: medium devsel, IRQ 30Linux OpenWrt 4.4.14 #2 SMP Tue Aug 15 18:55:50 UTC 2017 mips GNU/Linux
    Memory at 18800000 (32-bit, prefetchable) [disabled] [size=4097]
    Memory at 18000000 (32-bit, prefetchable) [disabled] [size=8388609]
    Memory at <unassigned> (32-bit, non-prefetchable) [disabled] [size=2]
    Memory at <unassigned> (32-bit, non-prefetchable) [disabled] [size=2]
    Memory at <unassigned> (32-bit, non-prefetchable) [disabled] [size=2]
    Memory at <unassigned> (32-bit, non-prefetchable) [disabled] [size=2]
    Expansion ROM at <unassigned> [disabled] [size=2]
lspci: Unable to load libkmod resources: error -12


I could use some help correctly compiling the WAVE300 driver. I'm using vitto_fixes branch. With the default options set in make menuconfig and "ugw5.1-vrx288" selected I get the following error:

mv -f .deps/logmacro_database.Tpo .deps/logmacro_database.Po
/home/benjamin/Downloads/router/test/driver/support/mtlkfront.sh /home/benjamin/Downloads/router/openwrt/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mips-openwrt-linux-gcc -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/benjamin/Downloads/router/openwrt/build_dir/target-mips_34kc+dsp_musl-1.1.16/linux-lantiq_xrx200/linux-4.4.14/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec   -L/home/benjamin/Downloads/router/openwrt/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.16/usr/lib/ -o drvhlpr arphelper.o drvhlpr.o irbponger.o asel.o ledsctrl.o wpsctrl.o app_info.o logmacro_database.o ./../shared/libmttools.a ../../../tools/shared/3rd_party/iniparser/libiniparser.a -Wl,--start-group ../../../wireless/shared/libmtlkwls.a ../../../tools/shared/linux/libmtlkc.a -Wl,--end-group -lpthread -lrt -lm -lnl
/home/benjamin/Downloads/router/openwrt/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.16/lib/gcc/mips-openwrt-linux-musl/5.3.0/../../../../mips-openwrt-linux-musl/bin/ld: cannot find -lnl
collect2: error: ld returned 1 exit status
Makefile:416: recipe for target 'drvhlpr' failed


If I disable MTTools I get:

make[4]: Entering directory '/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/tools/rtlogger/prebuilt'
make[4]: *** No rule to make target 'logconv.exe', needed by 'all-am'. Stop.


If I disable RT Logger as well I get:

LP      /home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_priv.h
/home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_user.c: In function 'mtlk_df_ui_reg_aocs_proc_cl':
/home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_user.c:4705:76: error: passing argument 4 of 'mtlk_df_proc_node_add_wo_entry' from incompatible pointer type [-Werror=incompatible-pointer-types]
             "aocs_cl", df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_aocs_proc_cl_fop);
                                                                            ^
In file included from /home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_user_priv.h:15:0,
                 from /home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_user.c:13:
/home/benjamin/Downloads/router/test/driver/wireless/driver/shared/mtlk_df.h:485:1: note: expected 'mtlk_df_proc_entry_write_f {aka int (*)(struct file *, const char *, unsigned int,  long long int *)}' but argument is of type 'int (*)(struct file *, const char *, long unsigned int,  void *)'
mtlk_df_proc_node_add_wo_entry(char *name,
^
cc1: all warnings being treated as errors
scripts/Makefile.build:258: recipe for target '/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/wireless/driver/linux/wireless/driver/linux/mtlk_df_user.o' failed
make[6]: *** [/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/wireless/driver/linux/wireless/driver/linux/mtlk_df_user.o] Error 1
Makefile:1385: recipe for target '_module_/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/wireless/driver/linux' failed
make[5]: *** [_module_/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/wireless/driver/linux] Error 2
make[5]: Leaving directory '/home/benjamin/Downloads/router/openwrt/build_dir/target-mips_34kc+dsp_musl-1.1.16/linux-lantiq_xrx200/linux-4.4.14'
Makefile:543: recipe for target 'mtlk.ko' failed


With all options disabled (i.e. Lantiq RF MGMT, hostapd 0.6 and General debug extensions), leaving only WLan driver for Linux and Gen3 PCI I get both mtlkroot and mtlk fully built in one step (no need to make from /driver/builds/ugw5.1-vrx288/wireless/driver/linux).

However, once I insert them into the hardware I get a segmentation fault on mtlk.ko:

https://pastebin.com/vVG3dAkM

What make menuconfig options are you using to build the driver? Have I taken a wrong step somewhere?

Thanks

blackadder1000 wrote:

I could use some help correctly compiling the WAVE300 driver. I'm using vitto_fixes branch. With the default options set in make menuconfig and "ugw5.1-vrx288" selected I get the following error:

mv -f .deps/logmacro_database.Tpo .deps/logmacro_database.Po
/home/benjamin/Downloads/router/test/driver/support/mtlkfront.sh /home/benjamin/Downloads/router/openwrt/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mips-openwrt-linux-gcc -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/benjamin/Downloads/router/openwrt/build_dir/target-mips_34kc+dsp_musl-1.1.16/linux-lantiq_xrx200/linux-4.4.14/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec   -L/home/benjamin/Downloads/router/openwrt/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.16/usr/lib/ -o drvhlpr arphelper.o drvhlpr.o irbponger.o asel.o ledsctrl.o wpsctrl.o app_info.o logmacro_database.o ./../shared/libmttools.a ../../../tools/shared/3rd_party/iniparser/libiniparser.a -Wl,--start-group ../../../wireless/shared/libmtlkwls.a ../../../tools/shared/linux/libmtlkc.a -Wl,--end-group -lpthread -lrt -lm -lnl
/home/benjamin/Downloads/router/openwrt/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.16/lib/gcc/mips-openwrt-linux-musl/5.3.0/../../../../mips-openwrt-linux-musl/bin/ld: cannot find -lnl
collect2: error: ld returned 1 exit status
Makefile:416: recipe for target 'drvhlpr' failed


You have to make sure you are linking against libnl or libnl-tiny (one or the other) that you have downloaded previously in your LEDE or OpenWRT build root. I have explained how to install it in the README in the vitto-fixes branch. Then I added the following to ugw.env.common:

LDFLAGS="-L${STAGING_DIR}/target-mips_24kc_musl-1.1.16/usr/lib/"

blackadder1000 wrote:

If I disable MTTools I get:

make[4]: Entering directory '/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/tools/rtlogger/prebuilt'
make[4]: *** No rule to make target 'logconv.exe', needed by 'all-am'. Stop.


I removed logconv.exe, mtlklog.dll, and nc.exe from the Makefile.in and Makefile.am of rtlogger for it to build.
After this, it builds successfully, but it may be incomplete or broken.


blackadder1000 wrote:

If I disable RT Logger as well I get:

LP      /home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_priv.h
/home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_user.c: In function 'mtlk_df_ui_reg_aocs_proc_cl':
/home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_user.c:4705:76: error: passing argument 4 of 'mtlk_df_proc_node_add_wo_entry' from incompatible pointer type [-Werror=incompatible-pointer-types]
             "aocs_cl", df_user->slow_ctx->proc_df_debug_node, df_user->df, mtlk_df_ui_aocs_proc_cl_fop);
                                                                            ^
In file included from /home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_user_priv.h:15:0,
                 from /home/benjamin/Downloads/router/test/driver/wireless/driver/linux/mtlk_df_user.c:13:
/home/benjamin/Downloads/router/test/driver/wireless/driver/shared/mtlk_df.h:485:1: note: expected 'mtlk_df_proc_entry_write_f {aka int (*)(struct file *, const char *, unsigned int,  long long int *)}' but argument is of type 'int (*)(struct file *, const char *, long unsigned int,  void *)'
mtlk_df_proc_node_add_wo_entry(char *name,
^
cc1: all warnings being treated as errors
scripts/Makefile.build:258: recipe for target '/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/wireless/driver/linux/wireless/driver/linux/mtlk_df_user.o' failed
make[6]: *** [/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/wireless/driver/linux/wireless/driver/linux/mtlk_df_user.o] Error 1
Makefile:1385: recipe for target '_module_/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/wireless/driver/linux' failed
make[5]: *** [_module_/home/benjamin/Downloads/router/test/driver/builds/ugw5.1-vrx288/wireless/driver/linux] Error 2
make[5]: Leaving directory '/home/benjamin/Downloads/router/openwrt/build_dir/target-mips_34kc+dsp_musl-1.1.16/linux-lantiq_xrx200/linux-4.4.14'
Makefile:543: recipe for target 'mtlk.ko' failed


This has to do with the up-porting of Proc FS on the driver that both Mandrake and I have implemented differently. The branch vitto-fixes contains Mandrakes version, which I was not able to compile with debug enabled.
You can try my experimental branch: fix_build_x86_64


blackadder1000 wrote:

With all options disabled (i.e. Lantiq RF MGMT, hostapd 0.6 and General debug extensions), leaving only WLan driver for Linux and Gen3 PCI I get both mtlkroot and mtlk fully built in one step (no need to make from /driver/builds/ugw5.1-vrx288/wireless/driver/linux).

However, once I insert them into the hardware I get a segmentation fault on mtlk.ko:

https://pastebin.com/vVG3dAkM

What make menuconfig options are you using to build the driver? Have I taken a wrong step somewhere?

Thanks


With my experimental branch and the modifications from this post, pretty much all menuconfig options compile on my box.
You have gotten farther than I have, because I do not get any output when I insmod the driver built from any branch. I do not know where my issue is, but Mandrake suggested it may be because I am working through SSH instead of serial console.

The segfault you showed me indicates that the driver DOES print something, but is having a hard-time initializing the WiFi chip at the hardware level. This is great progress.
It seems to get stuck on:

[0000838180] mtlk3(_mtlk_mmb_wait_chi_magic:2099): Wait for CHI Magic failed (wait_res=1 value=0x00002350)

whatever that is....



Thanks for trying, I will try to be more active here as I am now back from vacation.

Thanks for the advice. Really helped. I'm now on branch fix_build_x86_64 but still compiling for my router hardware.

I can compile all default options now except for mttools. I get the error:

/home/benjamin/router/WAVE300/driver/support/mtlkfront.sh /home/benjamin/router/openwrt/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mips-openwrt-linux-gcc -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/benjamin/router/openwrt/build_dir/target-mips_34kc+dsp_musl-1.1.16/linux-lantiq_xrx200/linux-4.4.14/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec   -L/home/benjamin/router/openwrt/staging_dir/target-mips_34kc+dsp_musl-1.1.16/usr/lib/ -o drvhlpr arphelper.o drvhlpr.o irbponger.o asel.o ledsctrl.o wpsctrl.o app_info.o logmacro_database.o ./../shared/libmttools.a ../../../tools/shared/3rd_party/iniparser/libiniparser.a -Wl,--start-group ../../../wireless/shared/libmtlkwls.a ../../../tools/shared/linux/libmtlkc.a -Wl,--end-group -lpthread -lrt -lm -lnl 
/home/benjamin/router/WAVE300/driver/builds/ugw5.1-vrx288/tools/shared/linux/libmtlkc.a(mtlknlink.o): In function `parse_nl_cb':
mtlknlink.c:(.text+0x48): undefined reference to `genlmsg_parse'
/home/benjamin/router/WAVE300/driver/builds/ugw5.1-vrx288/tools/shared/linux/libmtlkc.a(mtlknlink.o): In function `mtlk_nlink_create':
mtlknlink.c:(.text+0x13c): undefined reference to `genl_connect'
mtlknlink.c:(.text+0x154): undefined reference to `genl_ctrl_resolve'
collect2: error: ld returned 1 exit status

Any advice? Something about the linked library. I am using libnl-tiny. I tried linking instead with plain libnl but I get the same error.

Otherwise, a compiled driver with all default options except mttools gives the same "Wait for CHI Magic failed" error as previously found. Also, I found I now have to compile in the two steps mentioned instructions.txt (i.e. go to /driver/builds/ugw5.1-vrx288/wireless/driver/linux and make).

As an aside, the TDW8980 official image does not include a sta_upper.bin, only ap_upper.bin. So I had to fake it by copying ap_upper.bin. Guess we're not at a stage where that is a problem.

Hello Vittorio & Blackadder,

Thanks for your feedback. Your platforms are using PCI not PCIe. This is a trouble to me but not for you.

I don't know if you're aware, but in order to have the full debug on screen, you have to:

  • Compile with target debug level. For instance maximum 9.

  • Insert module with debug level chosen

Also we're hitting the black beast now. I stopped my investigations when I stumbled upon this "CHI Magic" timeout.

Basically what I found is that the driver is writing some code into the chipset register and polls for an output message saying "I'm here and ready". This message is never coming and therefore the driver stops because it believes that the chipset is dead/non avalaible.

As far as I went, the writing to the register was perfectly done but the chip was never answering. I thought at that time it could be something related to the interrrupts not assigned but after your output, this is not the case.

Last, I will try to find some time this weeked and bring all the changes from Vittorio to my github. Also, I would like to start some documentation in the wiki and improve what we have as plain test.

And thanks for joining. It's been very lonely here for the last year.

Mandrake

Hello Mandrake,

It is my pleasure to help, we're in the same boat here!

I compiled again with debug set to 9. For some reason the ncurses menu of menuconfig doesn't let me manually edit the debug level in the number entry pop-up. I cannot delete the existing number through that pop-up, so I manually edited .config and set:

#
# Log level
#
CONFIG_MAX_DLEVEL=9
# CONFIG_SILENT is not set

Then I ran menuconfig again to check, and the log level is set to 9.

I have tried insmoding from the serial console. This is all I get:

root@vitto-rtr1:/# cd /lib/modules/                                             
root@vitto-rtr1:/lib/modules# ls                                                
4.4.79       mtlk.ko      mtlkroot.ko    
root@vitto-rtr1:/lib/modules# insmod mtlkroot.ko                                
[   94.862392] mtlkroot: module license 'Proprietary' taints kernel.            
[   94.867182] Disabling lock debugging due to kernel taint                     
root@vitto-rtr1:/lib/modules# insmod mtlk.ko                                    
root@vitto-rtr1:/lib/modules# dmesg | tail -n 3                                 
[   45.310407] pppoe-wan: renamed from ppp0                                     
[   94.862392] mtlkroot: module license 'Proprietary' taints kernel.            
[   94.867182] Disabling lock debugging due to kernel taint    

There is no other output. There are some entries in /sys, but I believe they are debug symbols or something like that.

Is there something I am missing? How big are your binaries?

root@vitto-rtr1:/lib/modules# ll -h mtlk*
-rwxr-xr-x    1 root     root        1.4M Aug 24 21:42 mtlk.ko*
-rwxr-xr-x    1 root     root      112.6K Aug 24 21:42 mtlkroot.ko*
blackadder1000 wrote:

Otherwise, a compiled driver with all default options except mttools gives the same "Wait for CHI Magic failed" error as previously found. Also, I found I now have to compile in the two steps mentioned instructions.txt (i.e. go to /driver/builds/ugw5.1-vrx288/wireless/driver/linux and make).

As an aside, the TDW8980 official image does not include a sta_upper.bin, only ap_upper.bin. So I had to fake it by copying ap_upper.bin. Guess we're not at a stage where that is a problem.


I checked where  "Wait for CHI Magic failed" is printed, and it's part of the function _mtlk_mmb_wait_chi_magic(). I see this function called in this section of code:

    MTLK_START_STEP_VOID(hw_mmb_card, HW_CHI_RESET, MTLK_OBJ_PTR(hw),
                         _mtlk_mmb_chi_reset, (hw));
    MTLK_START_STEP(hw_mmb_card, HW_LOAD_FIRMWARE, MTLK_OBJ_PTR(hw),
                    _mtlk_mmb_load_firmware, (hw));
    MTLK_START_STEP_VOID(hw_mmb_card, HW_RUN_FIRMWARE, MTLK_OBJ_PTR(hw),
                         _mtlk_mmb_run_firmware, (hw));
    MTLK_START_STEP(hw_mmb_card, HW_WAIT_CHI_MAGIC, MTLK_OBJ_PTR(hw),
                    _mtlk_mmb_wait_chi_magic, (hw));

Since it seems to be after the load_firmware and run_firmware calls, I believe the firmware may already be loaded? It would be nice to know if this is the case, and if so which firmware files were sent.

blackadder1000 wrote:

Thanks for the advice. Really helped. I'm now on branch fix_build_x86_64 but still compiling for my router hardware.

I can compile all default options now except for mttools. I get the error:

/home/benjamin/router/WAVE300/driver/support/mtlkfront.sh /home/benjamin/router/openwrt/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.16/bin/mips-openwrt-linux-gcc -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/benjamin/router/openwrt/build_dir/target-mips_34kc+dsp_musl-1.1.16/linux-lantiq_xrx200/linux-4.4.14/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec   -L/home/benjamin/router/openwrt/staging_dir/target-mips_34kc+dsp_musl-1.1.16/usr/lib/ -o drvhlpr arphelper.o drvhlpr.o irbponger.o asel.o ledsctrl.o wpsctrl.o app_info.o logmacro_database.o ./../shared/libmttools.a ../../../tools/shared/3rd_party/iniparser/libiniparser.a -Wl,--start-group ../../../wireless/shared/libmtlkwls.a ../../../tools/shared/linux/libmtlkc.a -Wl,--end-group -lpthread -lrt -lm -lnl 
/home/benjamin/router/WAVE300/driver/builds/ugw5.1-vrx288/tools/shared/linux/libmtlkc.a(mtlknlink.o): In function `parse_nl_cb':
mtlknlink.c:(.text+0x48): undefined reference to `genlmsg_parse'
/home/benjamin/router/WAVE300/driver/builds/ugw5.1-vrx288/tools/shared/linux/libmtlkc.a(mtlknlink.o): In function `mtlk_nlink_create':
mtlknlink.c:(.text+0x13c): undefined reference to `genl_connect'
mtlknlink.c:(.text+0x154): undefined reference to `genl_ctrl_resolve'
collect2: error: ld returned 1 exit status

Any advice? Something about the linked library. I am using libnl-tiny. I tried linking instead with plain libnl but I get the same error.

No problem, thanks for testing!

I do successfully build MT tools, and can execute the binaries. I had to manually copy libnl.so frome the lede dir to /usr/lib/.

root@vitto-rtr1:~# ./mtlk_cli
ERROR: Server must be specified!
Usage: mtlk_cli <cli_server_id> <cmd> [arg1 [arg2 [...]]]
root@vitto-rtr1:~# ./drvhlpr
Usage: drvhlpr [OPTIONS]
Metalink Driver Helper v.3.2.1.1.48.

Available OPTIONS ([MST] - mandatory, [OPT] - optional):
  -p <value>
      - [MST] configuration file
  --debug-level <value>
  -d <value>
      - [OPT] debug level (DEBUG verion only)
  --stderr-err
      - [OPT] duplicate ELOG printouts to stderr
  --stderr-warn
      - [OPT] duplicate ELOG and WLOG printouts to stderr
  --stderr-all
  -e
      - [OPT] duplicate all (ELOG, WLOG, LOG) printouts to stderr
  --help
  -h
      - [OPT] print this help

This was built using branch: fix_build_x86_64, target: UGW5.1 for VRX288, package: libnl-tiny

vittorio88 - your binaries are roughly the same size as mine. My mtlk.ko was a little smaller at 1.2M but mtlkroot.ko was 112k.

In terms of loading firmware, if I don't make a fake version of sta_upper.bin then I get a dmesg error saying it's been unable to load the firmware. So firmware is loaded first then tries for the magic chi.

Sorry I can't be more useful at the moment. I'm on vacation for the next couple of weeks. Will definitely help out more when I'm back though.

Hi,

Just a tip.

We can control the amount of debugging on the console by:

1) Compiling to the desired debug level at "menuconfig", being 9 maximum
2) Inserting the module with console debug parameter and chosen level e.g.

insmod mtlkroot.ko cdebug=9

I believe you only have to define that once, during insertion of mtlkroot.ko

With this you will see fancy messages of loading firmware sta_upper.bin and so on.

However, my system crashed when debug level >4. This is (yet) another thing to be fixed into the driver.

@blackadder1000, have you used the original firmware files (.bin) for your TD-W8980 router? I was wondering if, in order to have this "CHI magic" coming, we need to upload the specific firmware for the chipset. In this case yours is PSB8224

insmod mtlkroot.ko cdebug=9

  -> Does not print anything


insmod mtlkroot.ko cdebuhhhg=9

  outputs

[150463.399703] mtlkroot: unknown parameter 'cdebuhhhg' ignored


insmod mtlk.ko cdebug=9

  outputs

[150463.399703] mtlkroot: unknown parameter 'cdebug' ignored

I also attempted to get the driver to print something upon insertion, but that doesn't print anything either!

root@openwrtdev1:~/WAVE300# git diff driver/tools/mtlkroot/linux/mtlkroot.c
diff --git a/driver/tools/mtlkroot/linux/mtlkroot.c b/driver/tools/mtlkroot/linux/mtlkroot.c
index 867249b..4a9976b 100644
--- a/driver/tools/mtlkroot/linux/mtlkroot.c
+++ b/driver/tools/mtlkroot/linux/mtlkroot.c
@@ -107,12 +107,14 @@ _mtlk_rootdrv_init(void)
 static int __init
 _mtlk_rootdrv_init_module(void)
 {
+pr_info(KERN_ALERT "Hello World!\n");
   return (MTLK_ERR_OK == _mtlk_rootdrv_init()) ? 0 : -EFAULT;
 }

 static void __exit
 _mtlk_rootdrv_cleanup_module(void)
 {
+pr_info(KERN_ALERT "bye World!\n");
   _mtlk_rootdrv_cleanup();
 }

Thanks for the help.
I believe there may be a compilation issue, or something I am not seeing..

Thanks,
Vittorio

hello, tryed o compile driver, and i stucked at this error

............................................
Generating app_info.c...
/home/cornelus/source-master/WAVE300/driver/support/mtlkfront.sh /home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/bin/mips-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I../../../../../tools/mttools/drvhlpr -I../../..  -DMTLK_SOURCE_VERSION="\"3.2.1.1.48.\"" -DLOG_LOCAL_OID=MTLKFRONT_WILL_FILL_IT -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/config.h -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/.config.h -I../../../../../tools/rtlogger/shared -I../../../../../wireless/shared_mbss_mac/ -I../../../../../tools/mtidl -I../../../../../tools/mttools/drvhlpr/../shared/ -I../../../../../tools/mttools/drvhlpr/../shared/linux/ -I../../../../../tools/shared/linux -I../../../../../tools/shared/3rd_party/iniparser -I../../../../../tools/shared -I../../../../../wireless/shared/linux -I../../../../../wireless/shared/linux -I../../../../../wireless/shared -I../../../../../wireless/driver/shared -I /home/cornelus/source-master/build_dir/target-mips_24kc_musl/libnl-tiny-0.1/include  -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec  -MT app_info.o -MD -MP -MF .deps/app_info.Tpo -c -o app_info.o app_info.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
  LP      /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools/drvhlpr/app_info.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mv -f .deps/app_info.Tpo .deps/app_info.Po
/home/cornelus/source-master/WAVE300/driver/support/mtlkfront.sh /home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/bin/mips-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I../../../../../tools/mttools/drvhlpr -I../../..  -DMTLK_SOURCE_VERSION="\"3.2.1.1.48.\"" -DLOG_LOCAL_OID=MTLKFRONT_WILL_FILL_IT -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/config.h -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/.config.h -I../../../../../tools/rtlogger/shared -I../../../../../wireless/shared_mbss_mac/ -I../../../../../tools/mtidl -I../../../../../tools/mttools/drvhlpr/../shared/ -I../../../../../tools/mttools/drvhlpr/../shared/linux/ -I../../../../../tools/shared/linux -I../../../../../tools/shared/3rd_party/iniparser -I../../../../../tools/shared -I../../../../../wireless/shared/linux -I../../../../../wireless/shared/linux -I../../../../../wireless/shared -I../../../../../wireless/driver/shared -I /home/cornelus/source-master/build_dir/target-mips_24kc_musl/libnl-tiny-0.1/include  -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec  -MT logmacro_database.o -MD -MP -MF .deps/logmacro_database.Tpo -c -o logmacro_database.o `test -f '../../../../../tools/rtlogger/shared/logmacro_database.c' || echo '../../../../../tools/mttools/drvhlpr/'`../../../../../tools/rtlogger/shared/logmacro_database.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
  LP      /home/cornelus/source-master/WAVE300/driver/tools/rtlogger/shared/logmacro_database.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mv -f .deps/logmacro_database.Tpo .deps/logmacro_database.Po
/home/cornelus/source-master/WAVE300/driver/support/mtlkfront.sh /home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/bin/mips-openwrt-linux-gcc -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec   -L/home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/usr/lib/ -o drvhlpr arphelper.o drvhlpr.o irbponger.o asel.o ledsctrl.o wpsctrl.o app_info.o logmacro_database.o ./../shared/libmttools.a ../../../tools/shared/3rd_party/iniparser/libiniparser.a -Wl,--start-group ../../../wireless/shared/libmtlkwls.a ../../../tools/shared/linux/libmtlkc.a -Wl,--end-group -lpthread -lrt -lm -lnl 
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
/home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/mips-openwrt-linux-musl/bin/ld: cannot find -lnl
collect2: error: ld returned 1 exit status
make[4]: *** [drvhlpr] Error 1
make[4]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools/drvhlpr'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand'
make: *** [all] Error 2

(Last edited by cornelus2009 on 30 Aug 2017, 18:22)

cornelus2009 wrote:

hello, tryed o compile driver, and i stucked at this error

............................................
Generating app_info.c...
/home/cornelus/source-master/WAVE300/driver/support/mtlkfront.sh /home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/bin/mips-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I../../../../../tools/mttools/drvhlpr -I../../..  -DMTLK_SOURCE_VERSION="\"3.2.1.1.48.\"" -DLOG_LOCAL_OID=MTLKFRONT_WILL_FILL_IT -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/config.h -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/.config.h -I../../../../../tools/rtlogger/shared -I../../../../../wireless/shared_mbss_mac/ -I../../../../../tools/mtidl -I../../../../../tools/mttools/drvhlpr/../shared/ -I../../../../../tools/mttools/drvhlpr/../shared/linux/ -I../../../../../tools/shared/linux -I../../../../../tools/shared/3rd_party/iniparser -I../../../../../tools/shared -I../../../../../wireless/shared/linux -I../../../../../wireless/shared/linux -I../../../../../wireless/shared -I../../../../../wireless/driver/shared -I /home/cornelus/source-master/build_dir/target-mips_24kc_musl/libnl-tiny-0.1/include  -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec  -MT app_info.o -MD -MP -MF .deps/app_info.Tpo -c -o app_info.o app_info.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
  LP      /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools/drvhlpr/app_info.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mv -f .deps/app_info.Tpo .deps/app_info.Po
/home/cornelus/source-master/WAVE300/driver/support/mtlkfront.sh /home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/bin/mips-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I../../../../../tools/mttools/drvhlpr -I../../..  -DMTLK_SOURCE_VERSION="\"3.2.1.1.48.\"" -DLOG_LOCAL_OID=MTLKFRONT_WILL_FILL_IT -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/config.h -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/.config.h -I../../../../../tools/rtlogger/shared -I../../../../../wireless/shared_mbss_mac/ -I../../../../../tools/mtidl -I../../../../../tools/mttools/drvhlpr/../shared/ -I../../../../../tools/mttools/drvhlpr/../shared/linux/ -I../../../../../tools/shared/linux -I../../../../../tools/shared/3rd_party/iniparser -I../../../../../tools/shared -I../../../../../wireless/shared/linux -I../../../../../wireless/shared/linux -I../../../../../wireless/shared -I../../../../../wireless/driver/shared -I /home/cornelus/source-master/build_dir/target-mips_24kc_musl/libnl-tiny-0.1/include  -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec  -MT logmacro_database.o -MD -MP -MF .deps/logmacro_database.Tpo -c -o logmacro_database.o `test -f '../../../../../tools/rtlogger/shared/logmacro_database.c' || echo '../../../../../tools/mttools/drvhlpr/'`../../../../../tools/rtlogger/shared/logmacro_database.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
  LP      /home/cornelus/source-master/WAVE300/driver/tools/rtlogger/shared/logmacro_database.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mv -f .deps/logmacro_database.Tpo .deps/logmacro_database.Po
/home/cornelus/source-master/WAVE300/driver/support/mtlkfront.sh /home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/bin/mips-openwrt-linux-gcc -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec   -L/home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/usr/lib/ -o drvhlpr arphelper.o drvhlpr.o irbponger.o asel.o ledsctrl.o wpsctrl.o app_info.o logmacro_database.o ./../shared/libmttools.a ../../../tools/shared/3rd_party/iniparser/libiniparser.a -Wl,--start-group ../../../wireless/shared/libmtlkwls.a ../../../tools/shared/linux/libmtlkc.a -Wl,--end-group -lpthread -lrt -lm -lnl 
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
/home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/mips-openwrt-linux-musl/bin/ld: cannot find -lnl
collect2: error: ld returned 1 exit status
make[4]: *** [drvhlpr] Error 1
make[4]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools/drvhlpr'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand'
make: *** [all] Error 2

Did you:

    Prepare libnl-tiny package with LEDE or Openwrt SDK:
        ./scripts/feeds update -a
        ./scripts/feeds install libnl-tiny
        make package/libnl-tiny/{clean,compile,install} V=99

??


and do you have a line like this one in ugw.env.common?

CPPFLAGS="-I ${TARGET_DIR}/usr/include/libnl-tiny $CPPFLAGS"    # libnl-tiny installs under /usr/


Good luck!

added that line

#WARNING: values of DEFAULT_TOOLCHAIN_PATH, DEFAULT_KERNEL_DIR and DEFAULT_KERNEL_CROSS_COMPILE 
#         variables are assigned in this file but should never be used directly.
#         $(get_toolchain_path), $(get_kernel_dir) and $(get_kernel_cross_compile) to be used instead

#####################################################
#CUSTOM THIS FILE TO THE PATHS OF YOUR LOCAL MACHINE#
#####################################################

#Toolchain path for applications build
STAGING_DIR=/home/cornelus/source-master/staging_dir
#DEFAULT_TOOLCHAIN_PATH="${STAGING_DIR}/toolchain-mips_24kc_gcc-5.4.0_musl-1.1.15"
DEFAULT_TOOLCHAIN_PATH="${STAGING_DIR}/toolchain-mips_24kc_gcc-5.4.0_musl"

_BASE_TOOLCHAIN_PATH=$DEFAULT_TOOLCHAIN_PATH    #The upper directory of the host compiler
_BASE_TARGET_PATH=$DEFAULT_TOOLCHAIN_PATH

#Kernel directory location
DEFAULT_KERNEL_DIR=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83


#Compiler/precompiler flags applications build
CC="${_BASE_TOOLCHAIN_PATH}/bin/mips-openwrt-linux-gcc"
CXX="${_BASE_TOOLCHAIN_PATH}/bin/mips-openwrt-linux-c++"
CFLAGS="-O2 -fno-common -fno-builtin -mtune=24kec $CFLAGS"
CFLAGS="-isystem=${DEFAULT_KERNEL_DIR}/include -D_GNU_SOURCE $CFLAGS"
LDFLAGS="-L${DEFAULT_TOOLCHAIN_PATH}/usr/lib/"
CXXFLAGS="$CFLAGS $CXXFLAGS"


#Include files & directories
#CPPFLAGS="-I /home/cornelus/source-master/build_dir/target-mips_24kc_musl/libnl-tiny-0.1/include $CPPFLAGS"    #Add path for libnl-tiny

CPPFLAGS="-I ${TARGET_DIR}/usr/include/libnl-tiny $CPPFLAGS"    # libnl-tiny installs under /usr/

#Linker flags for C++ applications linkage
cxx_ldadd=-lgcc_s

#Additional kernel flags for this platform
#kernel_cflags=-mlong-calls

#Target kernel architecture
kernel_arch=mips

#Prefix for kernel compiler/binutils
DEFAULT_KERNEL_CROSS_COMPILE=${_BASE_TOOLCHAIN_PATH}/bin/mips-openwrt-linux-
#Kernel directory location
#DEFAULT_KERNEL_DIR=$BSP_KERNEL_PATH
#Prefix for kernel compiler/binutils
#DEFAULT_KERNEL_CROSS_COMPILE=$CROSS

same error

......................
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
  LP      /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools/drvhlpr/app_info.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mv -f .deps/app_info.Tpo .deps/app_info.Po
/home/cornelus/source-master/WAVE300/driver/support/mtlkfront.sh /home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/bin/mips-openwrt-linux-gcc -DHAVE_CONFIG_H -I. -I../../../../../tools/mttools/drvhlpr -I../../..  -DMTLK_SOURCE_VERSION="\"3.2.1.1.48.\"" -DLOG_LOCAL_OID=MTLKFRONT_WILL_FILL_IT -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/config.h -include /home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/.config.h -I../../../../../tools/rtlogger/shared -I../../../../../wireless/shared_mbss_mac/ -I../../../../../tools/mtidl -I../../../../../tools/mttools/drvhlpr/../shared/ -I../../../../../tools/mttools/drvhlpr/../shared/linux/ -I../../../../../tools/shared/linux -I../../../../../tools/shared/3rd_party/iniparser -I../../../../../tools/shared -I../../../../../wireless/shared/linux -I../../../../../wireless/shared/linux -I../../../../../wireless/shared -I../../../../../wireless/driver/shared -I /home/cornelus/source-master/build_dir/target-mips_24kc_musl/libnl-tiny-0.1/include  -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec  -MT logmacro_database.o -MD -MP -MF .deps/logmacro_database.Tpo -c -o logmacro_database.o `test -f '../../../../../tools/rtlogger/shared/logmacro_database.c' || echo '../../../../../tools/mttools/drvhlpr/'`../../../../../tools/rtlogger/shared/logmacro_database.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
  LP      /home/cornelus/source-master/WAVE300/driver/tools/rtlogger/shared/logmacro_database.c
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mv -f .deps/logmacro_database.Tpo .deps/logmacro_database.Po
/home/cornelus/source-master/WAVE300/driver/support/mtlkfront.sh /home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/bin/mips-openwrt-linux-gcc -Wall -Wno-multichar -fno-strict-aliasing -Werror -isystem=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83/include -D_GNU_SOURCE -O2 -fno-common -fno-builtin -mtune=24kec   -L/home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/usr/lib/ -o drvhlpr arphelper.o drvhlpr.o irbponger.o asel.o ledsctrl.o wpsctrl.o app_info.o logmacro_database.o ./../shared/libmttools.a ../../../tools/shared/3rd_party/iniparser/libiniparser.a -Wl,--start-group ../../../wireless/shared/libmtlkwls.a ../../../tools/shared/linux/libmtlkc.a -Wl,--end-group -lpthread -lrt -lm -lnl 
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mips-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
/home/cornelus/source-master/staging_dir/toolchain-mips_24kc_gcc-5.4.0_musl/mips-openwrt-linux-musl/bin/ld: cannot find -lnl
collect2: error: ld returned 1 exit status
make[4]: *** [drvhlpr] Error 1
make[4]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools/drvhlpr'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools/mttools'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand/tools'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/cornelus/source-master/WAVE300/driver/builds/ugw5.1-vrx288-nand'
make: *** [all] Error 2

Just to make clear, you have exported the `STAGING_DIR` variable, that points to staging dir of LEDE/OpenWRT toolchain?

It should look like this:

STAGING_DIR=/home/username/openwrt/staging_dir
export STAGING_DIR

same error


#WARNING: values of DEFAULT_TOOLCHAIN_PATH, DEFAULT_KERNEL_DIR and DEFAULT_KERNEL_CROSS_COMPILE 
#         variables are assigned in this file but should never be used directly.
#         $(get_toolchain_path), $(get_kernel_dir) and $(get_kernel_cross_compile) to be used instead

#####################################################
#CUSTOM THIS FILE TO THE PATHS OF YOUR LOCAL MACHINE#
#####################################################

#Toolchain path for applications build
STAGING_DIR=/home/cornelus/source-master/staging_dir
export STAGING_DIR
#DEFAULT_TOOLCHAIN_PATH="${STAGING_DIR}/toolchain-mips_24kc_gcc-5.4.0_musl-1.1.15"
DEFAULT_TOOLCHAIN_PATH="${STAGING_DIR}/toolchain-mips_24kc_gcc-5.4.0_musl"

_BASE_TOOLCHAIN_PATH=$DEFAULT_TOOLCHAIN_PATH    #The upper directory of the host compiler
_BASE_TARGET_PATH=$DEFAULT_TOOLCHAIN_PATH

#Kernel directory location
DEFAULT_KERNEL_DIR=/home/cornelus/source-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.4.83




#Compiler/precompiler flags applications build
CC="${_BASE_TOOLCHAIN_PATH}/bin/mips-openwrt-linux-gcc"
CXX="${_BASE_TOOLCHAIN_PATH}/bin/mips-openwrt-linux-c++"
CFLAGS="-O2 -fno-common -fno-builtin -mtune=24kec $CFLAGS"
CFLAGS="-isystem=${DEFAULT_KERNEL_DIR}/include -D_GNU_SOURCE $CFLAGS"
LDFLAGS="-L${STAGING_DIR}/target-mips_24kc_musl/usr/lib/"
LDFLAGS="-L${DEFAULT_TOOLCHAIN_PATH}/usr/lib/"
CXXFLAGS="$CFLAGS $CXXFLAGS"


#Include files & directories
CPPFLAGS="-I /home/cornelus/source-master/build_dir/target-mips_24kc_musl/libnl-tiny-0.1/include $CPPFLAGS"    #Add path for libnl-tiny

#Linker flags for C++ applications linkage
cxx_ldadd=-lgcc_s

#Additional kernel flags for this platform
#kernel_cflags=-mlong-calls

#Target kernel architecture
kernel_arch=mips

#Prefix for kernel compiler/binutils
DEFAULT_KERNEL_CROSS_COMPILE=${_BASE_TOOLCHAIN_PATH}/bin/mips-openwrt-linux-
#Kernel directory location
#DEFAULT_KERNEL_DIR=$BSP_KERNEL_PATH
#Prefix for kernel compiler/binutils
#DEFAULT_KERNEL_CROSS_COMPILE=$CROSS

When you compile OpenWRT toolchain, do you have libnl included?