Android 编译移植 iperf (wifi 测试带宽和抖动,吞吐量)方法

Android 编译移植 iperf (wifi 测试带宽和抖动,吞吐量)方法
移植准备:
1. 下载 iperf-2.0.4.tar.gz ,并放到 Adroid_root/external
2. 解压到 Adroid_root/external/ iperf-2.0.4.tar.gz:
tar –zxvf iperf-2.0.4.tar.gz
3. 在解压好的iperf-2.0.4文件目录下创建 Android.mk

# 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)

L_DEFS := -DHAVE_CONFIG_H -UAF_INET6 -pie -fPIE
L_CFLAGS := $(L_DEFS)

L_COMMON_HDR := include/Condition.h include/gnu_getopt.h include/Locale.h include/Reporter.h include/Thread.h include/config.win32.h include/headers.h \
include/Mutex.h include/service.h include/util.h include/Extractor.h include/inet_aton.h include/report_CSV.h include/snprintf.h include/version.h include/gettimeofday.h include/List.h include/report_default.h include/SocketAddr.h \
include/Client.hpp include/Listener.hpp include/Server.hpp include/Timestamp.hpp include/delay.hpp include/PerfSocket.hpp include/Settings.hpp include/config.h

L_COMMON_SRC := src/Extractor.c src/Locale.c src/Reporter.c src/sockets.c src/gnu_getopt.c src/ReportCSV.c src/service.c src/stdio.c src/gnu_getopt_long.c src/ReportDefault.c src/SocketAddr.c src/tcp_window_size.c \
src/Client.cpp src/List.cpp src/main.cpp src/Server.cpp src/Launch.cpp src/Listener.cpp src/PerfSocket.cpp src/Settings.cpp

L_COMMON_COMPAT := compat/headers_slim.h compat/error.c compat/inet_ntop.c compat/signal.c compat/string.c compat/gettimeofday.c compat/inet_pton.c compat/snprintf.c compat/Thread.c compat/delay.cpp

iperf_SOURCES := $(L_COMMON_HDR) $(L_COMMON_SRC) $(L_COMMON_COMPAT)

include $(CLEAR_VARS)

LOCAL_MODULE := iperf
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := tests eng
LOCAL_CFLAGS := $(L_CFLAGS)
LOCAL_SRC_FILES := $(iperf_SOURCES)
LOCAL_CFLAGS += -pie -fPIE 
LOCAL_LDFLAGS := -pie -fPIE 

LOCAL_C_INCLUDES += /
$(LOCAL_PATH) /
$(LOCAL_PATH)/include

LOCAL_LDLIBS += -lpthread
LOCAL_SHARED_LIBRARIES := libc libm libcutils libnetutils

include $(BUILD_EXECUTABLE)
  1. 先生成需要的头文件
    ./configure –host=arm
  2. 部分代码需修改下
    将 external/testtools/iperf/src/Listener.cpp:382 行改成:
    mreq.ipv6mr_ifindex = 0;
    把 compact/signal.c 里面的 #include “util.h”
    改成 #include “../include/util.h”
    把 src/sockets.c 里面的 #include “util.h”
    改成 #include “../include/util.h”
  3. 编译
    cd Adroid_root
    source build/envsetup.sh
    mmm external/iperf-2.0.4
  4. 目标文件
    在 Android_root/build/out/target/product/generic/symbols/system/bin/ 目录下就可以看到你刚才编译生成的android的执行文件iperf 了.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值