NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Compiling Archer T2U USB WiFi adapter on target

I'm trying to compile the linux driver for the TP-Link AC600 Archer T2U on a cRIO-9068 target. I've installed gcc, make, etc. on the target as described in the FAQ (How to install GCC).

 

Now, I'm getting the following error when I try to "make" the driver (also attached).

 

admin@NI-cRIO-9068-F35E83:~/Archer_T2U_V1_150901/Driver# make
make -C UTIL/ osutil
make[1]: Entering directory '/home/admin/Archer_T2U_V1_150901/Driver/UTIL'
cp -f os/linux/Makefile.6.util /home/admin/Archer_T2U_V1_150901/Driver/UTIL/os/linux/Makefile
make -C /lib/modules/4.1.15-rt17-ni-4.0.0f1/build SUBDIRS=/home/admin/Archer_T2U_V1_150901/Driver/UTIL/os/linux modules
make[2]: Entering directory '/home/admin/Archer_T2U_V1_150901/Driver/UTIL'
make[2]: *** /lib/modules/4.1.15-rt17-ni-4.0.0f1/build: No such file or directory.  Stop.
make[2]: Leaving directory '/home/admin/Archer_T2U_V1_150901/Driver/UTIL'
Makefile:527: recipe for target 'osutil' failed
make[1]: *** [osutil] Error 2
make[1]: Leaving directory '/home/admin/Archer_T2U_V1_150901/Driver/UTIL'
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2
admin@NI-cRIO-9068-F35E83:~/Archer_T2U_V1_150901/Driver# 

Any guidance on next steps? Do I need to tweak some settings in the makefile?

0 Kudos
Message 1 of 11
(6,623 Views)

An update.  I tried creating the missing directory, per the suggestion of another thread:

 

Error message

make[2]: *** /lib/modules/4.1.15-rt17-ni-4.0.0f1/build: No such file or directory.  Stop.

 

Command to fix it:

 

ln -s /var/volatile/tmp/headers/kernel /lib/modules/$(uname -r)/build

 

So, now when I try to make the driver I get a whole different set of errors:

 

admin@NI-cRIO-9068-F35E83:~/Archer_T2U_V1_150901/Driver# make
make -C UTIL/ osutil
make[1]: Entering directory '/home/admin/Archer_T2U_V1_150901/Driver/UTIL'
cp -f os/linux/Makefile.6.util /home/admin/Archer_T2U_V1_150901/Driver/UTIL/os/linux/Makefile
make -C /lib/modules/4.1.15-rt17-ni-4.0.0f1/build SUBDIRS=/home/admin/Archer_T2U_V1_150901/Driver/UTIL/os/linux modules
make[2]: Entering directory '/var/volatile/tmp/headers/kernel'
  Building modules, stage 2.
  MODPOST 1 modules
make[2]: Leaving directory '/var/volatile/tmp/headers/kernel'
make[1]: Leaving directory '/home/admin/Archer_T2U_V1_150901/Driver/UTIL'
/bin/sh cp_util.sh

make -C MODULE/ build_tools
make[1]: Entering directory '/home/admin/Archer_T2U_V1_150901/Driver/MODULE'
make -C tools
make[2]: Entering directory '/home/admin/Archer_T2U_V1_150901/Driver/MODULE/tools'
gcc -g bin2h.c -o bin2h
make[2]: Leaving directory '/home/admin/Archer_T2U_V1_150901/Driver/MODULE/tools'
/home/admin/Archer_T2U_V1_150901/Driver/MODULE/tools/bin2h
chipset = mt7650u
chipset = mt7630u
chipset = mt7610u
make[1]: Leaving directory '/home/admin/Archer_T2U_V1_150901/Driver/MODULE'
make -C MODULE/ osdrv
make[1]: Entering directory '/home/admin/Archer_T2U_V1_150901/Driver/MODULE'
cp -f os/linux/Makefile.6 /home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/Makefile
make -C /lib/modules/4.1.15-rt17-ni-4.0.0f1/build SUBDIRS=/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux modules
make[2]: Entering directory '/var/volatile/tmp/headers/kernel'
  CC [M]  /home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/../../sta/sta_cfg.o
/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/../../sta/sta_cfg.c: In function 'RTMPIoctlShow':
/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/../../sta/sta_cfg.c:7053:85: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
             snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ );
                                                                                     ^
/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/../../sta/sta_cfg.c:7053:95: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
             snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ );
                                                                                               ^
/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/../../sta/sta_cfg.c: In function 'RtmpIoctl_rt_private_get_statistics':
/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/../../sta/sta_cfg.c:9737:17: warning: unused variable 'fec_coding' [-Wunused-variable]
    static char *fec_coding[2] = {"bcc", "ldpc"};
                 ^
cc1: some warnings being treated as errors
scripts/Makefile.build:258: recipe for target '/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/../../sta/sta_cfg.o' failed
make[3]: *** [/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux/../../sta/sta_cfg.o] Error 1
Makefile:1384: recipe for target '_module_/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux' failed
make[2]: *** [_module_/home/admin/Archer_T2U_V1_150901/Driver/MODULE/os/linux] Error 2
make[2]: Leaving directory '/var/volatile/tmp/headers/kernel'
Makefile:548: recipe for target 'osdrv' failed
make[1]: *** [osdrv] Error 2
make[1]: Leaving directory '/home/admin/Archer_T2U_V1_150901/Driver/MODULE'
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2
admin@NI-cRIO-9068-F35E83:~/Archer_T2U_V1_150901/Driver# 
0 Kudos
Message 2 of 11
(6,610 Views)

The kernel build system is trying to prevent (and it is reasonable to do so) non-deterministic builds, you can either disable that (which, sadly, will mean repackaging the header squashfs, which is a bit involved) or, more easily, just modify the problematic source to not use those macros and instead just plug in constant values.

0 Kudos
Message 3 of 11
(6,606 Views)

Thanks for the help!


@BradM wrote:

...more easily, just modify the problematic source to not use those macros and instead just plug in constant values.


Would you be able to provide me with some guidance on how to do that? I'm not a c programmer. would you be able to suggest some reasonable values of __DATE__ and __TIME___ for this code? I'm a little in over my head.

 

snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ );
0 Kudos
Message 4 of 11
(6,602 Views)

OK, made it a little further...

I substituted __DATE__ and __TIME__ for suitable strings (a little googling helped with that).


Now, when I try to make, I get errors right toward the end:

 

make -C NETIF/ osnet
make[1]: Entering directory '/home/admin/Archer_T2U_V1_150901/Driver/NETIF'
cp -f os/linux/Makefile.6.netif /home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/Makefile
make -C /lib/modules/4.1.15-rt17-ni-4.0.0f1/build SUBDIRS=/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux modules
make[2]: Entering directory '/var/volatile/tmp/headers/kernel'
  CC [M]  /home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.o
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2517:2: error: unknown field 'private' specified in initializer
  .private = (iw_handler *) rt_priv_handlers,
  ^
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2517:2: warning: initialization from incompatible pointer type
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2517:2: warning: (near initialization for 'rt28xx_iw_handler_def.get_wireless_stats')
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2518:2: error: unknown field 'num_private' specified in initializer
  .num_private  = N(rt_priv_handlers),
  ^
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2518:2: warning: excess elements in struct initializer
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2518:2: warning: (near initialization for 'rt28xx_iw_handler_def')
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2519:2: error: unknown field 'private_args' specified in initializer
  .private_args = (struct iw_priv_args *) privtab,
  ^
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2519:26: warning: excess elements in struct initializer
  .private_args = (struct iw_priv_args *) privtab,
                          ^
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2519:26: warning: (near initialization for 'rt28xx_iw_handler_def')
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2520:2: error: unknown field 'num_private_args' specified in initializer
  .num_private_args = N(privtab),
  ^
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2520:2: warning: excess elements in struct initializer
/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.c:2520:2: warning: (near initialization for 'rt28xx_iw_handler_def')
scripts/Makefile.build:258: recipe for target '/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.o' failed
make[3]: *** [/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux/../../os/linux/sta_ioctl.o] Error 1
Makefile:1384: recipe for target '_module_/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux' failed
make[2]: *** [_module_/home/admin/Archer_T2U_V1_150901/Driver/NETIF/os/linux] Error 2
make[2]: Leaving directory '/var/volatile/tmp/headers/kernel'
Makefile:538: recipe for target 'osnet' failed
make[1]: *** [osnet] Error 2
make[1]: Leaving directory '/home/admin/Archer_T2U_V1_150901/Driver/NETIF'
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2
admin@NI-cRIO-9068-F35E83:~/Archer_T2U_V1_150901/Driver# 

I little googling and I found a link that said something like needing to set CONFIG_WEXT_PRIV=y in the .config file of the kernel. Not totally sure how to do this or if that's even the right place to start. Any advice? We're getting very close 🙂

0 Kudos
Message 5 of 11
(6,589 Views)

I recorded a couple of videos walking through the process of enabling different configuration options in the kernel here.

 

Now, WEXT_PRIV is an interesting one. You're not going to be able to enable it directly, you'll need to enable another wifi card that requires it. One such device is the RTL8172U wifi USB chipset

`->Device Drivers

     `->Staging Drivers

           `-> RealTek RTL8792U (RTL8192SU) Wireless LAN NIC driver

Once selected, double-check that WEXT_PRIV is enabled (type "/" when in the kernel configuration UI, search for "WEXT_PRIV", make sure that it's set to "y").

0 Kudos
Message 6 of 11
(6,573 Views)

And, as a bit of wrapup, do a bit of checking first for Linux support before purchasing hardware to see what you're getting into. If possible, find something that already has support in the kernel itself and doesn't depend on building a module outside of the kernel source.

0 Kudos
Message 7 of 11
(6,572 Views)

My Staging Drivers page is empty. Nothing is in the list

 

2017-08-17_10-44-35.png

0 Kudos
Message 8 of 11
(6,529 Views)

You need to enable Staging Drivers first

Get to Device Drivers » Staging drivers

enable-staging.jpg

Press [y] to enable the setting

enable-staging2.jpg

(note that there's a small asterisk in the square brackets now)

Press enter to see the available staging drivers

enable-staging3.jpg

0 Kudos
Message 9 of 11
(6,525 Views)

Thanks for this info. That was very helpful.

 

I ran into a few problems compiling the kernel because the ncurses, ncurses-dev, bc, and perhaps a few other packages needed to be installed.

 

Compile in progress and seems to be chugging along nicely...

0 Kudos
Message 10 of 11
(6,521 Views)