1 .移植准备
# 在 android-x86-7.1-rc2 中,编译 iperf-3.3 时,fatal error: 'openssl/rsa.h' file not found
# 在 android-x86-7.1-rc2 中,编译 iperf-3.2 时,fatal error: 'openssl/bio.h' file not found
# 因此,使用 iperf-3.1.7
# download iperf3: https://github.com/esnet/iperf
download iperf3: http://downloads.es.net/pub/iperf/
# 复制到 Adroid_root/external
# cd /opt/android-x86/iperf
# scp iperf3.zip 10.109.252.82:/mnt/backup/android-x86-7.1-rc1-mptcp/external/
# cp to android-nougat on IBM Server
# scp -r /opt/android-x86/iperf/iperf-3.3 10.109.252.82:/mnt/vm_ztg_t/paper-8-test-nougat/mim-tcp/external/iperf3
# scp -r /opt/android-x86/iperf/iperf-3.2 10.109.252.82:/mnt/vm_ztg_t/paper-8-test-nougat/mim-tcp/external/iperf3
scp -r /opt/android-x86/iperf/iperf-3.1.7 10.109.252.82:/mnt/vm_ztg_t/paper-8-test-nougat/mim-tcp/external/iperf3
2. 创建 Android.mk
#--------------------------------------------------------------
# cd /mnt/backup/android-x86-7.1-rc1-mptcp
# cd /mnt/vm_ztg_g/paper-8-test-oreo/mim-tcp
cd /mnt/vm_ztg_t/paper-8-test-nougat/mim-tcp
vim external/iperf3/Android.mk
#-------------------------------------------------------------- begin
LOCAL_PATH:=$(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES:=src
LOCAL_SRC_FILES:=
src/cjson.c
src/iperf_api.c
src/iperf_client_api.c
src/iperf_error.c
src/iperf_locale.c
src/iperf_sctp.c
src/iperf_server_api.c
src/iperf_tcp.c
src/iperf_udp.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)
#-------------------------------------------------------------- end
3. 生成需要的头文件, 源文件,比如:tcp_window_size.h, tcp_window_size.c
# cd /mnt/backup/android-x86-7.1-rc1-mptcp/external/iperf3
cd /mnt/vm_ztg_t/paper-8-test-nougat/mim-tcp/external/iperf3
./configure --host=x86_64-android-linux
# 此时,如果 完整编译 Android,m -j32 iso_img, 则不会 包含 iperf3,必须执行 下面的第 4 步。
4. 编译
# cd /mnt/backup/android-x86-7.1-rc1-mptcp/
cd /mnt/vm_ztg_t/paper-8-test-nougat/mim-tcp
. build/envsetup.sh
mmm external/iperf3
5. 生成的目标文件
out/target/product/x86_64/system/xbin/iperf3
# 此时,如果 完整编译 Android,m -j32 iso_img, 则会 包含 iperf3 命令,下面 仅供参考。
cp out/target/product/x86_64/system/xbin/iperf3 /opt/android-x86/tmp-iso-can-del/fep-lib-exe/
6. 复制到 Android
adb kill-server && ifconfig vboxnet0 up && adb connect 192.168.56.3 && adb -s 192.168.56.3 root
adb connect 192.168.56.3
adb shell mount -o remount,rw /
adb push /opt/android-x86/tmp-iso-can-del/fep-lib-exe/iperf3 /system/xbin/