下载源码包iperf-2.0.13.tar.gz解压
$ tar -vxf iperf-2.0.13.tar.gz
$ cd iperf-2.0.13/
配置交叉编译器(根据交错编译器的安装位置进行更改)。
$ PATH=${PATH}:/usr/local/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin
$ ./configure --host=arm-linux-gnueabihf
文件系统里暂时没有c++的标准库,所以静态编译
$ vim src/Makefile
修改iperf_LDFLAGS = -O2 -pthread -DHAVE_CONFIG_H
为iperf_LDFLAGS = -static -O2 -pthread -DHAVE_CONFIG_H
编译安装
$ make $ make install
在src目录下生成可执行文件
$ file iperf
iperf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.31, BuildID[sha1]=c4fd446042378d172ee93e47fd7705bf230df97f, with debug_info, not stripped
服务器端执行
$ iperf -s
客户端执行
./iperf -c 192.168.1.105 -p 5001 -t 40 -i 2