赞
踩
我是在i9 9900k的主机上编译的linux内核、xenomai以及ethercat igh。生成的文件如下:
接着我是在i5 6600主机上安装编译后的内核,搭建ethercat主站进行测试。
这是我编译好的上述4个文件。
https://rtt-lwr.readthedocs.io/en/latest/rtpc/xenomai3.html
https://rtt-lwr.readthedocs.io/en/latest/rtpc/xenomai.html
https://www.bilibili.com/video/BV1wg4y1z7C2?t=1399
linux内核: 4.9.38 https://mirrors.edge.kernel.org/pub/linux/kernel/
xenomai3.1 https://xenomai.org/downloads/xenomai/stable/
ipipe-core-4.9.38-x86-4.patch https://xenomai.org/downloads/ipipe/v3.x/x86/
ubuntu http://old-releases.ubuntu.com/releases/
ethercat igh https://github.com/ribalda/ethercat
一些安装包
sudo apt-get install build-essential libncurses5-dev bison flex libssl-dev
sudo apt-get install kernel-package
//下面的可以不用安装
$ sudo apt-get install build-essential git-core libncurses5-dev libssl-dev
$ sudo apt-get install flex bison texinfo zip unzip zlib1g-dev gettext
$ sudo apt-get install gperf libsdl-dev libesd0-dev libwxgtk2.6-dev
$ sudo apt-get install uboot-mkimage
$ sudo apt-get install g++ xz-utils
//ubuntu右键打开终端
sudo apt-get install nautilus-open-terminal
更换源 sudo gedit /etc/apt/sources.list //删除原有内容替换为 deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse sudo apt-get update
./scripts/prepare-kernel.sh --linux=/home/vmuser/workspace/linux-4.9.38 \
--ipipe=/home/vmuser/workspace/xenomai-v3.1/ipipe-core-4.9.38-x86-4.patch --arch=x86_64
make menuconfig
> Processor type and features [ ] Linux guest support ---- [ ] Multi-core scheduler support > Power management and ACPI options [ ] Suspend to RAM and standby [ ] Hibernation (aka 'suspend to disk') > Power management and ACPI options > CPU Frequency scaling [ ] CPU Frequency scaling > Power management and ACPI options > ACPI (Advanced Configuration and Power Interface) Support < > Processor > Power management and ACPI options > CPU Idle [ ] CPU idle PM support > Processor type and features [ ] Transparent Hugepage Support [ ] Contiguous Memory Allocator [ ] Allow for memory compaction [ ] Page migration > Xenomai/cobalt > Sizes and static limits (4096) Number of registry slots (4096) Size of system heap (Kb) (256) Size of private heap (Kb) (256) Size of shared heap (Kb) (512) Maximum number of POSIX timers per process > General setup (-xenomai-3.0.5) Local version - append to kernel release > General setup > Timers subsystem [*] High Resolution Timer Support > Xenomai/cobalt > Drivers > RTnet <M> RTnet, TCP/IP socket interface > Xenomai/cobalt > Drivers > RTnet > Drivers
在i9 9900k上编译内核,生成linux-headers-xxx.deb和linux-image-xxx.deb安装包。
sudo apt install kernel-package
//CONCURRENCY_LEVEL=$(nproc) make-kpkg --rootcmd fakeroot --initrd kernel_image kernel_headers
sudo CONCURRENCY_LEVEL=$(nproc) make-kpkg --initrd kernel_image kernel_headers
在i5 6600上安装内核、并进行测试。
//安装内核
sudo dpkg -i linux-headers-4.1.18-xenomai-3.0.5_4.1.18-xenomai-3.0.5-10.00.Custom_amd64.deb
sudo dpkg -i linux-image-4.1.18-xenomai-3.0.5_4.1.18-xenomai-3.0.5-10.00.Custom_amd64.deb
sudo gedit /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="text"
#GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true
sudo update-grub
卸载安装好的内核
dpkg --get-selections|grep linux
apt-get remove linux-image-xxx
apt-get remove linux-headers-xxx
可以在ubuntu系统查看xenomai信息 uname -a # Should return Linux waro-rt 4.9.38-xenomai-3.0.5 #2 SMP Wed Sep 20 16:00:12 CEST 2017 x86_64 x86_64 x86_64 GNU/Linux dmesg | grep Xenomai # [ 1.417024] [Xenomai] scheduling class idle registered. # [ 1.417025] [Xenomai] scheduling class rt registered. # [ 1.417045] [Xenomai] disabling automatic C1E state promotion on Intel processor # [ 1.417055] [Xenomai] SMI-enabled chipset found, but SMI workaround disabled # [ 1.417088] I-pipe: head domain Xenomai registered. # [ 1.417704] [Xenomai] allowing access to group 1234 # [ 1.417726] [Xenomai] Cobalt v3.0.5 (Sisyphus's Boulder) [DEBUG] ********************************************** cd xenomai-3.1 ./script/bootstrap //如果没有configure文件则执行此语句 ./configure --with-core=cobalt --enable-smp --enable-pshared 我执行了这一条 ./configure --with-pic --with-core=cobalt --enable-smp --disable-tls --enable-dlopen-libs ./configure --with-pic --with-core=cobalt --enable-smp --disable-tls --enable-dlopen-libs --disable-clock-monotonic-raw make sudo make install //默认安装在/usr/xenomai
xenomai目录包含如下文件
./bootstrap //如果没有configure文件则执行此语句
./configure --with-linux-dir=/home/vmuser/workspace/linux-4.9.38 \
--enable-generic=yes --enable-8139too=yes --enable-e1000=yes --enable-e1000e=yes --enable-r8169=yes \
--enable-rtdm=yes --enable-cycles=yes --enable-hrtimer=yes --with-xenomai-dir=/usr/xenomai
**********************************************
igh把编译生成的文件默认安装在了/opt/etherlab目录。
通过设置--prefix=/home/vmuser/ethercat-master/output可以把编译生成的文件安装在/home/vmuser/ethercat-master/output目录中。
**********************************************
make
make modules
make install
sudo make modules_install
我在编译igh的8169网卡驱动(4.9版本)时有报错。
打开ethercat/devices/r8169-4.9-ethercat.c,把339行删掉。
如果用其它版本的驱动,没有报错,就不用删了。
编译完成后,生成如下文件
我将这两部分文件copy到了自建的igh文件夹中。
我将编译生成的文件打包成xenomai.tar.gz和igh.tar.gz,然后copy到i5 6600主机进行测试。
我将生成的xenomai.tar.gz文件进行解压,并copy到usr目录。
利用bin目录下的latency 工具进行测试
实时效果并不理想,后续再改吧
将igh.tar.gz文件进行解压,并copy到/opt/etherlab目录。
将igh编译生成的驱动文件放到如下位置
接着输入depmod命令。
这一步参考了igh官方文档的P82页(Installing the Software),文章截图如下:
将/opt/etherlab/etc目录下的sysconfig文件夹copy到/etc目录中,然后修改ethercat文件。
这里主要是对MASTER0_DEVICE="“和DEVICE_MODULES=”"进行了修改。
ln -s /opt/etherlab/etc/init.d/ethercat /etc/init.d 建立软连接
注意ethercat文件中的这部分是否正确
开启主站
# /etc/init.d/ethercat start
重启主站
可以看到主站正常运行,能够扫描到从站的信息。
ubuntu14.04解决菜单栏和工具栏消失的方案:
进入图形界面
sudo startx
重设compiz设置(这一步可以不要)
dconf reset -f /org/compiz/
重置compiz后,重启Unity:
setsid unity(这一步必须要)
添加环境变量
sudo gedit /etc/profile
export PATH=$PATH:/usr/xenomai/include
source /etc/profile
cannot open shared object file 问题的解决
# gedit /etc/ld.so.conf
添加lib目录
include /etc/ld.so.conf.d/*.conf
/usr/xenomai/lib
/usr/etherlab/lib
修改完ld.so.conf之后必须执行/sbin/ldconfig -v同步动态库
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。