编译arm平台的ethtool

来源:互联网 发布:linux shell写while 编辑:程序博客网 时间:2024/05/22 08:16

<iframe id="BAIDU_SSP__wrapper_u653336_0_iframe" src="http://pos.baidu.com/kcjm?rdid=653336&amp;dc=2&amp;di=u653336&amp;dri=0&amp;dis=0&amp;dai=1&amp;ps=236x405&amp;dcb=BAIDU_SSP_define&amp;dtm=HTML_POST&amp;dvi=0.0&amp;dci=-1&amp;dpt=none&amp;tsr=0&amp;tpr=1472707969300&amp;ti=%E7%BC%96%E8%AF%91arm%E5%B9%B3%E5%8F%B0%E7%9A%84ethtool_%E5%91%B5%E5%91%B5%E5%91%B5%E5%91%B5%E5%91%B5&amp;ari=2&amp;dbv=2&amp;drs=1&amp;pcs=1920x1011&amp;pss=1920x236&amp;cfv=22&amp;cpl=29&amp;chi=1&amp;cce=true&amp;cec=UTF-8&amp;tlm=1472679169&amp;rw=1011&amp;ltu=http%3A%2F%2Fwww.hehehehehe.cn%2Fi%2F570.html&amp;ltr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3D_JYKKLotPxhznp7axJwwVGYzHjJA2gzC_kwBNlgo0ULC7LDYwPRljh3HWceWCYLQ%26wd%3D%26eqid%3Ddbaa5231000013b40000000657c7bd71&amp;ecd=1&amp;psr=1920x1200&amp;par=1920x1160&amp;pis=-1x-1&amp;ccd=32&amp;cja=true&amp;cmi=48&amp;col=zh-CN&amp;cdo=-1&amp;tcn=1472707969&amp;qn=2738fe5910c5ebf7&amp;tt=1472707969284.16.94.110" width="120" height="270" align="center,center" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="box-sizing: border-box; border-width: 0px; vertical-align: bottom; margin: 0px;"></iframe>
关闭

1.下载ethtool源代码
git clone git://git.kernel.org/pub/scm/network/ethtool/ethtool.git
2.准备交叉编译工具
可以从codesoucery下载
3.编译
假设目标机器的规格如下:
ABI: EABI version 4
little endian
armv5te

按如下顺序运行:
./autogen.sh
./configure CC=CROSS-COMPILER PATH CFLAGS=-march=armv5te --host=arm-xx-linux

或者 cat /proc/cpuinfo 查看mcpu属性或march属性,添加对应configure属性

./configure CC=CROSS-COMPILER CFLAGS=-mcpu=cortex-a7 --host=arm-xx-linux



如果需要静态编译则
打开vim Makefile 在CC= CROSS-COMPILER后面加上--static
保存
make

就在当前文件夹内生成一个可执行文件ethtool
确认编译后的文件
readelf -h ethtool
确认以下信息(具体内容要看自己的配置了)
OS/ABI UNIX - System V
Machine :ARM
Flags Version4 EABI


命令描述:

ethtool 是用于查询及设置网卡参数的命令。

使用概要:
ethtool ethx       //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0、eth1等等
ethtool –h        //显示ethtool的命令帮助(help)
ethtool –i ethX    //查询ethX网口的相关信息 
ethtool –d ethX    //查询ethX网口注册性信息
ethtool –r ethX    //重置ethX网口到自适应模式
ethtool –S ethX    //查询ethX网口收发包统计
ethtool –s ethX [speed 10|100|1000] [duplex half|full]  [autoneg on|off]        //设置网口速率10/100/1000M、设置网口半/全双工、设置网口是否自协商


0 0
原创粉丝点击