移植到ARM开发板上一直报错,现在移植到PC端试试水。
ubuntu18.04 内核版本5.4.10-rt5
步骤:
一、源码下载编译
git clone http://gitlab.com/etherlab.org/ethercat.git
./bootstrap
#--with-linux-dir是指定安装的linux内核目录 可以打开configure查看详细配置项
./configure --prefix=/home/fc/test/pc/ethercat/output --enable-eoe=no --enable-8139too=no --enable-generic=yes --enable-rtmutex --enable-cycles=yes --enable-hrtimer
make
make all modules
sudo make modules_install install
sudo depmod
二、创建链接安装
sudo ln -fs /home/fc/test/pc/ethercat/output/etc/init.d/ethercat /etc/init.d
sudo mkdir /etc/sysconfig
sudo ln -fs /home/fc/test/pc/ethercat/output/etc/sysconfig/ethercat /etc/sysconfig/
sudo ln -fs /home/fc/test/pc/ethercat/output/bin/ethercat /bin/
sudo -i
echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules
三、网络配置
ifconfig #查询有线网卡的MAC地址
sudo gedit /etc/sysconfig/ethercat
在其中添加MASTER0_DEVICE=”网卡地址“
DEVICE_MODULES=”generic”
四、启动测试
sudo /etc/init.d/ethercat start|stop|restart
显示...done 成功