Posts Tagged ‘Android’

HOWTO: Compile TUN/TAP Driver(tun.ko) for Evo 4g (

15 2月
Hello all. After been searching the tun.ko for my Evo4g for the last week and failed, I tried to compile it myself this week, and luckily succeeded. Well, I shall paste the tun.ko file here first for those who don't want to know the details to download directly. OK. Now we shall begin. I used a linux box to do the job, if you got a windows or mac box, sorry for that, you have to find your own way. 🙂 Firstly download the source code of our kernel from here: and the ndk from here: Of course you may need the sdk as well, but I'm lazy and in this post, the sdk will just play some very simple role which can be replaced by other stuff I already got, so I just skipped that. When you have all the above ready, copy the /proc/config.gz file from your phone to your linux box and unzip and rename:
gunzip config.gz
mv config .config
Edit the .config file and set 'CONFIG_TUN=m'. (You can find the line start with '# CONFIG_TUN' and change it if you have obsessive-compulsive disorder like me.) Now extract the source code and place this .config under the source code folder. Edit the Makefile in the source code, and set 'EXTRAVERSION = .17-gee557fd' (If you are compiling a different version of kernel you should set this value to exact what your extra version is. You can easily find it in your phone's about page or use the command 'uname -a' in your phone's terminal or sdk's adb shell.) Then: export ARCH=arm export CROSS_COMPILE=arm-eabi- export PATH=$PATH:~/android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/   (Fix this directory to where you have extracted your ndk) After all set, goto the kernel folder and run 'make modules' . You will be asked for some choice in the compiling. Actually a lot of questions and I have no idea what they are referred to. But there're some option you need to choose correctly. Qualcomm MSM SoC Type, choose 'QSD8x50' Supersonic (MACH_SUPERSONIC) [N/y/?] (NEW)  Y
DAL RPC support (MSM_DALRPC) [Y/n/?] (NEW)  N
Don't ask me why. I did this and it worked, or failed somehow. For the rest options, just press 'Enter' to use the default.
Then you should have your tun.ko in 'drivers/net/' under your kernel folder.
Copy the driver to your phone and you know the rest which can be found every where else.
Quick note for openvpn:
insmod /system/lib/modules/tun.ko
ln -s /system/bin/busybox /system/xbin/bb/ifconfig
ln -s /system/bin/busybox /system/xbin/bb/route