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

全部博文(674)

文章存档

2013年(34)

2012年(146)

2011年(197)

2010年(297)

分类: LINUX

2012-08-23 14:44:42

 解压到mydroid/external/wireless-tools目录
       创建Android.mk,内容如下

java代码:
  1. LOCAL_PATH:= $(call my-dir)
  2. ################## build iwlib ###################
  3. include $(CLEAR_VARS)
  4. LOCAL_SRC_FILES := iwlib.c
  5. LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
  6. LOCAL_MODULE:= libiw
  7. LOCAL_STATIC_LIBRARIES := libcutils libc libm
  8. include $(BUILD_STATIC_LIBRARY)
  9. ################## build iwconfig ###################
  10. include $(CLEAR_VARS)
  11. LOCAL_SRC_FILES := iwconfig.c
  12. LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
  13. LOCAL_MODULE:= iwconfig
  14. LOCAL_STATIC_LIBRARIES := libcutils libc libm libiw
  15. #LOCAL_FORCE_STATIC_EXECUTABLE := true
  16. LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
  17. #LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
  18. #LOCAL_MODULE_TAGS := eng user
  19. include $(BUILD_EXECUTABLE)
  20. ################## build iwlist ###################
  21. include $(CLEAR_VARS)
  22. LOCAL_SRC_FILES := iwlist.c iwlib.h
  23. LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
  24. LOCAL_MODULE:= iwlist
  25. LOCAL_STATIC_LIBRARIES := libcutils libc libm libiw
  26. #LOCAL_FORCE_STATIC_EXECUTABLE := true
  27. LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
  28. #LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
  29. #LOCAL_MODULE_TAGS := eng user
  30. include $(BUILD_EXECUTABLE)
复制代码

       修改
       将wireless.22.h 更名为wireless.h
       修改ifrename.c 增加getline的函数,代码可以从external/genext2fs/genext2fs.c中获得,注意里边是用宏把另一个函数传给getline
       修改iwlib.h,将#include 改为#include

       编译

java代码:
  1. qiu@qiubutu:~/eclair-21/external/wireless-tools$ . ../../build/envsetup.sh 
  2. qiu@qiubutu:~/eclair-21/external/wireless-tools$ mm

  3. PLATFORM_VERSION_CODENAME=REL
  4. PLATFORM_VERSION=2.1-update1
  5. TARGET_PRODUCT=generic
  6. TARGET_BUILD_VARIANT=eng
  7. TARGET_SIMULATOR=
  8. TARGET_BUILD_TYPE=release
  9. TARGET_ARCH=arm
  10. HOST_ARCH=x86
  11. HOST_OS=linux
  12. HOST_BUILD_TYPE=release
  13. BUILD_ID=ECLAIR
复制代码

       make:进入目录'/home/qiu/eclair-21'

java代码:
  1. target thumb C: iwconfig <= external/wireless-tools/iwconfig.c
  2. In file included from external/wireless-tools/iwlib.h:25,
  3. from external/wireless-tools/iwlib-private.h:19,
  4. from external/wireless-tools/iwconfig.c:14:
  5. bionic/libc/include/stdlib.h:84: warning: declaration of 'abs' shadows a built-in function
  6. bionic/libc/include/stdlib.h:88: warning: declaration of 'labs' shadows a built-in function
  7. bionic/libc/include/stdlib.h:92: warning: declaration of 'llabs' shadows a built-in function
  8. target thumb C: libiw <= external/wireless-tools/iwlib.c
  9. In file included from external/wireless-tools/iwlib.h:25,
  10. from external/wireless-tools/iwlib-private.h:19,
  11. from external/wireless-tools/iwlib.c:14:
  12. bionic/libc/include/stdlib.h:84: warning: declaration of 'abs' shadows a built-in function
  13. bionic/libc/include/stdlib.h:88: warning: declaration of 'labs' shadows a built-in function
  14. bionic/libc/include/stdlib.h:92: warning: declaration of 'llabs' shadows a built-in function
  15. target StaticLib: libiw (out/target/product/generic/obj/STATIC_LIBRARIES/libiw_intermediates/libiw.a)
  16. target Executable: iwconfig (out/target/product/generic/obj/EXECUTABLES/iwconfig_intermediates/LINKED/iwconfig)
  17. target Non-prelinked: iwconfig (out/target/product/generic/symbols/system/bin/iwconfig)
  18. target Strip: iwconfig (out/target/product/generic/obj/EXECUTABLES/iwconfig_intermediates/iwconfig)
  19. Install: out/target/product/generic/system/xbin/iwconfig
  20. target thumb C: iwlist <= external/wireless-tools/iwlist.c
  21. In file included from external/wireless-tools/iwlib.h:25,
  22. from external/wireless-tools/iwlib-private.h:19,
  23. from external/wireless-tools/iwlist.c:14:
  24. bionic/libc/include/stdlib.h:84: warning: declaration of 'abs' shadows a built-in function
  25. bionic/libc/include/stdlib.h:88: warning: declaration of 'labs' shadows a built-in function
  26. bionic/libc/include/stdlib.h:92: warning: declaration of 'llabs' shadows a built-in function
  27. target Executable: iwlist (out/target/product/generic/obj/EXECUTABLES/iwlist_intermediates/LINKED/iwlist)
  28. target Non-prelinked: iwlist (out/target/product/generic/symbols/system/bin/iwlist)
  29. target Strip: iwlist (out/target/product/generic/obj/EXECUTABLES/iwlist_intermediates/iwlist)
  30. Install: out/target/product/generic/system/xbin/iwlist
  31. make:离开目录“/home/qiu/eclair-21”
复制代码

        拷贝到文件系统

java代码:
  1. qiu@qiubutu:~/eclair-21/external/wireless-tools$ croot
  2. qiu@qiubutu:~/eclair-21$ cp out/target/product/generic/system/xbin/iwconfig /nfs/rootfs/system/xbin/iwconfig
  3. qiu@qiubutu:~/eclair-21$ cp out/target/product/generic/system/xbin/iwlist /nfs/rootfs/system/xbin/

复制代码

       测试
       启动android后

java代码:
  1. # modprobe libertas
  2. # modprobe libertas_sdio
  3. libertas_sdio: Libertas SDIO driver
  4. libertas_sdio: Copyright Pierre Ossman
  5. model=0xb
  6. sd8686_helper.bin sd8686.bin
  7. init: untracked pid 853 exited
  8. init: untracked pid 856 exited
  9. libertas: eth1: Marvell WLAN 802.11 adapter


  10. # iwconfig eth1 
  11. eth1 IEEE 802.11b/g ESSID:"Antrose-11g" 
  12. Mode:Managed Frequency:2.437 GHz Access Point: 00:15:E9:0C:87:7C 
  13. Bit Rate:1 Mb/s Tx-Power=13 dBm 
  14. Retry limit:8 RTS thr=2347 B Fragment thr=2346 B 
  15. Encryption key:off
  16. Power Management:off
  17. Link Quality=83/100 Signal level=-60 dBm Noise level=-93 dBm
  18. Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:1441
  19. Tx excessive retries:44 Invalid misc:11220 Missed beacon:0
  20. # iwlist scan
  21. eth1 Scan completed :
  22. Cell 01 - Address: 00:22:6B:8C:5D:3A
  23. ESSID:"Antrose-11g"
  24. Mode:Managed
  25. Frequency:2.412 GHz (Channel 1)
  26. Quality=65/100 Signal level=-78 dBm Noise level=-96 dBm
  27. Encryption key:off
  28. Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
  29. 24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
  30. 12 Mb/s; 48 Mb/s
  31. # iwconfig eth1 essid Antrose-11g 
  32. # iwconfig eth1 
  33. eth1 IEEE 802.11b/g ESSID:"Antrose-11g" 
  34. Mode:Managed Frequency:2.437 GHz Access Point: 00:15:E9:0C:87:7C 
  35. Bit Rate:1 Mb/s Tx-Power=13 dBm 
  36. Retry limit:8 RTS thr=2347 B Fragment thr=2346 B 
  37. Encryption key:off
  38. Power Management:off
  39. Link Quality=83/100 Signal level=-60 dBm Noise level=-93 dBm
  40. Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:1441
  41. Tx excessive retries:44 Invalid misc:11220 Missed beacon:0
复制代码
阅读(1914) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~