原文: https://www.likecs.com/show-203615906.html
方式1)Windows浏览器输入网址下载:
http://sourceforge.net/projects/linuxptp/files/latest/download
下载后的压缩包拷贝到虚拟机;
![](https://img-blog.csdnimg.cn/img_convert/02ef4c8059d2d59a8d4185f585e8a369.png)
方式2)虚拟机上输入下面的命令下载:
sudo git clone git://git.code.sf.net/p/linuxptp/code linuxptp
2. 安装
1)进入源码目录: cd linuxptp-2.0
2)修改makefile文件:
![](https://img-blog.csdnimg.cn/img_convert/7ccb0c93daef361a7cb726f636ffc532.png)
CC 表示使用的交叉编译工具,这里指定的是你环境变量 .bashrc 文件中设置的交叉编译链;
prefix 表示安装路径,默认是 /usr/local ,我这里修改为: 当前源码路径$(PWD)/bin/linuxptp
3) 编译: make ARCH=arm
表示编译的平台是arm,要用到arm开发板上
4)安装:make install
安装完成后,到源码目录的 /bin/linuxptp 目录下去查看编译生成的可执行文件和说明文档,如下:
![](https://img-blog.csdnimg.cn/img_convert/6b47e4f25d9e9ea0e906e00409405993.png)
![](https://img-blog.csdnimg.cn/img_convert/20b761192be269c2801713598882a992.png)
将生成的 ptp4l 工具拷贝到开发板的 /bin 目录下,在开发板上输入命令查看 ptp4l 的使用:
![](https://img-blog.csdnimg.cn/img_convert/ad797e5ff8b35791035ed89a7f308aa3.png)
3. 其他
可以先使用 ethtool 工具查看网卡是否支持软硬件时间戳。
ethtool -T eth0
![](https://img-blog.csdnimg.cn/img_convert/204e43910e033529ee21045d74b2099a.png)
上边是我的开发板使用的光PHY-KSZ8041,并不支持硬件时间戳。