Xenomai 2.6.5 on Ubuntu 14.04

文章来源:
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

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值