一、编译libpcap
tar xzf libpcap-1.9.0.tar.gz
cd libpcap-1.9.0/
./configure --host=arm-hisiv400-linux --prefix=/usr/local/pcap_arm --with-pcap=linux --disable-shared
make & make install
二、编译ncurses
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
tar xzf ncurses-5.9.tar.gz
cd ncurses-5.9/
./configure --host=arm-hisiv400-linux --prefix=/usr/local/ncurses_arm
make
make install
iftop的代码和ncurses库有点不兼容,需要做两个软链接
cd /usr/local/ncurses_arm/include
ln -s ncurses/curses.h ncurses.h
ln -s ncurses/curses.h curses.h
三、编译iftop
iftop的configure选项只有选择libpcap的路径,没有选择ncurses库路径,只能通过CFLAGS和LDFALGS来指定
wget http://www.ex-parrot.com/pdw/iftop/download/iftop-1.0pre4.tar.gz
tar xzf iftop-1.0pre4.tar.gz
cd iftop-1.0pre4/
./configure CFLAGS="-I/usr/local/ncurses_arm/include" LDFLAGS="-L/usr/local/ncurses_arm/lib" --host=arm-hisiv400-linux --with-libpcap=/usr/local/pcap_arm
make
把编译后的iftop执行文件取出,放在板子上运行,会报错
Error opening terminal: vt100
百度一下找到的解决方案,先查看$TERM、$TERMINFO环境变量的值
echo $TERM
vt100
echo $TERMINFO
$TERMINFO为空,就是没有指定terminfo文件路径。我们指定一个
export TERMINFO=/usr/share/terminfo
从一台ubuntu上面,把正常的terminfo配置拷贝过来。ubuntu的terminfo位于/lib/terminfo
另外,编译ethtool的方法
wget https://mirrors.edge.kernel.org/pub/software/network/ethtool/ethtool-3.18.tar.gz
tar xzf ethtool-3.18.tar.gz
cd ethtool-3.18/
./configure --host=arm-hisiv400-linux
网友评论