1 .移植准备
1 ,源代码地址:
2 ,解压到 Adroid_root/external/ iperf-2.0.4.tar.gz;
tar –zxvf iperf-2.0.4.tar.gz
2.
创建 Android.mk
cat Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := /
compat/Thread.c /
compat/error.c /
compat/delay.cpp /
compat/gettimeofday.c /
compat/inet_ntop.c /
compat/inet_pton.c /
compat/signal.c /
compat/snprintf.c /
compat/string.c
LOCAL_SRC_FILES += /
src/Client.cpp /
src/Extractor.c /
src/Launch.cpp /
src/List.cpp /
src/Listener.cpp /
src/Locale.c /
src/PerfSocket.cpp /
src/ReportCSV.c /
src/ReportDefault.c /
src/Reporter.c /
src/Server.cpp /
src/Settings.cpp /
src/SocketAddr.c /
src/main.cpp /
src/sockets.c /
src/stdio.c /
src/tcp_window_size.c /
src/gnu_getopt.c /
src/gnu_getopt_long.c /
src/service.c
LOCAL_C_INCLUDES += /
$(LOCAL_PATH) /
$(LOCAL_PATH)/include
LOCAL_CFLAGS += -O2
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_LDLIBS += -lpthread
LOCAL_SHARED_LIBRARIES := libc libm libcutils libnetutils
LOCAL_MODULE := iperf
#LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
#LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
#LOCAL_MODULE_TAGS := eng user
include $(BUILD_EXECUTABLE)
3.
先生成需要的头文件
./configure –host=arm
4.
代码修改
将 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”
5.
编译
$cd Adroid_root
$source build/envsetup.sh
$mmm external/iperf-2.0.4
6.
目标文件
在 Android_root/build/out/target/product/generic/symbols/system/bin/ 目录下就可以看到你刚才编译生成的文件了;这个目录里的文件是带符号信息的,方便调试