【LinuxCNC开发序列教程一】Ubuntu环境下安装Ethercat主站

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guimotion/article/details/86652304

     老朋友们,本序列教程用于Linuxcnc开发实际遇到的问题。更多的用于命令记录,希望对后面的朋友少找点弯路。

系统:Ubuntu 12 LTS

内核:3.4.9-rtai-686-pae

    1、下载etherlabmaster主站代码并配置代码

命令:hg clone http://hg.code.sf.net/p/etherlabmaster/code etherlabmaster-code

命令:./bootstrap

gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ hg clone http://hg.code.sf.net/p/etherlabmaster/code etherlabmaster-code
程序“hg”尚未安装。  您可以使用以下命令安装:
sudo apt-get install mercurial
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ sudo apt-get install mercurial[sudo] password for gemc2: 
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会安装下列额外的软件包:
  mercurial-common
建议安装的软件包:
  qct vim emacs kdiff3 tkdiff meld xxdiff python-mysqldb python-pygments
下列【新】软件包将被安装:
  mercurial mercurial-common
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 1,987 kB 的软件包。
解压缩后会消耗掉 6,693 kB 的额外空间。
您希望继续执行吗?[Y/n]y
获取:1 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/universe mercurial-common all 2.0.2-1ubuntu1.2 [1,949 kB]
获取:2 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/universe mercurial i386 2.0.2-1ubuntu1.2 [37.7 kB]
下载 1,987 kB,耗时 18秒 (108 kB/s)                                      
Selecting previously unselected package mercurial-common.
(正在读取数据库 ... 系统当前共安装有 195761 个文件和目录。)
正在解压缩 mercurial-common (从 .../mercurial-common_2.0.2-1ubuntu1.2_all.deb) ...
Selecting previously unselected package mercurial.
正在解压缩 mercurial (从 .../mercurial_2.0.2-1ubuntu1.2_i386.deb) ...
正在处理用于 man-db 的触发器...
正在设置 mercurial-common (2.0.2-1ubuntu1.2) ...
正在设置 mercurial (2.0.2-1ubuntu1.2) ...

Creating config file /etc/mercurial/hgrc.d/hgext.rc with new version
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ hg clone http://hg.code.sf.net/p/etherlabmaster/code etherlabmaster-code
正在请求全部修改
正在增加修改集
正在增加清单
正在增加文件改变
已增加 2722 个修改集,包含 10312 个改变,修改了 1664 个文件 (+4 heads)
updating to branch default
1116 files updated, 0 files merged, 0 files removed, 0 files unresolved
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ ls
etherlabmaster-code
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ cd etherlabmaster-code/
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ ls
AUTHORS          devices           globals.h  Makefile.am  TODO
bootstrap        documentation     include    master       tool
CodingStyle.txt  Doxyfile.in       INSTALL    NEWS         tty
configure.ac     ethercat.spec.in  Kbuild.in  README
COPYING          examples          lib        README.EoE
COPYING.LESSER   FEATURES          m4         script
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ ./boostrapbash: ./boostrap: 没有那个文件或目录
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ ./boostrapbash: ./boostrap: 没有那个文件或目录
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ ./bootstrap 
+ touch ChangeLog
+ autoreconf -i
./bootstrap: 行 36: autoreconf: 未找到命令
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ 
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ 
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ 
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ sudo suroot@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# sudo apt-get install autoconf
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会安装下列额外的软件包:
  automake autotools-dev m4
建议安装的软件包:
  autoconf2.13 autoconf-archive gnu-standards autoconf-doc libtool
  gettext
下列【新】软件包将被安装:
  autoconf automake autotools-dev m4
升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 1,369 kB 的软件包。
解压缩后会消耗掉 4,023 kB 的额外空间。
您希望继续执行吗?[Y/n]y
获取:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main m4 i386 1.4.16-2ubuntu1 [195 kB]
获取:2 http://cn.archive.ubuntu.com/ubuntu/ precise/main autoconf all 2.68-1ubuntu2 [560 kB]
获取:3 http://cn.archive.ubuntu.com/ubuntu/ precise/main autoconf all 2.68-1ubuntu2 [560 kB]
获取:4 http://cn.archive.ubuntu.com/ubuntu/ precise/main autoconf all 2.68-1ubuntu2 [560 kB]
获取:5 http://cn.archive.ubuntu.com/ubuntu/ precise/main autotools-dev all 20120210.1ubuntu1 [42.4 kB]
获取:6 http://cn.archive.ubuntu.com/ubuntu/ precise/main autotools-dev all 20120210.1ubuntu1 [42.4 kB]
获取:7 http://cn.archive.ubuntu.com/ubuntu/ precise/main automake all 1:1.11.3-1ubuntu2 [571 kB]
获取:8 http://cn.archive.ubuntu.com/ubuntu/ precise/main automake all 1:1.11.3-1ubuntu2 [571 kB]
下载 1,026 kB,耗时 16分 53秒 (1,011 B/s)                                
Selecting previously unselected package m4.
(正在读取数据库 ... 系统当前共安装有 196372 个文件和目录。)
正在解压缩 m4 (从 .../m4_1.4.16-2ubuntu1_i386.deb) ...
Selecting previously unselected package autoconf.
正在解压缩 autoconf (从 .../autoconf_2.68-1ubuntu2_all.deb) ...
Selecting previously unselected package autotools-dev.
正在解压缩 autotools-dev (从 .../autotools-dev_20120210.1ubuntu1_all.deb) ...
Selecting previously unselected package automake.
正在解压缩 automake (从 .../automake_1%3a1.11.3-1ubuntu2_all.deb) ...
正在处理用于 install-info 的触发器...
正在处理用于 man-db 的触发器...
正在处理用于 doc-base 的触发器...
Processing 1 added doc-base file...
正在设置 m4 (1.4.16-2ubuntu1) ...
正在设置 autoconf (2.68-1ubuntu2) ...
正在设置 autotools-dev (20120210.1ubuntu1) ...
正在设置 automake (1:1.11.3-1ubuntu2) ...
update-alternatives: 使用 /usr/bin/automake-1.11 来提供 /usr/bin/automake (automake),于 自动模式 中。
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# 
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# 
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ./boostrap
bash: ./boostrap: 没有那个文件或目录
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ls
AUTHORS          COPYING         ethercat.spec.in  INSTALL      master      TODO
bootstrap        COPYING.LESSER  examples          Kbuild.in    NEWS        tool
ChangeLog        devices         FEATURES          lib          README      tty
CodingStyle.txt  documentation   globals.h         m4           README.EoE
configure.ac     Doxyfile.in     include           Makefile.am  script
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ./bootstrap + touch ChangeLog
+ autoreconf -i
Can't exec "libtoolize": 没有那个文件或目录 at /usr/bin/autoreconf line 196.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 196.
configure.ac:57: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# sudo apt-get install build-essential libtool
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会安装下列额外的软件包:
  dpkg-dev fakeroot g++ g++-4.6 libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libdpkg-perl libltdl-dev libstdc++6-4.6-dev
  libtimedate-perl
建议安装的软件包:
  debian-keyring g++-multilib g++-4.6-multilib gcc-4.6-doc libstdc++6-4.6-dbg
  libtool-doc libstdc++6-4.6-doc gfortran fortran95-compiler gcj
下列【新】软件包将被安装:
  build-essential dpkg-dev fakeroot g++ g++-4.6 libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libltdl-dev
  libstdc++6-4.6-dev libtimedate-perl libtool
升级了 0 个软件包,新安装了 13 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 9,755 kB 的软件包。
解压缩后会消耗掉 29.8 MB 的额外空间。
您希望继续执行吗?[Y/n]y
获取:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main libstdc++6-4.6-dev i386 4.6.3-1ubuntu5 [1,643 kB]
2% [1 libstdc++6-4.6-dev 184 kB/1,643 kB 11%]                                       
获取:2 http://cn.archive.ubuntu.com/ubuntu/ precise/main g++-4.6 i386 4.6.3-1ubuntu5 [6,745 kB]
获取:3 http://cn.archive.ubuntu.com/ubuntu/ precise/main g++ i386 4:4.6.3-1ubuntu5 [1,444 B]
获取:4 http://cn.archive.ubuntu.com/ubuntu/ precise/main libtimedate-perl all 1.2000-1 [41.6 kB]
获取:5 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main libdpkg-perl all 1.16.1.2ubuntu7.8 [181 kB]
获取:6 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main dpkg-dev all 1.16.1.2ubuntu7.8 [468 kB]
获取:7 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main build-essential i386 11.5ubuntu2.1 [5,796 B]
获取:8 http://cn.archive.ubuntu.com/ubuntu/ precise/main fakeroot i386 1.18.2-1 [87.9 kB]
获取:9 http://cn.archive.ubuntu.com/ubuntu/ precise/main libalgorithm-diff-perl all 1.19.02-2 [50.7 kB]
获取:10 http://cn.archive.ubuntu.com/ubuntu/ precise/main libalgorithm-diff-xs-perl i386 0.04-2build2 [12.9 kB]
获取:11 http://cn.archive.ubuntu.com/ubuntu/ precise/main libalgorithm-merge-perl all 0.08-2 [12.7 kB]
获取:12 http://cn.archive.ubuntu.com/ubuntu/ precise/main libltdl-dev i386 2.4.2-1ubuntu1 [203 kB]
获取:13 http://cn.archive.ubuntu.com/ubuntu/ precise/main libtool i386 2.4.2-1ubuntu1 [302 kB]
下载 9,755 kB,耗时 5分 55秒 (27.4 kB/s)                                            
Selecting previously unselected package libstdc++6-4.6-dev.
(正在读取数据库 ... 系统当前共安装有 196660 个文件和目录。)
正在解压缩 libstdc++6-4.6-dev (从 .../libstdc++6-4.6-dev_4.6.3-1ubuntu5_i386.deb) ...
Selecting previously unselected package g++-4.6.
正在解压缩 g++-4.6 (从 .../g++-4.6_4.6.3-1ubuntu5_i386.deb) ...
Selecting previously unselected package g++.
正在解压缩 g++ (从 .../g++_4%3a4.6.3-1ubuntu5_i386.deb) ...
Selecting previously unselected package libtimedate-perl.
正在解压缩 libtimedate-perl (从 .../libtimedate-perl_1.2000-1_all.deb) ...
Selecting previously unselected package libdpkg-perl.
正在解压缩 libdpkg-perl (从 .../libdpkg-perl_1.16.1.2ubuntu7.8_all.deb) ...
Selecting previously unselected package dpkg-dev.
正在解压缩 dpkg-dev (从 .../dpkg-dev_1.16.1.2ubuntu7.8_all.deb) ...
Selecting previously unselected package build-essential.
正在解压缩 build-essential (从 .../build-essential_11.5ubuntu2.1_i386.deb) ...
Selecting previously unselected package fakeroot.
正在解压缩 fakeroot (从 .../fakeroot_1.18.2-1_i386.deb) ...
Selecting previously unselected package libalgorithm-diff-perl.
正在解压缩 libalgorithm-diff-perl (从 .../libalgorithm-diff-perl_1.19.02-2_all.deb) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
正在解压缩 libalgorithm-diff-xs-perl (从 .../libalgorithm-diff-xs-perl_0.04-2build2_i386.deb) ...
Selecting previously unselected package libalgorithm-merge-perl.
正在解压缩 libalgorithm-merge-perl (从 .../libalgorithm-merge-perl_0.08-2_all.deb) ...
Selecting previously unselected package libltdl-dev.
正在解压缩 libltdl-dev (从 .../libltdl-dev_2.4.2-1ubuntu1_i386.deb) ...
Selecting previously unselected package libtool.
正在解压缩 libtool (从 .../libtool_2.4.2-1ubuntu1_i386.deb) ...
正在处理用于 man-db 的触发器...
正在设置 libtimedate-perl (1.2000-1) ...
正在设置 libdpkg-perl (1.16.1.2ubuntu7.8) ...
正在设置 dpkg-dev (1.16.1.2ubuntu7.8) ...
正在设置 fakeroot (1.18.2-1) ...
update-alternatives: 使用 /usr/bin/fakeroot-sysv 来提供 /usr/bin/fakeroot (fakeroot),于 自动模式 中。
正在设置 libalgorithm-diff-perl (1.19.02-2) ...
正在设置 libalgorithm-diff-xs-perl (0.04-2build2) ...
正在设置 libalgorithm-merge-perl (0.08-2) ...
正在设置 libltdl-dev (2.4.2-1ubuntu1) ...
正在设置 libtool (2.4.2-1ubuntu1) ...
正在设置 libstdc++6-4.6-dev (4.6.3-1ubuntu5) ...
正在设置 g++-4.6 (4.6.3-1ubuntu5) ...
正在设置 g++ (4:4.6.3-1ubuntu5) ...
update-alternatives: 使用 /usr/bin/g++ 来提供 /usr/bin/c++ (c++),于 自动模式 中。
正在设置 build-essential (11.5ubuntu2.1) ...
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ls
aclocal.m4      CodingStyle.txt  documentation     include      master      tool
AUTHORS         configure        Doxyfile.in       INSTALL      NEWS        tty
autoconf        configure.ac     ethercat.spec.in  Kbuild.in    README
autom4te.cache  COPYING          examples          lib          README.EoE
bootstrap       COPYING.LESSER   FEATURES          m4           script
ChangeLog       devices          globals.h         Makefile.am  TODO
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ./bootstrap + touch ChangeLog
+ autoreconf -i
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `autoconf'.
libtoolize: copying file `autoconf/config.guess'
libtoolize: copying file `autoconf/config.sub'
libtoolize: copying file `autoconf/install-sh'
libtoolize: copying file `autoconf/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:55: installing `autoconf/ar-lib'
configure.ac:54: installing `autoconf/compile'
configure.ac:44: installing `autoconf/missing'
examples/dc_user/Makefile.am: installing `autoconf/depcomp'
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# 

    2、配置源码

命令:./configure

root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking for ar... ar
checking the archiver (ar) interface... ar
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i686-pc-linux-gnu file names to i686-pc-linux-gnu format... func_convert_file_noop
checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether to build kernel modules... yes
checking for Linux kernel sources... /usr/src/linux-headers-3.4-9-rtai-686-pae (Kernel 3.4)
checking for Linux modules installation directory... ethercat
checking for kernel for 8139too driver... 3.4
checking whether to build the CCAT driver... no
checking for RTAI path... not specified.
checking for Xenomai path... not specified.
checking whether to build RTDM interface... no
checking whether to build the debug interface... no
checking whether to build the debug ring... no
checking whether to build with EoE support... yes
checking whether to use the CPU timestamp counter... no
checking whether to use high-resolution timers for scheduling... no
checking whether to read alias addresses from registers... no
checking whether to force the reference clock to OP... no
checking whether to build the command-line tool... yes
checking whether to build the userspace library... yes
checking whether to build the tty driver... no
checking whether to allow identification wildcards... no
checking for number of Ethernet devices... 1 (Redundancy disabled)
checking whether to assign the SII to PDI... no
checking whether to syslog in realtime context... yes
checking whether to use loop control registers... no
configure: creating ./config.status
config.status: creating Doxyfile
config.status: creating Kbuild
config.status: creating Makefile
config.status: creating devices/Kbuild
config.status: creating devices/Makefile
config.status: creating devices/ccat/Kbuild
config.status: creating devices/ccat/Makefile
config.status: creating devices/e1000/Kbuild
config.status: creating devices/e1000/Makefile
config.status: creating devices/e1000e/Kbuild
config.status: creating devices/e1000e/Makefile
config.status: creating ethercat.spec
config.status: creating examples/Kbuild
config.status: creating examples/Makefile
config.status: creating examples/dc_rtai/Kbuild
config.status: creating examples/dc_rtai/Makefile
config.status: creating examples/dc_user/Makefile
config.status: creating examples/mini/Kbuild
config.status: creating examples/mini/Makefile
config.status: creating examples/rtai/Kbuild
config.status: creating examples/rtai/Makefile
config.status: creating examples/rtai_rtdm/Makefile
config.status: creating examples/rtai_rtdm_dc/Makefile
config.status: creating examples/tty/Kbuild
config.status: creating examples/tty/Makefile
config.status: creating examples/user/Makefile
config.status: creating examples/xenomai/Makefile
config.status: creating examples/xenomai_posix/Makefile
config.status: creating include/Makefile
config.status: creating lib/Makefile
config.status: creating m4/Makefile
config.status: creating master/Kbuild
config.status: creating master/Makefile
config.status: creating script/Makefile
config.status: creating script/ethercat.service
config.status: creating script/ethercatctl
config.status: creating script/init.d/Makefile
config.status: creating script/init.d/ethercat
config.status: creating script/sysconfig/Makefile
config.status: creating tool/Makefile
config.status: creating tty/Kbuild
config.status: creating tty/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# 

3、配置所有模块

命令:make all modules

 4、模块安装

命令:make modules_install install

root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# make modules_install install
make -C "/usr/src/linux-headers-3.4-9-rtai-686-pae" M="/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code" \
		INSTALL_MOD_DIR="ethercat" modules_install
make[1]: 正在进入目录 `/usr/src/linux-headers-3.4-9-rtai-686-pae'
  INSTALL /home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/ec_8139too.ko
  INSTALL /home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/ec_generic.ko
  INSTALL /home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/mini/ec_mini.ko
  INSTALL /home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/master/ec_master.ko
  DEPMOD  3.4-9-rtai-686-pae
make[1]:正在离开目录 `/usr/src/linux-headers-3.4-9-rtai-686-pae'
make  install-recursive
make[1]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code'
Making install in include
make[2]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/include'
make[3]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/include'
make[3]: 没有什么可以做的为 `install-exec-am'。
test -z "/opt/etherlab/include" || /bin/mkdir -p "/opt/etherlab/include"
 /usr/bin/install -c -m 644 ecrt.h ectty.h '/opt/etherlab/include'
make[3]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/include'
make[2]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/include'
Making install in script
make[2]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script'
make  install-recursive
make[3]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script'
Making install in init.d
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/init.d'
make  install-am
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/init.d'
make[6]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/init.d'
make[6]: 没有什么可以做的为 `install-exec-am'。
test -z "/opt/etherlab/etc/init.d" || /bin/mkdir -p "/opt/etherlab/etc/init.d"
 /usr/bin/install -c ethercat '/opt/etherlab/etc/init.d'
make[6]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/init.d'
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/init.d'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/init.d'
Making install in sysconfig
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/sysconfig'
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/sysconfig'
make[5]: 没有什么可以做的为 `install-exec-am'。
test -z "/opt/etherlab/etc/sysconfig" || /bin/mkdir -p "/opt/etherlab/etc/sysconfig"
 /usr/bin/install -c -m 644 ethercat '/opt/etherlab/etc/sysconfig'
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/sysconfig'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script/sysconfig'
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script'
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script'
test -z "/opt/etherlab/etc" || /bin/mkdir -p "/opt/etherlab/etc"
 /usr/bin/install -c -m 644 ethercat.conf '/opt/etherlab/etc'
test -z "/opt/etherlab/sbin" || /bin/mkdir -p "/opt/etherlab/sbin"
 /usr/bin/install -c ethercatctl '/opt/etherlab/sbin'
test -z "/opt/etherlab/lib/systemd/system" || /bin/mkdir -p "/opt/etherlab/lib/systemd/system"
 /usr/bin/install -c -m 644 ethercat.service '/opt/etherlab/lib/systemd/system'
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script'
make[3]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script'
make[2]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/script'
Making install in devices
make[2]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices'
make  install-recursive
make[3]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices'
Making install in ccat
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/ccat'
make  install-am
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/ccat'
make[6]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/ccat'
make[6]: 没有什么可以做的为 `install-exec-am'。
make[6]: 没有什么可以做的为 `install-data-am'。
make[6]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/ccat'
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/ccat'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/ccat'
Making install in e1000
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000'
make  install-am
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000'
make[6]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000'
make[6]: 没有什么可以做的为 `install-exec-am'。
make[6]: 没有什么可以做的为 `install-data-am'。
make[6]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000'
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000'
Making install in e1000e
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000e'
make  install-am
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000e'
make[6]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000e'
make[6]: 没有什么可以做的为 `install-exec-am'。
make[6]: 没有什么可以做的为 `install-data-am'。
make[6]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000e'
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000e'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices/e1000e'
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices'
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices'
make[5]: 没有什么可以做的为 `install-exec-am'。
make[5]: 没有什么可以做的为 `install-data-am'。
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices'
make[3]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices'
make[2]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/devices'
Making install in master
make[2]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/master'
make  install-am
make[3]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/master'
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/master'
make[4]: 没有什么可以做的为 `install-exec-am'。
make[4]: 没有什么可以做的为 `install-data-am'。
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/master'
make[3]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/master'
make[2]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/master'
Making install in tool
make[2]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/tool'
/bin/bash ../libtool --tag=CXX   --mode=link g++ -I../include -I../master -Wall -DREV=`if test -s ../revision; then cat ../revision; else hg id -i .. 2>/dev/null || echo "unknown"; fi` -fno-strict-aliasing -g -O2   -o ethercat ../master/soe_errors.o ethercat-Command.o ethercat-CommandAlias.o ethercat-CommandCrc.o ethercat-CommandCStruct.o ethercat-CommandConfig.o ethercat-CommandData.o ethercat-CommandDebug.o ethercat-CommandDomains.o ethercat-CommandDownload.o ethercat-CommandFoeRead.o ethercat-CommandFoeWrite.o ethercat-CommandGraph.o ethercat-CommandIp.o ethercat-CommandMaster.o ethercat-CommandPdos.o ethercat-CommandRegRead.o ethercat-CommandRegWrite.o ethercat-CommandRescan.o ethercat-CommandSdos.o ethercat-CommandSiiRead.o ethercat-CommandSiiWrite.o ethercat-CommandSlaves.o ethercat-CommandSoeRead.o ethercat-CommandSoeWrite.o ethercat-CommandStates.o ethercat-CommandUpload.o ethercat-CommandVersion.o ethercat-CommandXml.o ethercat-DataTypeHandler.o ethercat-FoeCommand.o ethercat-MasterDevice.o ethercat-NumberListParser.o ethercat-SdoCommand.o ethercat-SoeCommand.o ethercat-main.o ethercat-sii_crc.o ethercat-CommandEoe.o  
libtool: link: g++ -I../include -I../master -Wall -DREV=33b922ec1871 -fno-strict-aliasing -g -O2 -o ethercat ../master/soe_errors.o ethercat-Command.o ethercat-CommandAlias.o ethercat-CommandCrc.o ethercat-CommandCStruct.o ethercat-CommandConfig.o ethercat-CommandData.o ethercat-CommandDebug.o ethercat-CommandDomains.o ethercat-CommandDownload.o ethercat-CommandFoeRead.o ethercat-CommandFoeWrite.o ethercat-CommandGraph.o ethercat-CommandIp.o ethercat-CommandMaster.o ethercat-CommandPdos.o ethercat-CommandRegRead.o ethercat-CommandRegWrite.o ethercat-CommandRescan.o ethercat-CommandSdos.o ethercat-CommandSiiRead.o ethercat-CommandSiiWrite.o ethercat-CommandSlaves.o ethercat-CommandSoeRead.o ethercat-CommandSoeWrite.o ethercat-CommandStates.o ethercat-CommandUpload.o ethercat-CommandVersion.o ethercat-CommandXml.o ethercat-DataTypeHandler.o ethercat-FoeCommand.o ethercat-MasterDevice.o ethercat-NumberListParser.o ethercat-SdoCommand.o ethercat-SoeCommand.o ethercat-main.o ethercat-sii_crc.o ethercat-CommandEoe.o 
make[3]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/tool'
test -z "/opt/etherlab/bin" || /bin/mkdir -p "/opt/etherlab/bin"
  /bin/bash ../libtool   --mode=install /usr/bin/install -c ethercat '/opt/etherlab/bin'
libtool: install: /usr/bin/install -c ethercat /opt/etherlab/bin/ethercat
make[3]: 没有什么可以做的为 `install-data-am'。
make[3]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/tool'
make[2]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/tool'
Making install in lib
make[2]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/lib'
make[3]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/lib'
test -z "/opt/etherlab/lib" || /bin/mkdir -p "/opt/etherlab/lib"
 /bin/bash ../libtool   --mode=install /usr/bin/install -c   libethercat.la '/opt/etherlab/lib'
libtool: install: /usr/bin/install -c .libs/libethercat.so.1.0.0 /opt/etherlab/lib/libethercat.so.1.0.0
libtool: install: (cd /opt/etherlab/lib && { ln -s -f libethercat.so.1.0.0 libethercat.so.1 || { rm -f libethercat.so.1 && ln -s libethercat.so.1.0.0 libethercat.so.1; }; })
libtool: install: (cd /opt/etherlab/lib && { ln -s -f libethercat.so.1.0.0 libethercat.so || { rm -f libethercat.so && ln -s libethercat.so.1.0.0 libethercat.so; }; })
libtool: install: /usr/bin/install -c .libs/libethercat.lai /opt/etherlab/lib/libethercat.la
libtool: install: /usr/bin/install -c .libs/libethercat.a /opt/etherlab/lib/libethercat.a
libtool: install: chmod 644 /opt/etherlab/lib/libethercat.a
libtool: install: ranlib /opt/etherlab/lib/libethercat.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/sbin" ldconfig -n /opt/etherlab/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /opt/etherlab/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[3]: 没有什么可以做的为 `install-data-am'。
make[3]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/lib'
make[2]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/lib'
Making install in examples
make[2]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples'
make  install-recursive
make[3]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples'
Making install in dc_user
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/dc_user'
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/dc_user'
make[5]: 没有什么可以做的为 `install-exec-am'。
make[5]: 没有什么可以做的为 `install-data-am'。
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/dc_user'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/dc_user'
Making install in user
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/user'
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/user'
make[5]: 没有什么可以做的为 `install-exec-am'。
make[5]: 没有什么可以做的为 `install-data-am'。
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/user'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples/user'
make[4]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples'
make[5]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples'
make[5]: 没有什么可以做的为 `install-exec-am'。
make[5]: 没有什么可以做的为 `install-data-am'。
make[5]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples'
make[4]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples'
make[3]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples'
make[2]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code/examples'
make[2]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code'
make[3]: 正在进入目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code'
make[3]: 没有什么可以做的为 `install-exec-am'。
make[3]: 没有什么可以做的为 `install-data-am'。
make[3]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code'
make[2]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code'
make[1]:正在离开目录 `/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code'
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# 

 5、分析

命令:depmod

6、配置网卡

命令:ln -s ${PREFIX}/etc/init.d/ethercat /etc/init.d/ethercat

ln -s /opt/etherlab/etc/init.d/ethercat /etc/init.d/ethercat

命令:cp ${PREFIX}/etc/sysconfig/ethercat /etc/sysconfig/ethercat

cp /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfig/ethercat

注解:PREFIX =>cd /opt/etherlab/

命令:sudo gedit /etc/sysconfig/ethercat

注解:

    ./bootstrap 建立configure脚本
    ./configure 调用检测程序进行配置,生成规则文件Makefile
    make all modules 对Makefile进行编译,编译模块
    sudo su 然后切换到root用户。
    make modules_install install 安装模块到内核模块路径,配置路径
    depmod 分析可载入模块的依赖性,插入模块
    mkdir /etc/sysconfig/
    cp /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfig/ 拷贝配置文件
    vi ethercat 修改配置文件,MASTER0_DEVICE="自己的MAC地址",通过ifconfig来获取,我的debian的PATH没有设置正确,在/sbin下直接运行ifconfig。DEVICE_MODULES="generic",保存
    cp /opt/ethercatlab/etc/init.d/ethercat /etc/init.d/
    ln -s /opt/etherlab/bin/ethercat /usr/local/bin/ethercat 建立软连接 
    然后,普通用户要建立读取通道,必须设置一条设备管理器的规则,从而创造设备节点。设置规则。
echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules

本章查找引用了一些其他用户博客,在此对他们付出作声感谢。

祝福大家愉快Happy...

猜你喜欢

转载自blog.csdn.net/guimotion/article/details/86652304
今日推荐