xenomai 在ubuntu上的安装测试

在ubuntu下安装安装xenomai试试系统,

背景:
1、全新的ubuntu系统,我安装了一些必要的软件比如gcc g++等等
2、版本信息为:

hello@hello-Lenovo:~$ cat /etc/issue
Ubuntu 14.04.4 LTS \n \l
hello@hello-Lenovo:~$ uname -a
Linux hello-Lenovo 3.19.0-58-generic #64~14.04.1-Ubuntu SMP Fri Mar 18 19:05:42 UTC 2016 i686 i686 i686 GNU/Linux

由于xenomai没有针对3.19的补丁xenomai仅支持特定版本的几个内核因此,我们需要修改ubuntu的内核到指定的版本。因此我们需要做两件事情
1、 给ubuntu换新的内核
2、 安装xenomai2.6

首先就需要下载xenomai源码了,为了和其他的程序兼容我们选择xenomai2.6
下载网址在这里http://git.xenomai.org/xenomai-2.6.git/
这里就选择2.6.4

hello@hello-Lenovo:~/work/ubuntu$ wget http://download.gna.org/xenomai/stable/xenomai-2.6.4.tar.bz2

下载完毕之后就可以解压了:

hello@hello-Lenovo:~/work/ubuntu$ tar -xf xenomai-2.6.4.tar.bz2

解压完毕进入xenomai源码:

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$ cd xenomai-2.6.4   

此时我们需要一些工具,进行安装:

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$ sudo apt-get install devscripts devscripts debhelper dh-kpatches findutils autotools-dev autoconf automake libtool

安装完毕之后,就可以进行配置,主要配置选项如下:

--prefix  xenomai的安装目录默认的是/usr/xenomai
--enable-debug  使能调试符号-g默认的是不使能
-enable-smp  使能xenomai库对SMP的支持 ,假如客户端的应用运行在支持SMP的内核上一定要使能。
--with-atomic-ops= 这个是个选择使用何种方式进行原子访问操作:假如--with-atomic-ops=builtins 则选择使用GCC的嵌入的部件,比如 _sync*()等函数;假如--with-atomic-ops=ad-hoc则选择使用xenomai方式实现。假如用户没有指定的话,编译的时候除非GCC是过时的,否则默认选择--with-atomic-ops=builtins
--enable-x86-sep 使能x86sep指令
--enable-x86-tsc 使能x86的tsc
--enable-arm-tsc  使能arm 的tsc,为了提高时钟精确度,一般选择使能
--enable-arm-quirks  使能一些arm片上系统特殊特性,目前支持sa1100和xscale3。

配置完毕之后,就可以进行编译了,我们使用默认的配置的就可以了,配置如下:

./configure  --enable-x86-sep

假如在其他的平台上使用就需要根据文档依次来进行对应的配置了。

配置完毕之后,接下来我们编译

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$ make 

完成之后安装

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$ make install  

xenomai暂时完毕接下来开始编译内核。

下面开始编译内核,此时也需要安装几个工具:

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$ sudo apt-get install kernel-package libncurses-dev fakeroot zlib1g-dev

接下来下载源码包然后解压:

hello@hello-Lenovo:~/work/ubuntu$ wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.14.17.tar.xz && tar -xf linux-3.14.17.tar.xz

等待解压完毕进入内核目录:

hello@hello-Lenovo:~/work/ubuntu$ cd linux-3.14.17/

然后就可以打补丁了

hello@hello-Lenovo:~/work/ubuntu/linux-3.14.17$ ../xenomai-2.6.4/scripts/prepare-kernel.sh  --arch=amd64 --linux=. --adeos=../xenomai-2.6.4/ksrc/arch/x86/patches/ipipe-core-3.14.17-x86-4.patch

接下来配置下
这里我为了方便,直接把之前的配置拷贝到当前的目录下,这样做是简单,但是可能会出错,不过就算出错也是有些不该配置的地方配置了,此时只要根据提示修改即可,拷贝命令如下:

hello@hello-Lenovo:~/work/ubuntu/linux-3.14.17$ cp /boot/config-$(uname -r)  ./

接下来需要配置一些宣讲

Make menuconfig

下面是一些选项:

必选项:
* Real-time sub-system
    --> Xenomai (Enable)
    --> Nucleus (Enable)
* Power management and ACPI options
    --> Run-time PM core functionality (Disable)
    --> ACPI (Advanced Configuration and Power Interface) Support
            --> Processor (Disable)
    --> CPU Frequency scaling
            --> CPU Frequency scaling (Disable)
    --> CPU idle
            --> CPU idle PM support (Disable)
* Pocessor type and features
  --> Processor family
      --> Core 2/newer Xeon (if \"cat /proc/cpuinfo | grep family\" returns 6, set as Generic otherwise)

可选项 (RECOMMENDED):
* General setup
  --> Local version - append to kernel release: -xenomai-2.6.5
  --> Timers subsystem
      --> High Resolution Timer Support (Verify you have HRT ON)
* Pocessor type and features
  --> Processor family
      --> SMT (Hyperthreading) scheduler support (Disable)
      --> Preemption Model
          --> Voluntary Kernel Preemption (Desktop)
* Power management and ACPI options
  --> Memory power savings
      --> Intel chipset idle memory power saving driver

配置完毕之后就可以进行编译了,执行:

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$  make bzImage -j4

编译完成之后就可以进行安装了:

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$  make install

假如需要编译安装模块的话,需要

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$  make modules -j4

装模块

hello@hello-Lenovo:~/work/ubuntu/xenomai-2.6.4$ make modules_install

到此为止就安装完成了,其实在make install完毕之后就可以通过执行update-grub还查看启动项了
比如:

hello@hello-Lenovo:/usr$ sudo update-grub
[sudo] password for hello: 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-58-generic
Found initrd image: /boot/initrd.img-3.19.0-58-generic
Found linux image: /boot/vmlinuz-3.19.0-25-generic
Found initrd image: /boot/initrd.img-3.19.0-25-generic
Found linux image: /boot/vmlinuz-3.14.17
Found initrd image: /boot/initrd.img-3.14.17
Found linux image: /boot/vmlinuz-3.14.17.old
Found initrd image: /boot/initrd.img-3.14.17
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows Vista (loader) on /dev/sda1
Done

看到上面就出现vmlinuz-3.14.17了,说明已经成功了

接下来hello@hello-Lenovo:/usr$ sudo reboot now

再启动界面上选择ubuntu 高级选项
然后选择对应的版本号就可以了。
接下来进入系统之后进行测试:

hello@hello-Lenovo:/usr$ sudo  xeno latency
== Sampling period: 100 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
RTT|  00:00:01  (periodic user-mode task, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD|     -2.446|      0.371|      4.774|       0|     0|     -2.446|      4.774
RTD|     -2.144|      0.276|      4.826|       0|     0|     -2.446|      4.826
RTD|     -2.348|      0.344|      4.762|       0|     0|     -2.446|      4.826
RTD|     -2.756|      0.273|      4.682|       0|     0|     -2.756|      4.826
RTD|     -2.376|      0.338|      5.793|       0|     0|     -2.756|      5.793
RTD|     -2.549|      0.296|      4.411|       0|     0|     -2.756|      5.793
RTD|     -2.356|      0.340|      6.218|       0|     0|     -2.756|      6.218
RTD|     -2.248|      0.271|      4.756|       0|     0|     -2.756|      6.218
RTD|     -2.557|      0.341|      4.789|       0|     0|     -2.756|      6.218
RTD|     -2.359|      0.284|      9.107|       0|     0|     -2.756|      9.107
RTD|     -2.603|      0.341|      4.778|       0|     0|     -2.756|      9.107
RTD|     -1.402|      0.268|      4.723|       0|     0|     -2.756|      9.107
RTD|     -2.418|      0.328|      4.774|       0|     0|     -2.756|      9.107
RTD|     -1.074|      0.268|      5.534|       0|     0|     -2.756|      9.107
RTD|     -1.060|      0.337|      5.480|       0|     0|     -2.756|      9.107
RTD|     -1.682|      0.271|      5.514|       0|     0|     -2.756|      9.107
RTD|     -2.531|      0.336|      4.742|       0|     0|     -2.756|      9.107
RTD|     -2.490|      0.263|      4.741|       0|     0|     -2.756|      9.107
RTD|     -2.575|      0.340|      5.598|       0|     0|     -2.756|      9.107
RTD|     -2.319|      0.265|      4.718|       0|     0|     -2.756|      9.107
RTD|     -2.484|      0.335|      4.978|       0|     0|     -2.756|      9.107
RTT|  00:00:22  (periodic user-mode task, 100 us period, priority 99)

原文地址

http://blog.csdn.net/woshidahuaidan2011/article/details/53510510

参考文献:
https://launchpad.net/ubuntu/+source/xenomai/2.6.2.1-2ubuntu2
http://rtt-lwr.readthedocs.io/en/latest/rtpc/xenomai.html
http://support.barrett.com/wiki/BuildingAKernel/Ubuntu14.04-Kernel3.14.17-Xenomai2.6.4#PatchingtheKernel
http://support.barrett.com/wiki/BuildingAPC/14-04-1_64_Install

  • 2
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值