How to cross compile WiFi drivers for Android? - General Questions and Answers

Maybe this question got asked before but I couldn't compile my driver so I will ask.
I got a SM-A700H with Android 6.0.1 and root permissions. And I have a cheap network adapter and I wanna use it for creating AP by getting connection from my device 's WiFi adapter(Wlan0).
What I have:
1) Chroot environment in android
2) Modprobe and USB support(I guess)
3) Toolchain for Cross compiling
4) Kernel 3.10.49
5) A Mediatek MT7601U Wireless Adapter
I tried many things and here is list of what I did and errors I got:
The things that a professional needs to see - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pastebin.com
(This text was sent to somebody else but now u see it too)
Now can u help me to compile it for my device?(At least make it work in chroot env)
And contact with me in Discord if u can(Due live Q/A)
Thanks in advance

Related

How to create a driver

I need to create a driver. Like those /dev/smd0 and /dev/smd27.
My driver will be very similar to those smd drivers, it will just talk to different smd channel.
My question is: do I have to rebuild the whole source tree, and flash the image to the G1 phone? Or can I just make a driver binary module, and adb push to the phone, and install it (like insmod driver.o)?
Please understand I am a newbie to linux...
You should be able to build just the driver itself, and put it onto the G1 (assuming you have root access). You'll need to use a cross compiler to build the driver. You should be able to use the one included in the android source (in the prebuilt section).
Just out of curiosity, what kind of driver are you building? What's it for?
you could make dev entries with mknod... at least some ..

USB GPS On Tablet

Hi,
I’ve been working on trying to connect my USB GPS dongle (Chipset: Ublox 6) to my tablet through USB OTG Cable. Since my tablet isn’t popular (Can’t find on the forum’s list), I had to do it myself.
(My knowledge about Linux isn’t that good (I’m a high school student who is on summer vacation), please forgive me if I made a mistake )
1.Ublox said the driver for Linux is cdc-acm, so I downloaded from a website and tried to install the kernel module (cdc-acm.ko) through insmod, but a vermagic error came up, said that the module’s version is 3.0.8 and mine is 3.0.8+, I tried using insmod –f , still no good luck.
2.Then I tried to modify the module’s vermagic with a HexEditor, install it again, but I got a “Segmentation falut” error.
3.Then I tried to use “busybox modprobe cdc-acm”, but it says “cannot parse modules.dep”, so I tried to create the folder “/lib/modules/3.0.8+” manually (I know this could be silly), then “busybox depmod”, finally run “busybox modprobe cdc-acm” again, but still the same error.
4.Then I remember that when I plug in the device, dmesg said
“usb 1-1: new full speed USB device using….”
“usb 1-1: New USB device found, idVendor=1546, idProduct=01a6”
Then nothing happened.
5.At last, I found out that I have “usb_modeswitch.d” in /etc
And my device profile isn’t listed there, but how could I know my device’s profile?
I know the vendor, the product, but how about the “MessageContent”?
By the way, what’s the difference between “DefaultVendor” and “TargetVendor”, “DefaultProduct” and “TargetProduct”
I know the post may be too long,
But to sum up, Is it possibly going to work if I create my Device Profile and everything will work out?
I still doesn’t have “cdc-acm.ko” install yet. (Though I already put it in /system/lib/modules)
By the way, I don’t have the folder /dev/ttyusb0 /dev/usb/tty0
I only have /dev/bus/usb/001 with nothing in it.
Sorry again for my bad Linux knowledge.
Thanks A Lot!!!
Golden Chang

Kali Linux on Android Note 3 Guide

This may have been posted some where in the past but I have been searching for some time and found nothing but others looking for this information. So I though I would document what I did to get everything up and running on my note 3 and share it here.
Requirements
Rooted Note 3
Recommended
Bluetooth keyboard and mouse
From a PC
1. Download kali from the LOA website kalilinux.FULL.ext4.20131031 (5.8 GB Uncompressed) (2.0GB Download)
2. Once the download is complete extract the contents of the folder so you have a folder named “kali” then an .img and .md5 file in it then copy that to the Note 3 device storage root. I strongly recommend using USB 3.0.
On the Note 3
1. First Download Linux on Android It might be called Complete Linux Installer now
2. Then Download androidVNC and Terminal Emulator
3. Download the modified bootscript.sh from attchments and extract
4. Copy to /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh
5. Start Linux on Android
6. Swipe from the left of the screen to the right and open the menu
7. Select “Launch”
8. Using the drop down box select “Kali”
9. Press the “Settings” button on the top right
10. Select “Edit”
11. On the line that says “Image” click the “…” button
12. Select the img file you copied to the storage in the kali folder
13. Click the “Save Changes” button
14. Then you are ready to click the “Start Linux” button
15. There will be a question if you want to check the img with the MD5 I would go ahead and type “y” and do this step to verify your download was not messed up.
16. Then it will ask you to create a new password. Type it in. And again. Make it 6 char alpha numeric.
17. If all is good it will ask if you would like to start vnc and ssh servers. Select yes to both.
18. Next it will ask you if you would like to save as default settings. I would select yes.
19. After things finish loading and you have a prompt. We will have to configure ssh
20. Type “ssh-keygen –R localhost”
21. Then you will be able to connect to the linux shell via ssh
22. Type "ssh localhost"
23. It will ask you if you want to add localhost to the list of allowed hosts
24. Type "yes" then press enter
25. Type in your password
26. Once connected to the emulator you will need to setup the VNC password
27. Type "vncpasswd" then press enter
28. Type your password in. And again. I would use the same 6 char password from before
29. Then you are ready to connect to the desktop
30. Open androidVNC from them the main menu leaving the terminal running in the background
31. Create a new connection from the dropbox
32. Name it kalilinux
33. Fill in the password you created
34. Use localhost for the address and the default port
35. Select 24-bit color (4 bpp) for the color format
36. Click connect...
Great guide. My device isn't rooted (yet) but this makes me really start considering a root in near future. THIS^ is a the best reason why we need knox free devices.
Damn you Sammy with your Knox mumbo jumbo! I should start looking for an older FW/rootable SGN3....
This will not trigger the Knox bit it is running in an emulator on top of android. there are a couple of ways to root without tripping the Knox bit. And this does not need a custom rom or kernel.
Does it really work for you? I wasted almost a full day trying to get linux to run on my note 3 yesterday, I even began suspecting kitkat prohibits running linux...
On a side note, is there some smaller distro? 5+ gigs is an awful lot, I only need GCC and a few static libraries on my image...
good guide! Thanks!
Does it support packet injection out the box, or are you awaiting the modded driver as well?
Sent from my SAMSUNG-SM-N900A using XDA Premium 4 mobile app
melaniel said:
Does it support packet injection out the box, or are you awaiting the modded driver as well?
Sent from my SAMSUNG-SM-N900A using XDA Premium 4 mobile app
Click to expand...
Click to collapse
not by default i could not start monitor mode on the adapter but you can use an external wifi adapter as long as you provide external power via usb splitter
this guide should work with other distors just download one to your likeing from the linux on android site
bruce303lee said:
not by default i could not start monitor mode on the adapter but you can use an external wifi adapter as long as you provide external power via usb splitter
this guide should work with other distors just download one to your likeing from the linux on android site
Click to expand...
Click to collapse
ill wait out the driver then. bcmon is working on the nexus 5, same driver so should theoretically work on note 3
melaniel said:
ill wait out the driver then. bcmon is working on the nexus 5, same driver so should theoretically work on note 3
Click to expand...
Click to collapse
+1
I don't think there will be a driver, but let's hope and pray... Maybe a developer take some time to port the driver for the bcm 4339 chipset to get monitor mode working .
For informations about development status for the driver you can follow my link
http://forum.xda-developers.com/showthread.php?t=2602710
Greetings Tyler
TylerDurben said:
+1
I don't think there will be a driver, but let's hope and pray... Maybe a developer take some time to port the driver for the bcm 4339 chipset to get monitor mode working .
For informations about development status for the driver you can follow my link
http://forum.xda-developers.com/showthread.php?t=2602710
Greetings Tyler
Click to expand...
Click to collapse
Well its the same driver as the Nexus 5, so here's hoping!
melaniel said:
Well its the same driver as the Nexus 5, so here's hoping!
Click to expand...
Click to collapse
This project is much more interesting!!
http://w11.zetaboards.com/Pwnie_Express/forum/3714106/
I am using it with my nexus 7 (2012) witch is bcmon supported
Sent from my SM-N9005 using XDA Premium 4 mobile app
Error: Unable to create loop device!
Hello,
I installed the 4.4.2 version on Note 3 (N9005) ... when I boot Kali I receive the error below:
Code:
[email protected]:/ $
[email protected]:/ $ cd /storage/extSdCard/Linux/KaliFull
[email protected]:/storage/extSdCard/Linux/KaliFull $ su
sh /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh /storage/extSdCard/Linux/KaliFull/kalilinux.FULL.ext4.v2.img
sh /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh /storage/extSdCard/Linux/KaliFull/kalilinux.FULL.ext4.v2.img
Full/kalilinux.FULL.ext4.v2.img <
Checking loop device... MISSING
Creating loop device... /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh[130]: /data/data/com.zpwebsites.linuxonandroid/files/busybox: can't execute: Permission denied
FAILED
Error: Unable to create loop device!
1|[email protected]:/storage/extSdCard/Linux/KaliFull #
does anyone know how to fix it?
Thanks,
Error: Unable to create loop device!
yea, me too, galaxy note3
Error: Unable to create loop device!
help,
Loop device error
My device also has that loop error.
I think that this has something to do with the kernel...
Here is my kernel version:
http://i.imgur.com/C6yF4DB.png
Can anyone confirm that this is the kernel issue?
P.S. here are the instructions for setting up Kali on Galaxy S4 with Linux Deploy app (I'll try install it using these methods...):
http://forum.xda-developers.com/showthread.php?t=2400638
EDIT:
I had no luck installing it with Linux Deploy. It just fails... It says it cannot find the directory that actually exist... xD
P.S. i think this is a kernel issue according to this (and other posts I found):
http://forum.xda-developers.com/showpost.php?p=50746675&postcount=5
You can find custom kernels and ROMs here:
http://forum.xda-developers.com/showthread.php?t=2439633
I heard that the LEAN kernel has "loop devices" setting enabled.
Also, you can modify your current kernel. Instructions here:
http://forum.xda-developers.com/showthread.php?t=1818871
Is there a easier method for enabling loop devices?
access
how can I access all kali files and folders when I usee explorer root is my sd card root and I can't see a single kali file
I tried your method and still received the same errors.
I have a rooted note 3 (I think I used the chainfire method) the device is still pretty new to me.
First it won't create the loop255
I've manged to get around that by making the loop255 device myself in terminal with the play store version of bbox (for some reason there seems to be an issue with the installer calling it's own busybox)
But then it (that is the loop device) won't mount, I'm over my head with that stuff so I haven't been able to work around this.
Some guidance would be much appreciated.
On a side note I got linux running on my old LG Motion with linux deploy and it works like a dream but for some reason there are no programs on it! I've found this odd but there are (or at least I cant find them) none of the preloaded hacking programs that are the entire point of the kali project. It's possible I just didn't find them yet but it's so hard to work with a desktop OS on a 320x480 screen, that's why I'm trying to get it on my note! I'm in love with this new 1080x1900 res!
Sent from my SM-N900T using XDA Free mobile app
---------- Post added at 11:15 PM ---------- Previous post was at 10:57 PM ----------
Okay I've seen in a few places that it has to do with the stock kernel of the note 3 can anyone either confirm or deny this and if so what do I do?
Sent from my SM-N900T using XDA Free mobile app
Root Folder
I was just wondering how you were able to copy files and folders from your pc to your root folder. Do you use a program or cmd line?
Circumventing the loop device mounting problem on the Note 3
Vinniecap974 said:
I tried your method and still received the same errors.
I have a rooted note 3 (I think I used the chainfire method) the device is still pretty new to me.
First it won't create the loop255
I've manged to get around that by making the loop255 device myself in terminal with the play store version of bbox (for some reason there seems to be an issue with the installer calling it's own busybox)
But then it (that is the loop device) won't mount, I'm over my head with that stuff so I haven't been able to work around this.
Some guidance would be much appreciated.
On a side note I got linux running on my old LG Motion with linux deploy and it works like a dream but for some reason there are no programs on it! I've found this odd but there are (or at least I cant find them) none of the preloaded hacking programs that are the entire point of the kali project. It's possible I just didn't find them yet but it's so hard to work with a desktop OS on a 320x480 screen, that's why I'm trying to get it on my note! I'm in love with this new 1080x1900 res!
Sent from my SM-N900T using XDA Free mobile app
---------- Post added at 11:15 PM ---------- Previous post was at 10:57 PM ----------
Okay I've seen in a few places that it has to do with the stock kernel of the note 3 can anyone either confirm or deny this and if so what do I do?
Sent from my SM-N900T using XDA Free mobile app
Click to expand...
Click to collapse
I ran up against the same problem and the only way I could get around it was to flash with a "permissive" ROM.
Device: Galaxy Note 3 N9005 running stock Android 4.4.2 (KitKat).
Main steps I followed were:
(1) Rooted the phone using the excellent Towelroot method;
(2) Downloaded and deployed the various files mentioned in the Kali install guide in this thread (Kali image, bootscript, busybox, etc.);
(3) Flashed a bootloader. I used Mobile Odin (from Play Store) to install the latest CWM bootloader;
(4) Downloaded and flashed the Omega V21 ROM using the CWM bootloader. I opted for "no wipe" and it seems to have worked OK.
(5) Used the Complete Linux Installer app (Play Store) to load and run the Kali image;
(6) Fixed some permissions problems with the rooted version of the FX file explorer app (Play Store);
(7) Accessed Linux using the RealVNC app (Play Store) rather than the recommended android-vnc-viewer.
Found the former worked better for me;
Of course, the ROM flash voided my warranty, but that's not an issue for me.
Hope this helps,
Ronan
As I understand it , you need to flash a permissive kernel to make this work properly.
Im on 4.4.2 with knox 0x0 and really dont want to set it to 0x1.
I managed to get linux to install but its limited in what you can do with it.
Xposed didnt set mine to permissive , neither did the playstore app .
If anyone knows of a way to set a stock kernel to permissive on a rooted device plz pm me.
I set up a Debian chroot on my CM11 Note 3 and have been using it for a long time with great success. Here's a tip, don't bother with the loopback-mounted images, it's pointless on a phone with a datamedia partition layout (where /data and /sdcard are the same partition, which the Note 3 is). Instead, just dump the root filesystem directly into the /data directory in a folder, i.e. /data/debian (or /data/arch, /data/ubuntu, /data/kali, etc). This way you don't have to have loopback device support in your kernel, you can install as much crap as you want and not have to resize your image/partition, and you can delete crap you don't want to free up space for Android apps or user storage because all of them share the same space.
Another tip, instead of VNC server which is not accelerated and pretty crap overall, use XServer XSDL. This implements an X-server at the Android app level so it can take advantage of some acceleration (not 3D but possibly 2D) and is drawing with native Android surfaces rather than rendering into a VNC buffer and such. To use it, simply run a command such as:
Code:
# env 127.0.0.1:0 mate-session
from a chroot terminal. This particular one will open a MATE desktop session in XServer XSDL (make sure you either open the app right before or right after running the command, leave it too long and it times out). There's also a libandroid_shmem.so or something library you can use to speed up the chroot->xserver memory performance. Best thing is you can configure the touchscreen to act as a trackpad like on a laptop, then use the left and right (up and down, but landscape) volume keys as left and right click.
On CM11 you can even write a script and add it to /data/local/userinit.sh to automatically start the chroot (bind mount all the devices and set up networking) and even start services if you want. I have mine automatically fire up a samba server and an SSH server on boot so I can access files remotely as well as remote in and use my Note 3 as an ARM build box for compiling stuff.
Finally, I'm looking into booting Debian natively. I've already got it working on my Note 1 and my HP TouchPad. Booting natively means you get full access to run an X server with full graphics hardware access, and with the Freedreno driver you can get actual GL and GLES acceleration. The Adreno 330 should be able to handle this pretty well. The first step towards this goal is getting dual-booting kernels to work as the native Debian kernel will need some stuff that Android doesn't want and vice-versa. I'm working towards porting Kexecboot and the kexec-hardboot patches which will allow booting of multiple kernels without reflashing. Then you can boot Debian (or other Linux) natively or you can boot Android and use services from that Linux install in chroot and easily switch back and forth by rebooting. I already have this working on the Note 1 (HP TouchPad has kexecboot but it isn't really necessary as the main bootloader supports multiple kernels already).

[Q] Kernel module for ethernet SMC2208 adapter

I have an Ethernet SMC 2208 adapter which does not work with shield out of the box. I have my shield updated to lollipop. Upon insertion I can see that the device is recognized by the system in the sense that there are messages in dmesg stating that it is "Procduct SMCSMC2208USB". After that there are some messages mentioning "audit" and "avc: denied". In contrast on my Nexus 5 (also lollipop) the device works correctly, I can see some messages mentioning pegasus driver if I got it correctly. It's a bit hard to provide complete output since I'm running the commands from android terminal and can't easily copy output here. But if that would help I'll grab it somehow.
I was thinking about compiling the module for the device but it not as easy as on regular linux. I found the driver source on that page: "edge-core.com/temp/edm/old_downloads/old_downloads.html" "edge-core.com/temp/edm/old_downloads/dr/DR_SMC2208_LinuxDRV.zip" (because this is my first post I can't insert URLs So I deleted " h t t p : / / w w w ." prefix, sorry for inconvinience)
But I don't know how to compile it for android in general and for my tablet in particular. I would greatly appreciate if someone could compile it for me or point me to steps I need to follow to do it myself.
Thanks in advance for your help

[APP][NON-ROOT] Termux-ADB - debug one Android device from another connected by USB-OTG

Run adb in Termux without root permissions!​This is a launcher for adb which enables debugging of one Android device from another via USB cable. It should work with any USB-C male-to-male cable or the corresponding OTG adapter + cable in case of micro USB.
https://github.com/nohajc/termux-adb
Motivation​Termux has had the android-tools package for some time now but it only works properly if you root your device (due to missing filesystem permissions). This is because Android has its own API for accessing USB peripherals which is incompatible with Linux. Termux already exposes this API using the termux-usb utility (part of Termux API) but this is not enough to make programs like adb work out of the box.
Usually you would have to modify any application which accesses USB devices but there's actually another way.
When you start adb using termux-adb, it will use termux-usb in the background for device discovery and then essentially feed the device information into adb by intercepting some libc calls and emulating usb device files as they would appear on any linux machine (bypassing the file permission problem entirely).
At this point the program is in its early stages and therefore highly experimental. I tested it on two Android devices so far and I can't give any guarantees it will work for everyone. But you can try.
That is great work! It works fine in my honor handset!
When will you share the new release with multiple ADB device support?
Appreciate for your fantastic tool !
It's definitely on my TODO list but now I'm also dealing with the fact it doesn't work on some devices.
So, I don't have an exact timeline but I'll keep this thread up to date.
Version 0.2 released today: https://github.com/nohajc/termux-adb/releases/tag/v0.2.0
@Stanton1011 It supports multiple devices now.
Thank you. If you're wanting feedback, there seems to be a lot of lag getting it to connect at first but it does work and once it's connected no issues. The fastboot however has much more lagging and will say simultaneously that commands succeeded and failed (but just seem to fail). But adb works fine on moto g pure running android 11, moto g pure on Android 12, TCL Obama phone type android 12, Samsung a11 android 10.
Thanks for the report. I'm aware of the lag. It's mainly caused by how Termux handles USB access in general but it could be improved if fastboot ran in the background (same as adb).
As for the commands failing, I'll look into it. Which particular fastboot commands you tried?
nohajc said:
Version 0.2 released today: https://github.com/nohajc/termux-adb/releases/tag/v0.2.0
@Stanton1011 It supports multiple devices now.
Click to expand...
Click to collapse
Thank you so much, I will have a try and let you know the result.
The following problem is solved by Pkg upgrade.
I find a error for it ,please help!
CANNOT LINK EXECUTABLE "./termux-adb": cannot locate symbol "_ZN6google8protobuf8internal14ArenaStringPtr3SetIJEEEvRKNSt6__ndk112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEPNS0_5ArenaE" referenced by "/data/data/com.termux/files/home/termux-adb"...
I have a handset with the root permission only for ADB, but Termux(or any android APP) can not obtain the root permission. Could you tell a way to use the adb in termux, I know I can user your github project Termux-adb as what you did before., but I also need a alternative way. I have the root permission of ADB command(by PC). Can I modify some folder permission to achieve the same affect?

Categories

Resources