Thomas (boggyb) wrote,
Thomas
boggyb

  • Mood:
  • Music:

The adventure continues!

Well, the network bridging went horribly wrong - Windows decided to use a common MAC address for all packets forwarded via the bridge, and the Netgear router in turn decided to hand out the same IP address both to Nyx and to the Raspberry Pi.

Neither was particularly impressed by this. Windows at least showed a warning message, but the Pi appeared to just sulk in the corner and not boot.

Anyway, I've changed to Windows' Internet Connection Sharing and that works much better - I can now SSH into the Pi (though I did have to change the Pi's DNS server - it seems that Windows isn't running a resolver). And trawling through the logs shows that it does at least detect the WiFi adapter:
[    2.603361] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[    2.734558] usb 1-1.3: New USB device found, idVendor=2357, idProduct=011e, bcdDevice= 2.00
[    2.734583] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.734596] usb 1-1.3: Product: 802.11ac WLAN Adapter
[    2.734610] usb 1-1.3: Manufacturer: Realtek
[    2.734622] usb 1-1.3: SerialNumber: 00e04c000001

DeviWiki suggests the TP-Link Archer T2U Nano uses a Realtek RTL8811AU chipset. I did do some research before buying it and it looks like while there's no mainline kernel support, there are a collection of vendor and independent drivers out there. OSMC also includes some WiFi support though I couldn't find an actual list of supported devices for it (and what I did pointed to support being removed in recent versions!).

So, time to find a possible driver and give it a try. And compile it, because this is Linux where everyone's expected to have a complete C toolchain installed and know how to use it (and ABI compatibility doesn't exist). And probably patch it, because this is Linux where API compatibility doesn't exist either.

There's several rtl8812au repos floating around GitHub - https://github.com/aircrack-ng/rtl8812au seems to be the most up-to-date one so let's start with that. There's only one release from December 2018 and no tags, so I guess I just pick a random commit and build it? The readme does say "v5.3.4 is the stable branch" so I'll use that, which is currently commit 737dce3cdde8e8c6daab58bcffe4b87a20473eb0.
osmc@osmc:~/src$ git clone https://github.com/aircrack-ng/rtl8812au
-bash: git: command not found
osmc@osmc:~/src$ 

Really?
osmc@osmc:~/src$ sudo apt install git
osmc@osmc:~/src$ git clone https://github.com/aircrack-ng/rtl8812au
osmc@osmc:~/src$ cd rtl8812au/
osmc@osmc:~/src/rtl8812au$ git checkout v5.3.4

Now to try and install it.
osmc@osmc:~/src/rtl8812au$ sudo apt-get install dkms
osmc@osmc:~/src/rtl8812au$ sudo ./dkms-install.sh
About to run dkms install steps...

Creating symlink /var/lib/dkms/rtl8812au/5.3.4/source ->
                 /usr/src/rtl8812au-5.3.4

DKMS: add completed.
Error! echo
Your kernel headers for kernel 4.19.55-6-osmc cannot be found at
/lib/modules/4.19.55-6-osmc/build or /lib/modules/4.19.55-6-osmc/source.
Error! echo
Your kernel headers for kernel 4.19.55-6-osmc cannot be found at
/lib/modules/4.19.55-6-osmc/build or /lib/modules/4.19.55-6-osmc/source.
Finished running dkms install steps.
osmc@osmc:~/src/rtl8812au$

Fail! The dkms package did at least pull the toolchain in, so there's that. Anyway I've a vague recollection that there's a package for the kernel headers...
osmc@osmc:~/src/rtl8812au$ sudo apt search 4.19.55.6
rbp1-headers-4.19.55-6-osmc - Header files related to Linux kernel, specifically,
rbp1-image-4.19.55-6-osmc - Linux kernel binary image for version 4.19.55-6-osmc
rbp1-source-4.19.55-6-osmc - Linux kernel source for version 4.19.55-6-osmc
rbp2-headers-4.19.55-6-osmc - Header files related to Linux kernel, specifically,
rbp2-image-4.19.55-6-osmc - Linux kernel binary image for version 4.19.55-6-osmc
rbp2-source-4.19.55-6-osmc - Linux kernel source for version 4.19.55-6-osmc
osmc@osmc:~/src/rtl8812au$ 

This looks promising. I've got a Pi 2, so I guess rbp2-headers-4.19.55-6-osmc?
osmc@osmc:~/src/rtl8812au$ sudo apt install rbp2-headers-4.19.55-6-osmc
...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 4.19.55-6-osmc /boot/vmlinuz-4.19.55-6-osmc
Error! echo
Your kernel headers for kernel 4.19.55-6-osmc cannot be found at
/lib/modules/4.19.55-6-osmc/build or /lib/modules/4.19.55-6-osmc/source.
osmc@osmc:~/src/rtl8812au$ sudo ./dkms-install.sh
About to run dkms install steps...
Error! DKMS tree already contains: rtl8812au-5.3.4
You cannot add the same module/version combo more than once.
Error! echo
Your kernel headers for kernel 4.19.55-6-osmc cannot be found at
/lib/modules/4.19.55-6-osmc/build or /lib/modules/4.19.55-6-osmc/source.
Error! echo
Your kernel headers for kernel 4.19.55-6-osmc cannot be found at
/lib/modules/4.19.55-6-osmc/build or /lib/modules/4.19.55-6-osmc/source.
Finished running dkms install steps.
osmc@osmc:~/src/rtl8812au$

That doesn't look successful. Does it need the sources? And do I need to uninstall some half-installed driver?
osmc@osmc:~/src/rtl8812au$ sudo apt install rbp2-source-4.19.55-6-osmc
osmc@osmc:~/src/rtl8812au$ sudo ./dkms-remove.sh
About to run dkms removal steps...

------------------------------
Deleting module version: 5.3.4
completely from the DKMS tree.
------------------------------
Done.
Finished running dkms removal steps.
osmc@osmc:~/src/rtl8812au$ sudo ./dkms-install.sh
About to run dkms install steps...

Creating symlink /var/lib/dkms/rtl8812au/5.3.4/source ->
                 /usr/src/rtl8812au-5.3.4

DKMS: add completed.
Error! echo
Your kernel headers for kernel 4.19.55-6-osmc cannot be found at
/lib/modules/4.19.55-6-osmc/build or /lib/modules/4.19.55-6-osmc/source.
Error! echo
Your kernel headers for kernel 4.19.55-6-osmc cannot be found at
/lib/modules/4.19.55-6-osmc/build or /lib/modules/4.19.55-6-osmc/source.
Finished running dkms install steps.
osmc@osmc:~/src/rtl8812au$

Really? I installed 133MB of something with the rbp2-source-4.19.55-6-osmc package!

Searching found both suggestions to manually symlink the headers to where DKMS expects them, and suggestions to not use DKMS with OSMC. Fine, let's do things the old-fashioned way.
osmc@osmc:~/src/rtl8812au$ sudo ./dkms-remove.sh
About to run dkms removal steps...

------------------------------
Deleting module version: 5.3.4
completely from the DKMS tree.
------------------------------
Done.
Finished running dkms removal steps.
osmc@osmc:~/src/rtl8812au$ sudo apt install build-essential bc libelf-dev
osmc@osmc:~/src/rtl8812au$ sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile
osmc@osmc:~/src/rtl8812au$ sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile
osmc@osmc:~/src/rtl8812au$ make
make ARCH=arm CROSS_COMPILE= -C /lib/modules/4.19.55-6-osmc/build M=/home/osmc/src/rtl8812au O="" modules
make[1]: *** /lib/modules/4.19.55-6-osmc/build: No such file or directory.  Stop.
Makefile:1707: recipe for target 'modules' failed
make: *** [modules] Error 2
osmc@osmc:~/src/rtl8812au$ ls /lib/modules/4.19.55-6-osmc/build
ls: cannot access '/lib/modules/4.19.55-6-osmc/build': No such file or directory
osmc@osmc:~/src/rtl8812au$ 

It really wants the headers to be in /lib/modules.
osmc@osmc:~/src/rtl8812au$ sudo ln -s /usr/src/rbp2-headers-4.19.55-6-osmc/ /lib/modules/4.19.55-6-osmc/build
osmc@osmc:~/src/rtl8812au$ make
...
In file included from ./include/linux/compat.h:16:0,
                 from ./include/linux/ethtool.h:17,
                 from ./include/linux/netdevice.h:41,
                 from /home/osmc/src/rtl8812au/include/osdep_service_linux.h:30,
                 from /home/osmc/src/rtl8812au/include/osdep_service.h:54,
                 from /home/osmc/src/rtl8812au/include/drv_types.h:27,
                 from /home/osmc/src/rtl8812au/core/rtw_cmd.c:17:
./include/linux/if.h: At top level:
./include/linux/if.h:28:54: fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>   /* for struct sockaddr.  */
                                                      ^
compilation terminated.
scripts/Makefile.build:303: recipe for target '/home/osmc/src/rtl8812au/core/rtw_cmd.o' failed
make[2]: *** [/home/osmc/src/rtl8812au/core/rtw_cmd.o] Error 1
Makefile:1517: recipe for target '_module_/home/osmc/src/rtl8812au' failed
make[1]: *** [_module_/home/osmc/src/rtl8812au] Error 2
make[1]: Leaving directory '/usr/src/rbp2-headers-4.19.55-6-osmc'
Makefile:1707: recipe for target 'modules' failed
make: *** [modules] Error 2
osmc@osmc:~/src/rtl8812au$

What?

This thread sheds some light on what's up (mangled Linux kernel headers) and cross-references a possible answer, but that's an experiment for another time...
Tags: computers, raspberry pi
Subscribe

  • Misty creek and eerie fog

    So today started grey, and as the afternoon went on Fareham creek became very misty... The skies cleared for a brief moment as the sun…

  • Pokémon Go

    I've been playing a lot of Pokémon Go while out on walks, and experimenting with the AR photo mode... Cross-posted to deviantArt Cross-posted…

  • Random photo

    Just a random photo taken in the local sensory garden, while out and about today... There was just something that caught my eye about the…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments