在debian上进行了移植,移植的过程:
1.首先在Etherlab EtherCAT Master(https://sourceforge.net/p/etherlabmaster/code/ci/default/tree/)下载了最新的EtherCAT Master放在了自己的目录下。
2.在虚拟机中设置网络为桥接模式
3.参考目录下的INSTALL文件
------------------------------------------
This is the INSTALL file of the IgH EtherCAT Master.
$Id$
vim: set spelllang=en spell tw=78
------------------------------------------
Building and installing
=======================
The complete build and installation procedure is described in the respective
section of the documentation available from http://etherlab.org/en/ethercat.
------------------------------------------
For the impatient: The procedure mainly consists of calling
$ ./boostrap # to create the configure script, if downloaded from the repo
$ ./configure
$ make all modules
... and as root:
# make modules_install install
# depmod
... and linking the init script and copying the sysconfig file from $PREFIX/etc
to the appropriate locations and customizing the sysconfig file.
# ln -s ${PREFIX}/etc/init.d/ethercat /etc/init.d/ethercat
# cp ${PREFIX}/etc/sysconfig/ethercat /etc/sysconfig/ethercat
# vi /etc/sysconfig/ethercat
Make sure, that the 'udev' package is installed, to automatically create the
EtherCAT character devices. The character devices will be created with mode
0660 and group root by default. If you want to give normal users reading
access, create a udev rule like this:
# echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules
Now you can start the EtherCAT master:
# /etc/init.d/ethercat start
Have a look at the examples/ subdirectory for some application examples.
Have fun!
------------------------------------------
解释一下
1../bootstrap 建立configure脚本
2../configure 调用检测程序进行配置,生成规则文件Makefile
3.make all modules 对Makefile进行编译,编译模块
4.sudo su 然后切换到root用户。
5.make modules_install install 安装模块到内核模块路径,配置路径
6.depmod 分析可载入模块的依赖性,插入模块
7.mkdir /etc/sysconfig/
8.cp /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfig/ 拷贝配置文件
9.vi ethercat 修改配置文件,MASTER0_DEVICE="自己的MAC地址",通过ifconfig来获取,我的debian的PATH没有设置正确,在/sbin下直接运行ifconfig。DEVICE_MODULES="generic",保存
10.cp /opt/ethercatlab/etc/init.d/ethercat /etc/init.d/
11.ln -s /opt/etherlab/bin/ethercat /usr/local/bin/ethercat 建立软连接
12.然后,普通用户要建立读取通道,必须设置一条设备管理器的规则,从而创造设备节点。设置规则。
echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules
修改脚本文件/etc/udev/rules.d/99-EtherCAT.rules, KERNEL=="EtherCAT[0-9]*",MODE="0064",GROUP="users"
然后,接上从站,就可以ethercat start
Have fun!