平台为hi35XX,在Liunx下借助wireless_tools和wpa_supplicant(因为现在的无线wifi网络大多是wpa加密。所以需要移植wpa_supplicant工具)等工具实现wifi的过程。
一、移植wireless_tools
- 下载并编译wireless_tools
tar zxf wireless_tools.29.tar.gz(网上下载)
cd wireless_tools.29
目录里头Makefile的CC,AR等改成交叉编译所用的,可依据实际需要修改Makefile中的”CC=gcc”,”AR=ar”这两个, 以便cross compile;
其余makefile不需要修改;用 make clean;make all即可编译。
生成的libiw.so.29与其他工具一起。)
make
成功后会在当前目录生成iwspy,iwpriv,iwlist以及iwconfig等文件。
- 拷贝文件
我们只需将这四个文件拷备到文件系统的sbin目录,然后将当前目录的libiw.so.29库文件拷到文件系统的lib目录,无线网络工具即安装完成。
- Andriod版本下的步骤
1,在目录下cp -f wirless.29.h wirelss.h (自带的Makefile就是这么干的,根据版本选择头文件,我下载的是.29版本)
2,在目录下加入Android.mk,内容如下:
**[plain]
view plaincopyprint?
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
LOCAL_PATH := $(call my-dir)
ifneq ($(TARGET_SIMULATOR),true)
include $(CLEAR_VARS)
LOCAL_MODULE := libiw
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwlib.c
LOCAL_C_INCLUDE += LOCAL_PATH
#LOCAL_SHARED_LIBRARIES := libiw
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwpriv.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwpriv
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwlist.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwlist
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwconfig.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwconfig
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwspy.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwspy
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwgetid.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwgetid
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwevent.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwevent
include $(BUILD_EXECUTABLE)
#================================================
endif # !TARGET_SIMULATOR
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
LOCAL_PATH := $(call my-dir)
ifneq ($(TARGET_SIMULATOR),true)
include $(CLEAR_VARS)
LOCAL_MODULE := libiw
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwlib.c
LOCAL_C_INCLUDE += LOCAL_PATH
#LOCAL_SHARED_LIBRARIES := libiw
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwpriv.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwpriv
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwlist.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwlist
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwconfig.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwconfig
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwspy.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwspy
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwgetid.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwgetid
include $(BUILD_EXECUTABLE)
#================================================
#================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := iwevent.c
LOCAL_SHARED_LIBRARIES := libiw
LOCAL_MODULE := iwevent
include $(BUILD_EXECUTABLE)
#================================================
endif # !TARGET_SIMULATOR**
3,在目录下mm,将生成的libiw.so用adb push到/system/lib,其他的iwxxx push到/system/bin。