Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3003793
  • 博文数量: 674
  • 博客积分: 17881
  • 博客等级: 上将
  • 技术积分: 4849
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-17 10:15
文章分类

全部博文(674)

文章存档

2013年(34)

2012年(146)

2011年(197)

2010年(297)

分类: LINUX

2012-05-04 18:36:36

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

 

2.      解压到mydroid/external/wireless-tools目录

 

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

LOCAL_PATH:= $(call my-dir)
################## build iwlib ###################
include $(CLEAR_VARS)
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_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_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***这一点是按照网上其他例子做不成功的关键

$cd mydroid/bionic/libm

$source build/envsetup.sh

$mm


$cd mydroid/external/wireless-tools

$mm


下面是编译成功的输出
mm
make: Entering directory `/home/fisher/android'
build/core/product_config.mk:261: WARNING: adding test OTA key
============================================
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=
============================================
target thumb C: libiw <= /home/fisher/android/external/wireless_tools.30/iwlib.c
In file included from /home/fisher/android/external/wireless_tools.30/iwlib.h:27,
from /home/fisher/android/external/wireless_tools.30/iwlib.c:14:
bionic/libc/include/stdlib.h:84: warning: declaration of 'abs' shadows a built-in function
bionic/libc/include/stdlib.h:88: warning: declaration of 'labs' shadows a built-in function
bionic/libc/include/stdlib.h:92: warning: declaration of 'llabs' shadows a built-in function
target StaticLib: libiw (out/target/product/generic/obj/STATIC_LIBRARIES/libiw_intermediates/libiw.a)
target Executable: iwconfig (out/target/product/generic/obj/EXECUTABLES/iwconfig_intermediates/LINKED/iwconfig)
target Non-prelinked: iwconfig (out/target/product/generic/symbols/system/bin/iwconfig)
target Strip: iwconfig (out/target/product/generic/obj/EXECUTABLES/iwconfig_intermediates/iwconfig)
target thumb C: iwlist <= /home/fisher/android/external/wireless_tools.30/iwlist.c
In file included from /home/fisher/android/external/wireless_tools.30/iwlib.h:27,
from /home/fisher/android/external/wireless_tools.30/iwlist.c:14:
bionic/libc/include/stdlib.h:84: warning: declaration of 'abs' shadows a built-in function
bionic/libc/include/stdlib.h:88: warning: declaration of 'labs' shadows a built-in function
bionic/libc/include/stdlib.h:92: warning: declaration of 'llabs' shadows a built-in function
target Executable: iwlist (out/target/product/generic/obj/EXECUTABLES/iwlist_intermediates/LINKED/iwlist)
target Non-prelinked: iwlist (out/target/product/generic/symbols/system/bin/iwlist)
target Strip: iwlist (out/target/product/generic/obj/EXECUTABLES/iwlist_intermediates/iwlist)
Install: out/target/product/generic/system/xbin/iwconfig
Install: out/target/product/generic/system/xbin/iwlist
Finding NOTICE files: out/target/product/generic/obj/NOTICE_FILES/hash-timestamp
Combining NOTICE files: out/target/product/generic/obj/NOTICE.html
gzip -c out/target/product/generic/obj/NOTICE.html > out/target/product/generic/obj/NOTICE.html.gz
make: Leaving directory `/home/fisher/android'

但是目前在android使用还有点问题,总说
# iwconfig              
lo        no wireless extensions.

dummy0    no wireless extensions.

rmnet0    no wireless extensions.

rmnet1    no wireless extensions.

rmnet2    no wireless extensions.

usb0      no wireless extensions.

tiwlan0   no wireless extensions.

阅读(1274) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~