wireless_tools在android上的移植

http://blog.csdn.net/armeasy/article/details/6566462


硬件平台:mx53_qsb开发板

软件平台:android2.2.1

 

第一步:网上下载wireless_tools源码包,放在/external目录,并解压,这里使用wireless_tools.29.tar.gz

可从下面的网址下载:

http://bbs.9tripod.com/viewthread.PHP?tid=126&extra=page%3D1

 

第二步:解压该文件,在external目录中将会新生成wireless_tools.29目录

 

第三步:在wireless_tools.29目录下创建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)

 

第四步:源代码修改

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

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

3.修改iwlib.h,将#include <net/ethernet.h>改为#include <net/if_ether.h>

4.在iwlib.h中,将下面的代码移出#ifndef IW_EV_LCP_PK_LEN  ......   #endif宏,确保下面的代码生效,否则将提示编译找不到这些宏定义的错误:

struct iw_pk_event

{

__u16 len; /* Real lenght of this stuff */

__u16 cmd; /* Wireless IOCTL */

union iwreq_data u; /* IOCTL fixed payload */

} __attribute__ ((packed));

struct iw_pk_point

{

  void __user *pointer; /* Pointer to the data  (in user space) */

  __u16 length; /* number of fields or size in bytes */

  __u16 flags; /* Optional params */

} __attribute__ ((packed));

 

#define IW_EV_LCP_PK2_LEN (sizeof(struct iw_pk_event) - sizeof(union iwreq_data))

#define IW_EV_POINT_PK2_LEN (IW_EV_LCP_PK2_LEN + sizeof(struct iw_pk_point) - IW_EV_POINT_OFF)

事实上,我们只用将#endif挪在这段代码的上面即可。

 

第五步:在android源码包根目录下,分别执行如下代码编译文件:

source build/envsetup.sh

mm bionic/libm PRODUCT-imx53_loco-eng

mm external/wireless_tools.29/ PRODUCT-imx53_loco-eng

编译完成,将会在out/target/product/imx53_loco/system/xbin下生成iwlist,iwconfig等无线工具。

 

第六步:使用adb push或者重新下载system.img映像文件,就可以正常使用wireless_tools了。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
`wireless_dev`是Linux内核中的一个结构体,定义在`include/net/cfg80211.h`头文件中。该结构体用于表示一个无线网络设备。 以下是`include/net/cfg80211.h`头文件中`wireless_dev`结构体的定义: ```c struct wireless_dev { const char *name; struct net_device *netdev; /* 一些回调函数 */ int (*change_mtu)(struct wireless_dev *wdev, int new_mtu); int (*set_mac_addr)(struct wireless_dev *wdev, const uint8_t *mac); int (*set_channel)(struct wireless_dev *wdev, struct cfg80211_chan_def *chandef); int (*set_bitrate_mask)(struct wireless_dev *wdev, struct cfg80211_bitrate_mask *mask); int (*add_key)(struct wireless_dev *wdev, enum nl80211_key_type key_type, const uint8_t *key, uint32_t key_len); int (*del_key)(struct wireless_dev *wdev, enum nl80211_key_type key_type, const uint8_t *key, uint32_t key_len); int (*set_default_mgmt_key)(struct wireless_dev *wdev, uint8_t *key, uint32_t key_len); int (*set_wiphy_params)(struct wireless_dev *wdev, uint32_t changed); int (*set_mesh_config)(struct wireless_dev *wdev, struct mesh_config *conf); int (*set_power_mgmt)(struct wireless_dev *wdev, bool enabled, int timeout); int (*set_cqm_rssi_config)(struct wireless_dev *wdev, struct cfg80211_cqm_rssi_config *config); int (*set_quiet)(struct wireless_dev *wdev, struct cfg80211_quiet *quiet); int (*set_ap_chanwidth)(struct wireless_dev *wdev, struct cfg80211_chan_def *chandef); int (*set_rekey_data)(struct wireless_dev *wdev, const uint8_t *kek, uint32_t kek_len, const uint8_t *kck, uint32_t kck_len, uint64_t replay_ctr); int (*set_noack_map)(struct wireless_dev *wdev, uint16_t noack_map); struct wireless_dev_p2p_info p2p; struct wiphy *wiphy; void *priv; struct cfg80211_registered_device *ieee80211_ptr; /* 一些设备状态 */ atomic_t iftype; unsigned int mesh_id_len; uint8_t mesh_id[0]; }; ``` 该结构体中包含了一个网络设备的名称、对应的net_device结构体、一些回调函数、设备状态、P2P信息等。在无线网络驱动中,可以通过该结构体来管理无线网络设备。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值