i need to install iw wireless packages on android 4.1 device. but i don't know how and what is the require version of the packages to install !!
also is it need linux platform to do this or it is enough to build and install on adb shell for android rooting device.
i see this link but when i do it from adb terminal i see that git and some shells not found ??? how to do it ?
it seems no one has any idea ??
While building iw version 3.11 (which has an Android.mk file already), I encountered some issues due to missing/ wrong headers and libraries. Since it has an Android.mk file, the NDK can be used.
In the following I will assume the following:
~/android/system/ndk
.Preparation after extracting iw-3.11.tar.xz
and changing my directory in it:
ln -s . jni
ln -nsv ~/android/system/external ./
The next issue is the netlink library:
In file included from external/libnl-headers/netlink/genl/genl.h:15:0,
from /tmp/and/iw/jni/iw.c:17:
external/libnl-headers/netlink/netlink.h:27:29: fatal error: linux/genetlink.h: No such file or directory.
Simply creating a link to the android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux
breaks other headers badly which will give errors such as:
Compile thumb : iw <= iw.c
In file included from /home/user/android/system/ndk/platforms/android-14/arch-arm/usr/include/net/if.h:28:0,
from /tmp/and/iw/jni/iw.c:10:
/tmp/and/iw/jni/linux/if.h:178:19: error: field 'ifru_addr' has incomplete type
/tmp/and/iw/jni/linux/if.h:179:19: error: field 'ifru_dstaddr' has incomplete type
/tmp/and/iw/jni/linux/if.h:180:19: error: field 'ifru_broadaddr' has incomplete type
/tmp/and/iw/jni/linux/if.h:181:19: error: field 'ifru_netmask' has incomplete type
/tmp/and/iw/jni/linux/if.h:182:20: error: field 'ifru_hwaddr' has incomplete type
In file included from external/libnl-headers/netlink/netlink.h:20:0,
from external/libnl-headers/netlink/genl/genl.h:15,
from /tmp/and/iw/jni/iw.c:17:
/home/user/android/system/ndk/platforms/android-14/arch-arm/usr/include/sys/socket.h:74:44: warning: 'struct msghdr' declared inside parameter list [enabled by default]
/home/user/android/system/ndk/platforms/android-14/arch-arm/usr/include/sys/socket.h:74:44: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
/home/user/android/system/ndk/platforms/android-14/arch-arm/usr/include/sys/socket.h:75:38: warning: 'struct msghdr' declared inside parameter list [enabled by default]
In file included from external/libnl-headers/netlink/netlink.h:25:0,
from external/libnl-headers/netlink/genl/genl.h:15,
from /tmp/and/iw/jni/iw.c:17:
/tmp/and/iw/jni/linux/netlink.h:33:2: error: unknown type name 'sa_family_t'
In file included from external/libnl-headers/netlink/genl/genl.h:15:0,
from /tmp/and/iw/jni/iw.c:17:
external/libnl-headers/netlink/netlink.h:51:16: warning: 'struct msghdr' declared inside parameter list [enabled by default]
external/libnl-headers/netlink/netlink.h:54:19: warning: 'struct iovec' declared inside parameter list [enabled by default]
make: *** [/tmp/and/iw/obj/local/armeabi/objs/iw/iw.o] Error 1
A workaround is to create the linux
directory and put a symlink to ~/android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux/genetlink.h
in it:
mkdir -p linux
ln -svn ~/android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux/genetlink.h linux/
Finally patch Android.mk
to finish linking to the netlink library:
sed "/LOCAL_LDFLAGS/s#\$# -L$HOME/android/system/out/target/product/i9300/obj/STATIC_LIBRARIES/libnl_2_intermediates -lnl_2#" -i Android.mk
Now the build can be started:
NDK_PROJECT_PATH=$PWD ~/android/system/ndk/ndk-build TARGET_PLATFORM=android-14
It will not complete because netlink/genl/genl.h cannot be found, but the iw
binary is available in libs/armeabi!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With