移植wireless-tools到android

2350阅读 0评论2016-03-09 lxglxt
分类:Android平台

1.      从 下载wireless_tools.30.pre9.tar.gz, 此版本支持non-ASCII char in ESSID

 

2.      解压到android/external/wireless_tools.30目录

 

3.      创建Android.mk,内容如下

LOCAL_PATH:= $(call my-dir)
################## build iwlib ###################
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := debug
LOCAL_SRC_FILES := iwlib.c
LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
LOCAL_MODULE:= libiw
LOCAL_STATIC_LIBRARIES := libcutils libc libm
include $(BUILD_STATIC_LIBRARY)
################## build iwconfig ###################
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := debug
LOCAL_SRC_FILES := iwconfig.c
LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
LOCAL_MODULE:= iwconfig
LOCAL_STATIC_LIBRARIES := libcutils libc libm libiw
#LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
#LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
#LOCAL_MODULE_TAGS := eng user
include $(BUILD_EXECUTABLE)
################## build iwlist ###################
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := debug
LOCAL_SRC_FILES := iwlist.c iwlib.h
LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
LOCAL_MODULE:= iwlist
LOCAL_STATIC_LIBRARIES := libcutils libc libm libiw
#LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
#LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
#LOCAL_MODULE_TAGS := eng user
include $(BUILD_EXECUTABLE)

4.      修改

将wireless.22.h 更名为wireless.h

修改ifrename.c 增加getline的函数,代码可以从external/genext2fs/genext2fs.c中获得

修改iwlib.h,将#include 改为#include


5.      编译

***首先编译libm***这一点是按照网上其他例子做不成功的关键

$source build/envsetup.sh
$lunch full_smdkxxxx

$cd android/bionic/libm

$mm


$cd android/external/wireless_tools.30

$mm


6.      使用
重新打包和烧录system.img映像文件,就可以正常使用wireless_tools了。

上一篇:wireless-tools移植和交叉编译
下一篇:wireless-tools使用