1 .移植准备
# download iperf3: https://github.com/esnet/iperf/tree/670c18584bcf7a285f3561eb7ea38cc53600d0ab
# 复制到 Adroid_root/external
# cd /opt/android-x86/
# scp iperf3.zip 10.109.252.82:/mnt/backup/android-x86-7.1-rc1-mptcp/external/
cd /mnt/backup/android-x86-7.1-rc1-mptcp/external/
unzip iperf3.zip
mv iperf-670c18584bcf7a285f3561eb7ea38cc53600d0ab iperf3
rm iperf3.zip
2. 创建 Android.mk
cd /mnt/backup/android-x86-7.1-rc1-mptcp
vim external/iperf3/Android.mk
#---------------------------------------
LOCAL_PATH:=$(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES:=src
LOCAL_SRC_FILES:=
src/cjson.c
src/iperf_api.c
src/iperf_error.c
src/iperf_client_api.c
src/iperf_locale.c
src/iperf_server_api.c
src/iperf_tcp.c
src/iperf_udp.c
src/iperf_sctp.c
src/iperf_util.c
src/main.c
src/net.c
src/tcp_info.c
src/tcp_window_size.c
src/timer.c
src/units.c
LOCAL_CFLAGS:=-O2 -g
#LOCAL_CFLAGS+=-DLINUX
LOCAL_CFLAGS += -fPIE
# gold in binutils 2.22 will warn about the usage of mktemp
LOCAL_LDFLAGS += -Wl,--no-fatal-warnings
LOCAL_LDFLAGS += -fPIE -pie
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE:=iperf3
include $(BUILD_EXECUTABLE)
#---------------------------------------
3. 生成需要的头文件
cd /mnt/backup/android-x86-7.1-rc1-mptcp/external/iperf3
./configure --host=x86_64-android-linux
4. 编译
cd /mnt/backup/android-x86-7.1-rc1-mptcp/
. build/envsetup.sh
mmm external/iperf3
5. 生成的目标文件
out/target/product/x86_64/system/xbin/iperf3