I have a Samsung Galaxy SIII S3 SGH-I747M (Bell) with Jelly Bean 4.1.1 kernel 3.0.31 (stock rooted, root66_BMC_I747MVLDLK4.7z). I also have an Asix USB LAN adapter (from monoprice) + USB OTG cable which did not work out of the box... but i am a software engineer... so I made it work. The process below should work for other carriers / modules if you find the proper kernel source. Compiling latest drivers directly from Asix is the best method... Read that part first!
Read the README that comes with your kernel source, you may need a different compiler! https://github.com/AdiPat/Android_Toolchains is where I got mine...
Details about the Asix AX88772 USB lan RJ45 adapter chipset can be found here:
You can skip to "Usage instructions" section and download pre-compiled modules, if you have identical kernel + phone
built from SGH-I747M_BMC_JB_Opensource.zip (I747MVLDLK4, my phone) + latest Asix driver, works great!!!
built from SGH-I747M_BMC_JB_Opensource.zip (I747MVLDLK4, my phone) stock kernel driver, 'insmod's, but 'ping' is flaky?
built from GT-I930_JB_Opensource_Update7.zip (I9300XXELLA, requested by gingerneil), stock kernel driver, works great!!!
built from GT-I930_JB_Opensource_Update8.zip (EMR2, requested by gingerneil), stock kernel driver, untested
built from Cyanogenmod 10 for i9300, git commit 43aaedbcde478c8e032771d62a1956133b29b1d4, untested
built from Android 4.1.1 for Galaxy Tab 2 (GT-P5110) kernel 3.0.31-523998, contact 'patelkes' if you have questions.
built from Android 4.? for Xperia Tablet Z ROM (10.3.1.C.0.136), contact 'kristouf666' if you have questions.
built from Cyanogenmod 10.1.3 for SGH-i747m, git commit ?
Work in progress
Build environment setup:
-Get root access on a Ubuntu Natty (11.04) or similar linux build machine / virtual machine
-Install standard unix compiler tools
apt-get install build-essential-Install library for menuconfig
apt-get install libncurses5-dev-Install lzop (android compression util)
apt-get install lzop-Install git
apt-get install git-Download Android toolchains using git
-Download samsung kernel SGH-I747M_BMC_JB_Opensource.zip (international model, etc, also available)... Or download your 3rd party Cyanogenmod,etc kernel SOURCE instead.
git clone https://github.com/AdiPat/Android_Toolchains.git
-Extract to /root/kernel
mkdir /root/kernel-Set path so Android compiler can be found
export CROSS_COMPILE=/root/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-**EDIT: newer kernels, such as Cyanogenmod 10.2.1, use this
Compiling built-in kernel modules: (left for documentation sake, the better method is "Compiling latest drivers directly from Asix")
-Generate '.config' file in kernel folder (replace 'm2_att_defconfig' with name of file in 'arch\arm\configs\')
make arch=arm m2_att_defconfig-Modify kernel config to include Asix module and usbnet module
make menuconfigFor reference here is the help info for the 2 options that are now set to 'M'
[Navigate using arrow keys and enter]
Device Drivers ->
Network device support ->
USB Network Adapters ->
Multi-Purpose USB Networking Framework ->
[PRESS SPACEBAR until an M appears on the left]
[M] Multi-purpose USB Networking Framework
[M] ASIX AX88xxx Based USB 2.0 Ethernet Adapters
-Compile modules, where 2 is the number of CPU cores you have (speeds it up)
make -j2 && make -j2 modules-Once finished, grab your modules
-Use a root explorer such as ES File manager
Mount /system as rw in ES File manager root settings-Use a terminal emulator / adb shell to load modules (asix depends on usbnet, so load usbnet first)
copy asix.ko and usbnet.ko to /system/lib/modules/
su-If there are errors, run 'dmesg' and see section called "Insmod errors"
-If there are no errors, you should see 'eth0' in 'netcfg'
-'lsmod' lists modules loaded
-Connect your USB ethernet adapter to an ethernet network
-netcfg should show eth0 as connected
-Setup ethernet settings, if you want static address, for typical internet router at 192.168.1.1
ifconfig eth0 192.168.1.100 netmask 255.255.255.0-Setup ethernet settings, if you want automatic dhcp address
route add default gw 192.168.1.1 dev eth0
setprop net.dns1 192.168.1.1
ip addr show
ip route show
dhcpcd eth0-If you want one-click enable of your USB, see section "usbnet widget"
exec format error : wrong compiler / wrong kernel source / wrong phoneusbnet widget
init_module failed usbnet.ko (file exists) : module already loaded or built into kernel
no such file or directory : run dmesg immediately after attempt... you are missing module dependency
can't open usbnet.ko : are you root?
GT-9300 differences (thanks gingerneil)
Download my usbnet script http://pastebin.com/zQRQ6Kdj
Use a quality notepad editor such as notepad ++ to edit, ensure line endings are "Unix"
Place in /system/lib/modules/usbnet *cannot be on sdcard, as sdcard is a windows filesystem*
In terminal emulator / adb: "chmod 777 /system/lib/modules/usbnet"
-Menu -> Scripts
-Menu -> Browser -> /system/lib/modules/usbnet
-Ensure "Fav", "SU" and "is executable" are checked and give it a name 'usbnet', press save.
On homescreen, add widget, Smanager, pick your script 'usbnet'
You now have 1 click access to loading the modules, setting IP address, and testing connectivity to your router.
GT-I930_JB_Opensource_Update7.zipWhile building the kernel, the make config step is different
make arch=arm m0_00_defconfigThere is a third module built,
/root/kernel/drivers/net/mii.koUsage instructions, new order of operations
/system/lib/modules is not persistent on this phone, instead store modules + usbnet script
/system/mediaCompiling latest drivers directly from Asix
For some reason on my phone the stock kernel asix module did not work 100%.
I could insmod both modules, and using Wireshark, I verified my computer was receiving 'ping' packets, but the phone wasn't getting any 'ping reply' packets. This latest Asix driver works perfectly for me.
UPDATE:: http://www.asix.com.tw/FrootAttach/d...Source.tar.bz2 is available, but I have not tried it!
Follow "Environment setup" above
Generate kernel '.config' file (replace 'm2_att_defconfig' with name of file in 'arch\arm\configs\')Code:cd kernel_src_folder
Code:make arch=arm m2_att_defconfigCode:mkdir /root/asix && cd /root/asixCode:wget http://www.asix.com.tw/FrootAttach/driver/AX88772B_772A_760_772_178_LINUX_Driver_v4.4.1_Source.zipCode:unzip AX88772B_772A_760_772_178_LINUX_Driver_v4.4.1_Source.zip# we are replacing the Makefile with a new one.... if you edit, ensure indents = TABSCode:rm -rf Makefile
Code:wget http://pastebin.com/raw.php?i=4xLxksX3 -O Makefile**EDIT: newer kernels, such as Cyanogenmod 10.2.1, use thisCode:CROSS_COMPILE=/root/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi- make
Follow the "usage instructions" above, but since this is an "all-in-one" module, remove references to 'usbnet'Code:CROSS_COMPILE=/root/Android_Toolchains/arm-eabi-4.6/bin/arm-eabi- make
Other informational Links
Thanks to viulian for his inspirational post here in regards to compiling external module.
If you want to compare your phone's kernel configuration to the one in the download source from Samsung, read this post:
To see the list of loadable and built-in modules, see this.
More information about compiling kernel modules / asix / other usb chipsets / other devices
Did you know that Asix now manages Moschip products? Looking for MCS7830 drivers?
Thanks to zhlvf for pointing this , there is a way to hack android to think Wifi is connected when an USB ethernet is plugged in... (solves issues in some apps, like google play / market, which ignore USB ethernet as a valid connection).
Make errors documentation
Model number and version code explanation (how to tell which samsung.opensource.com zip file to download)
To get the active .config from a Cyanogen mod android,
adb pull /proc/config.gz