Xenomai 2.6.5 on Ubuntu 14.04

本文提供在Ubuntu14.04上安装Xenomai2.6.5的详细步骤,包括下载源码、配置内核、编译安装及测试验证等关键环节,并给出了一些实用建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

文章来源:
http://rtt-lwr.readthedocs.io/en/latest/rtpc/xenomai.html

目标:在Ubuntu 14.04 上安装 Xenomai 2.6.5;
测试平台:Ubuntu 14.04, linux原内核 4.4.0,Win 64bit
安装结果:成功
注意事项:记得采用sudo

Note

Nvidia Drivers are NOT supported (creates a lot of interruptions that breaks the real-time). Please consider removing the dedicated graphic card and use the integrated graphics (Intel HD graphics).

Download Xenomai 2.6.5

wget http://xenomai.org/downloads/xenomai/stable/xenomai-2.6.5.tar.bz2
tar xfvj xenomai-2.6.5.tar.bz2

Download Linux kernel 3.18.20

wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.20.tar.gz
tar xfv linux-3.18.20.tar.gz

Configuration

Prepare the kernel

sudo apt install kernel-package

Patch the Linux kernel with Xenomai ipipe patch

cd linux-3.18.20
../xenomai-2.6.5/scripts/prepare-kernel.sh

Press Enter to use the default options.

Configure the kernel

Now it’s time to configure :

make xconfig

Some guidelines to configure the linux kernel:

Required Options:

  • 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)
  • 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

Warning

For OROCOS, we need to increase the amount of ressources available for Xenomai tasks, otherwise we might hit the limits quickly as we add multiples components/ports etc. http://www.orocos.org/forum/orocos/orocos-users/orocos-limits-under-xenomai

  • Real-time sub-system
    –> Number of registry slots
    –> 4096
    –> Size of the system heap
    –> 2048 Kb
    –> Size of the private stack pool
    –> 1024 Kb
    –> Size of private semaphores heap
    –> 48 Kb
    –> Size of global semaphores heap
    –> 48 Kb
    Save the config and close the gui.

Compile the kernel (make debians)

Now it’s time to compile.

CONCURRENCY_LEVEL=$(nproc) make-kpkg --rootcmd fakeroot --initrd kernel_image kernel_headers

Take a coffee and come back in 20min.

Compile faster with distcc (也可以采用这种编译命令,速度更快)

MAKEFLAGS="CC=distcc" BUILD_TIME="/usr/bin/time" CONCURRENCY_LEVEL=$(distcc -j) make-kpkg --rootcmd fakeroot --initrd kernel_image kernel_headers

Install the kernel

cd ..
sudo dpkg -i linux-headers-3.18.20-xenomai-2.6.5_3.18.20-xenomai-2.6.5-10.00.Custom_amd64.deb linux-image-3.18.20-xenomai-2.6.5_3.18.20-xenomai-2.6.5-10.00.Custom_amd64.deb

Configure GRUB

Minimal config (xeno_nucleus.xenomai_gid=128 xenomai.allowed_group=128 allows non-root xenomai tasks):

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash xeno_nucleus.xenomai_gid=1234 xenomai.allowed_group=1234"
GRUB_CMDLINE_LINUX=""

Tip

Please note the xenomai group 1234, you might need to change it after the ‘’Allow non-root users’’ section.

Tip

noapic` option might be added if the screen goes black at startup and you can’t boot.
If you have an Intel HD Graphics integrated GPU :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.i915_enable_rc6=0 i915.powersave=0 noapic xeno_nucleus.xenomai_gid=1234 xenomai.allowed_group=1234"
This removes powersavings from the graphics, that creates disturbing interruptions.

Update GRUB and reboot

sudo update-grub
sudo reboot

Allow non-root users

sudo addgroup xenomai --gid 1234
sudo addgroup root xenomai
sudo usermod -a -G xenomai $USER

Tip

If the addgroup: The GID xenomai is already in use, change it to a different radom value, and update your grub accordingly.

Install Xenomai libraries

cd xenomai-2.6.5/
./configure
make -j$(nproc)
sudo make install

Update your bashrc

echo '
#### Xenomai
export XENOMAI_ROOT_DIR=/usr/xenomai
export XENOMAI_PATH=/usr/xenomai
export PATH=$PATH:$XENOMAI_PATH/bin
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$XENOMAI_PATH/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$XENOMAI_PATH/lib
export OROCOS_TARGET=xenomai
' >> ~/.bashrc

Test your installation

xeno latency

This loop will allow you to monitor a xenomai latency. Here’s the output for a i7 4Ghz :

== 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| 0.174| 0.464| 1.780| 0| 0| 0.174| 1.780
RTD| 0.088| 0.464| 1.357| 0| 0| 0.088| 1.780
RTD| 0.336| 0.464| 1.822| 0| 0| 0.088| 1.822
RTD| 0.342| 0.464| 1.360| 0| 0| 0.088| 1.822
RTD| 0.327| 0.462| 2.297| 0| 0| 0.088| 2.297
RTD| 0.347| 0.463| 1.313| 0| 0| 0.088| 2.297
RTD| 0.314| 0.464| 1.465| 0| 0| 0.088| 2.297
RTD| 0.190| 0.464| 1.311| 0| 0| 0.088| 2.297
Tip

To get pertinent results, you need to stress your system. to do so, you can use stress or dohell from the apt.

Using stress
stress -v -c 8 -i 10 -d 8

Negative latency issues

You need to be in root sudo -s, then you can set values to the latency calibration variable in nanoseconds:

$ echo 0 > /proc/xenomai/latency
# Now run the latency test

# If the minimum latency value is positive,
# then get the lowest value from the latency test (ex: 0.088 us)
# and write it to the calibration file ( here you have to write 88 ns) :
$ echo my_super_value_in_ns > /proc/xenomai/latency

Source : https://xenomai.org/pipermail/xenomai/2007-May/009063.html

### Xenomai 2.6.5 的安装配置与使用 #### 安装指南 对于希望在嵌入式系统中集成实时操作系统 (RTOS) 功能的开发者而言,Xenomai提供了一种解决方案。为了安装 Xenomai 2.6.5,在基于 Linux 的环境中操作如下: 1. **下载源码包** 访问官方站点或通过版本控制系统获取指定版本的源代码压缩文件。 2. **解压并进入工作目录** ```bash tar xf xenomai-2.6.5.tar.bz2 cd xenomai-2.6.5/ ``` 3. **配置编译参数** 利用 `./configure` 脚本来设置目标平台和其他必要的选项。这一步骤可能因具体硬件架构不同而有所变化。 4. **编译项目** 执行标准命令来启动编译过程: ```bash make ``` 5. **安装至系统** 完成上述步骤之后, 可以将生成的结果部署到本地文件系统中去. ```bash sudo make install ``` 此过程中涉及到的具体细节会依据宿主机环境的不同而略有差异[^1]。 #### 配置方法 一旦成功安装了 Xenomai 库及其工具链,则可以通过修改内核模块加载方式或者调整应用程序链接器的行为来进行进一步定制化处理。通常情况下,建议先阅读随附文档中的说明部分,了解如何针对特定应用场景优化性能表现。 另外值得注意的是,在某些特殊场景下(比如当需要支持多处理器调度特性时),还需要额外关注 CPU 绑定策略等问题。 #### 使用教程概览 学习如何有效运用 Xenomai 提供的各种 API 接口是掌握该技术的关键所在。一般可以从以下几个方面入手: - 学习 POSIX 兼容接口的应用编程; - 尝试编写简单的周期性任务程序; - 实践中断服务例程的设计思路; - 探索时间管理机制下的延时函数调用技巧; 这些知识点都可以帮助使用者更好地理解 Xenomai 的核心概念,并能够快速上手开发实际工程项目。 #### 版本更新记录摘要 关于 Xenomai 2.6.5 的变更详情,主要包括但不限于以下几点改进措施: - 增强了对 ARM 架构的支持程度; - 解决了一些已知的安全漏洞问题; - 改进了内存分配算法效率; - 添加了新的调试功能以便于故障排查; 以上信息汇总自社区贡献者提交的日志条目集合[^2]。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值