SimplyCEO / rtl8188eus

RealTek RTL8188eus WiFi driver with monitor mode & frame injection support.
https://gitlab.com/SimplyCEO/rtl8188eus
GNU General Public License v2.0
64 stars 17 forks source link

Build For Android Running in Android Emulator device running at x86_64 platform #13

Open pc-magas opened 3 months ago

pc-magas commented 3 months ago

I have launched an Android VM via android's emulator:

emulator -avd WiFIUSB -qemu -device qemu-xhci -device usb-host,vendorid=0x1903,productid=0x8328

Where the device is:

$ lsusb

Bus 001 Device 004: ID 2357:010c TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS]

Via obtaining a shell access upon the device

adb shell

I got:

$ uname -a
Linux localhost 6.1.23-android14-4-00257-g7e35917775b8-ab9964412 #1 SMP PREEMPT Mon Apr 17 20:50:58 UTC 2023 x86_64 Toybox

And I attempt to crossbuild in my host linux and load it at the Android Running upon emulator. But I am stuck on theese:

  1. Where I can find the headers so I can crossbuild for the android kernel?
  2. Could somwehow I get hint from Nethunter builds? If yes what toolchain should I use?
    export CROSS_COMPILE=../toolchain/toolchain64/bin/aarch64-linux-android-
pc-magas commented 3 months ago

So far I have installed NDK and tried:

 make CC=${NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android34-clang ARCH=x86_64 CROSS_COMPILE=x86_64-linux-android- KERNEL_SRC=$KERNEL_SRC

Upon master branch but I got:

clang: error: unknown argument: '-fconserve-stack'
clang: error: unsupported option '-mrecord-mcount' for target 'x86_64-unknown-linux-android'
make[2]: *** [scripts/Makefile.build:297: /home/pcmagas/dlink-decompile/rtl8188eus/core/rtw_cmd.o] Error 1
make[1]: *** [Makefile:1911: /home/pcmagas/dlink-decompile/rtl8188eus] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-112-generic'
make: *** [Makefile:2065: modules] Error 2

How I can fix this?

SimplyCEO commented 3 months ago

Sorry for the delay, GitHub is not giving me notifications.

I don't know about compiling it for Android, using Android's tools, but once I got a driver working on Nethunter by compiling with the given headers. I might have been a chrooted environment.

From my Nexus 5, using postmarketOS, I had a related problem where the kernel version showed 6.9.1 but the headers were 5.8. Of course I tried everything, but it didn't seemed to work. I had to rely on compiling the kernel all over again just to move the folder to /lib/modules/6.9.1 and rename it to build.

What I would recommend for you is doing the same. Trying to find the source of this Android you downloaded and compile again the 6.1.23-android14-4-00257-g7e35917775b8-ab9964412 kernel version.

For some reason, most Linux environment don't have the given headers to build other drivers which is SO annoying.