ethtool編譯與內核實現介紹

ethtool 是用於查詢及設置網卡參數的命令。

使用ethtool需要兩個條件:

1)網卡驅動支持ethtool,實現了ethtool的接口函數

2)用戶控件安裝ethtool可執行程序

 

dwmac驅動已在stmmac_ethtool.c中實現了相關函數,現在我們只需要在編譯ethtool工具,在用戶空間使用即可。

 

 

1. 下載ethtool

https://mirrors.edge.kernel.org/pub/software/network/ethtool/

根據需要、下載相應版本:ethtool-4.15.tar.gz

解壓:tar -zxvf ethtool-4.15.tar.gz

 

 

2. 編譯ethtool

1)./autogen.sh

2)./configure   --host=arm-linux  CC=aarch64-linux-gnu-gcc  LDFLAGS=-static

3)make

編譯生成的ethtool在當前目錄下

 

 

3. 測試

 linux terminal執行:

1)./ethtool --version

2)./ethtool -i eth0

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章