Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] RTL8812AU Support #11

Open
SirFell opened this issue Dec 15, 2018 · 38 comments
Open

[Request] RTL8812AU Support #11

SirFell opened this issue Dec 15, 2018 · 38 comments
Labels
Firmware Request Request for new chipset firmware to be added

Comments

@SirFell
Copy link

SirFell commented Dec 15, 2018

Would be great if you could add support for rtl8812au wlan controller. Thanks.

@rithvikvibhu
Copy link
Owner

I can't find drivers for this anywhere. If you do, let me know with the link and I'll add it.

@SirFell
Copy link
Author

SirFell commented Dec 15, 2018

https://github.com/aircrack-ng/rtl8812au this, but it lacks kernel headers like any other driver out there I could find. There were people on NetHunter repo issues that appear to have done it on Nexus 6P (device I also own) but they havent shared how exactly did they do it.

@SirFell
Copy link
Author

SirFell commented Dec 15, 2018

offensive-security/kali-nethunter#1122
offensive-security/kali-nethunter#1128

Biggest problem is that I have no idea can you even get 1.1 kernel sources at this point.
I personally run 7.1.2 w/ PureNexus & NetHunter 3.10.73-1.1

@rithvikvibhu
Copy link
Owner

Firmware for other chipsets are distributed as binaries so it's easy to just plug it in. This one uses dkms which builds (?) the module for a specific kernel. I have no experience with this or with building for other kernels.

Btw, why are you looking for 1.1 kernel sources?

@SirFell
Copy link
Author

SirFell commented Dec 15, 2018

well i have no real experience on the topic but long story short, dkms installed driver just doesnt work, neither kali installs dkms version of driver it has on its apt repo

so far what i could have guessed is that dkms is missing something that would allow it to build for kernel installed which possibly can be worked around by either making kernel based on sources that would have what dkms is missing or making headers from sources to then use in drivers based on already made drivers.

@rithvikvibhu
Copy link
Owner

It does sound simple (like it ever is) - https://unix.stackexchange.com/a/258532, but I've never done this before. Also couldn't find anything related to using dkms for android kernels.

@SirFell
Copy link
Author

SirFell commented Dec 15, 2018

And this is where we get to kernel headers:
image

./build and ./source folders just dont exist:
image

@rithvikvibhu
Copy link
Owner

Leaving this open in case someone stumbles upon this issue and finds a solution.

@SirFell
Copy link
Author

SirFell commented Feb 9, 2019

i will see if i am able to build headers myself when i get more free time, if so i will post here

@alammer
Copy link

alammer commented Feb 25, 2019

I haven't dealt with this topic since last summer, so some links might become outdated. But this is how my TODO looked for working 6P with Asus USB-N56 and a pair of other adapters on 8812.

At the first stage, I could not find any kernel sources kernel 3.10.73-nethunter-angler-1.1 for NH version 7.1.1 that worked stably with external devices and had to use the available sources kernel 3.10.73-nethunter-angler-2.0 for version 7.1.2.

  1. Clone src or download/extract zip (kernel 3.10.73-nethunter-angler-2.0)

In this folder:

  1. Check toolchain in build.sh and download/install it if ness to external folder

  2. Run "make ARCH=arm64 mrproper"

  3. Run "./build.sh nethunter angler"

  4. Run "ARCH=arm64 make defconfig KBUILD_DEFCONFIG=nethunter_angler_defconfig" (in /KSRC/arch/arm64/configs)

  5. For additional initialisation run:

    "make ARCH=arm64 CROSS_COMPILE=/path_to_/toolchain/gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- modules_prepare"

  6. For create kernel headers/sources needed for build driver run:

    "make ARCH=arm64 CROSS_COMPILE=/path_to_/toolchain/gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- headers_install"

At this stage, you have the own kernel image and necessary kernel headers for build the 8812 driver.

  1. clone or download driver src (rtl8812au-5.1.5 from https://github.com/aircrack-ng/rtl8812au)

In this folder:

  1. modifying Makefile for building:

    CONFIG_PLATFORM_ARM64 = y

    CONFIG_RTL8812A = y

    ifeq ($(CONFIG_PLATFORM_ARM64), y)

    EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

    EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT

    ARCH ?= arm64

    CROSS_COMPILE := /path_to_/toolchain/gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

    KVER ?= $(shell uname -r)

    KSRC := /path_to_your_kernel_src_dir/build (PATH TO YOUR KERNEL SOURCE FOLDER)

    MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/

    INSTALL_PREFIX :=

    endif

  2. make clean

  3. make

After make completion you must have 8812au.ko file in root or build/bin dir of driver_src.

The next problem was that default NH 7.1.2 with kernel 3.10.73-nethunter-angler-2.0 compared to 7.1.1 and 3.10.73-nethunter-angler-1.1 was extremely unstable on my 6P, it had several bugs that were inconvenient for me. Such as problems with the startup of scripts at the start of the android due to the settings of the se policy, the inaccessibility of vim outside the NH chroot, etc.
As a result, I was forced to modify the default NH build system (kali-nethunter) for kernel 3.10.73-nethunter-angler-2.0 with some files from build sysytem for kernel 3.10.73-nethunter-angler-1.1

In /kali-nethunter/nethunetr-installer (download from https://github.com/offensive-security/kali-nethunter/):

Replace this default files with files from https://build.nethunter.com/nightly/3.15.4-20170629-1630/kernel-nethunter-angler-nougat-3.15.4-20170629-1630.zip:

1)busybox, sepolicy-inject and sepolicy-inject-M (which replaced with sepolicy-inject-N) in /kali-nethunetr/nethunter-installer/boot-patcher/arch/arm64/tools

2)02-no-verity-opt-encrypt in /kali-nethunetr/nethunter-installer/boot-patcher/patch.d/

3)patch.d-env in /kali-nethunetr/nethunter-installer/boot-patcher/

Now we add our own kernel image and support files to NH build system (what guarantees us compatibility of our 8812 driver with NH):

1)Image.gz-dtb in /path_to_your_kernel_src_dir/build/arch/arm64/boot/

to

/kali-nethunetr/nethunter-installer/devices/nougat/angler/

2)Modules files from

/path_to_your_kernel_src_dir/build/lib/modules/3.10.73-nethunter-angler-2.0/

to

/kali-nethunetr/nethunter-installer/devices/nougat/angler/modules/3.10.73-nethunter-angler-2.0

GOTO /kali-nethunter/nethunter-installer/

RUN in shell python build.py -d angler -n -fs full -su -nb

At this stage, we will get a standard image of NH that will be compatible with our driver. After standard flashing it into the phone, you can manually or via the start-up scripts load the 8812au.ko module previously copied to the phone.

I did not have time to integrate the 8812au.ko into the kernel image. I also encountered a serious bug that I didn’t have time to fix - unplug the 8812 adapter from the phone AFTER loading the 8812au.ko into the system (by insmod for example ) or down its interface (by iw etc.) ALWAYS causes the phone to reboot.

I think the problem is in some kernel power settings. And as long as I remember, even a simple plug to usb rt2800 or ath9k adapters causes the same problem.

8812au build with monitor mode on default. So after connect adapter and load module in system you can immediately capture packets. Beware of using some aircrack-ng scripts that by default try to down the interface for later up it in monitoring mode, after load module 8812au in system this procedure will cause a reboot phone.

@rithvikvibhu
Copy link
Owner

I found and added files for RTL8812AU. When you're free, let me know if it works.

@SirFell
Copy link
Author

SirFell commented May 3, 2019

Sorry, been busy lately but found out that I need to downgrade my installation. Will probably do so this weekends and update you.

@kimocoder
Copy link

Aaah my drivers added.. great work!

@rithvikvibhu
Copy link
Owner

@kimocoder Did it work for you?

@kimocoder
Copy link

Haven't tested, busy with some work related stuff for some time

@SirFell
Copy link
Author

SirFell commented May 5, 2019

@rithvikvibhu i am about to reflash rom onto my phone so probably can get back to you in ~2 hours give or take

@SirFell
Copy link
Author

SirFell commented May 5, 2019

i guess im dumber than i thought and im having trouble pointing modprobe to module (am i even supposed to use modprobe?) since its not in /lib/modules/

@kimocoder
Copy link

modprobe in AndroidSU before running "bootkali" remember. We're working on the issue

@SirFell
Copy link
Author

SirFell commented May 5, 2019

yea modprobe on su throws me "no such file/directory" for 'modules.dep'

@kimocoder
Copy link

kimocoder commented May 5, 2019

Then you need to fix your kernel setup. Build with build.py from our NetHunter-Installer

@SirFell
Copy link
Author

SirFell commented May 5, 2019

both py -2 build.py -d angler --nougat --rootfs full --nightly and py -2 build.py -d angler --nougat return updater process error 255 when flashed with TWRP

@kimocoder
Copy link

I do it manually and run latest Oreo build and flashing only kernel the Magisk afterwards.

@kimocoder
Copy link

It's my Oreo kernel in there and has all modules

@SirFell
Copy link
Author

SirFell commented May 5, 2019

well i guess it wouldnt really be an option for now then as i would need to completely reflash to oreo from nougat and idea is to first test if this module works on nougat and only then update

Edit: i have tried to build (using build script) generic fs, oreo and nougat kernels, generic fs fails to flash through TWRP 3.3.0-0 on both stock nougat and oreo roms, would be nice if you could give more info on how to get it working.

@SirFell
Copy link
Author

SirFell commented May 6, 2019

So i tried building from linux (19.04 ubuntu x64 VM) and zip built just fine and does not throw 255 error on install attempt, not sure if it will work if built with cygwin or something on windows, @rithvikvibhu if i can get card to work on oreo i will reinstall nougat with zips built from sources and report if i can get card to work on nougat. As a sidenote: Kimo, do you know of any "swipe up to wake" like in pureNexus but on 8.1.0 as i prefer that over double tap as ive seen you also have fine device that is Angler?

Edit: welp it didnt show any errors and appeared to flash fine but device seems to be bootlooping now at about moment system shouldve started

@kimocoder
Copy link

We just pushed a new NetHunter release.
Read more here https://www.kali.org/news/kali-linux-2019-2-release/

We still have issues that needs to be resolved, so we started on the 2019.3 allready.
Will have mye drivers tested shortly. Remember, the rtl8812 stack is mashed under 1 module name (88XXau) but it supports 8811, 8812, 8814 and 8821 chipsets. And airmon-ng is supported now.

I'll be watching over here and may be at help 🙂

@kimocoder
Copy link

I run a Nexus 6P with Android 8.1 kernel with all modules i wan't.
My kernel is added to the build.py script, so Oreo is supported boys.

Went down to 8.0 to get Nexmon supported too yesterday, but Oreo kernel is available..

@kimocoder
Copy link

Screenshot_20190525-202009

@kimocoder
Copy link

Screenshot_20190525-202120

@kimocoder
Copy link

Screenshot_20190525-202143

@kimocoder
Copy link

@rithvikvibhu what you have to do, is rip out the firmware blob, if interested in learning howto make binaries of drivers, take a look at ulli-kroll's drivers/commits.

https://github.com/ulli-kroll

@rithvikvibhu
Copy link
Owner

Thanks, I'll go through at those repos soon. How portable are these firmware blobs? Between devices, arch, etc.

@Moonwalker86
Copy link

So did anyone ever come up with firmware for this to work with android? Would be great if so and greatly appreciated especially seeing as how I'm not knowledgeable enough to contribute but would love to if I could.

@kimocoder
Copy link

@Moonwalker86
Copy link

Moonwalker86 commented Sep 30, 2019 via email

@kimocoder
Copy link

kimocoder commented Dec 21, 2019

@SirFell

Take a look what I've done... Nexus 6P have it integrated in kernel 🥇

IMG_20191219_053442

IMG_20191219_223704

IMG_20191219_042356_960

@Moonwalker86
Copy link

Moonwalker86 commented Jan 6, 2020 via email

@unknown181818
Copy link

unknown181818 commented Jan 26, 2020

this patch will work with dreamlte s8 phone?
https://github.com/kimocoder/DJY_88XXAU_For_4.4__4.9_4.14_4.19_Android_Kernel_Patch
what kernel i should compile? only stock or custom like tgp s8?
I prefer to have tgp 4.4.180 kernel. When i compile it from kernel source applying that patch and add line do that driver its compile but on my phone when i connect wifi usb nothing happen no wlan1 in andrax and dont have /lib/modules folder

@rithvikvibhu rithvikvibhu added the Firmware Request Request for new chipset firmware to be added label Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Firmware Request Request for new chipset firmware to be added
Projects
None yet
Development

No branches or pull requests

6 participants