编译并build立“android”设备的“iw”?

我需要在Android 4.1设备上安装iw无线包。 但我不知道如何和什么是要安装的软件包的版本!

也是需要linux平台才能做到这一点,或者是足够build立和安装在adbshell上的android root设备。

我看到这个链接,但是当我从adbterminal做到这一点,我看到,混帐和一些贝壳找不到? 怎么做 ?

似乎没有人有任何想法?

Solutions Collecting From Web of "编译并build立“android”设备的“iw”?"

在构建iw版本3.11(已经有一个Android.mk文件)时,由于丢失/错误的头文件和库,我遇到了一些问题。 由于它有一个Android.mk文件,所以可以使用NDK。

以下我将假设如下:

  • 之前已经构建了设备映像(内核头文件和libnl-2静态库至少应该可用)。 我已经为i9300构建了CyanogenMod 10(内核3.0.something),更新下面的路径来反映这一点。
  • NDK被安装到~/android/system/ndk
  • NDK安装了适当的平台和工具链。

准备提取iw-3.11.tar.xz并更改我的目录:

 ln -s . jni ln -nsv ~/android/system/external ./ 

下一个问题是netlink库:

 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. 

简单地创建一个到android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux会严重地破坏其他头文件,从而导致如下错误:

 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 

一个解决方法是创建linux目录,并把~/android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux/genetlink.h放在里面:

 mkdir -p linux ln -svn ~/android/system/out/target/product/i9300/obj/KERNEL_OBJ/usr/include/linux/genetlink.h linux/ 

最后补丁Android.mk完成链接到netlink库:

 sed "/LOCAL_LDFLAGS/s#\$# -L$HOME/android/system/out/target/product/i9300/obj/STATIC_LIBRARIES/libnl_2_intermediates -lnl_2#" -i Android.mk 

现在可以开始构建:

 NDK_PROJECT_PATH=$PWD ~/android/system/ndk/ndk-build TARGET_PLATFORM=android-14 

它不会完成,因为无法找到netlink / genl / genl.h,但是iw二进制文件在libs / armeabi中可用!