linux4.9.90+xenomai3.0.9安裝教程

環境

1.運行環境

  • CPU : Intel® Pentium® CPU G4400 @ 3.30GHz 四核
  • OS : ubuntu16.04
  • GCC : gcc version 5.5.0 20171010 (Ubuntu 5.5.0-12ubuntu1)

曾嘗試使用ubuntu18,不過在編譯安裝xenomai運行庫時一直編譯不過。報錯:
make[2]: Entering directory ‘/home/XXX/xenomai-3.0.5/testsuite/latency’
CCLD latency
/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status
Makefile:451: recipe for target ‘latency’ failed
make[2]: *** [latency] Error 1
make[2]: Leaving directory ‘/home/XXX/xenomai-3.0.5/testsuite/latency’
Makefile:423: recipe for target ‘install-recursive’ failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory ‘/home/XXX/xenomai-3.0.5/testsuite’
Makefile:460: recipe for target ‘install-recursive’ failed
make: *** [install-recursive] Error 1
嘗試解決解決不掉,

2.編譯環境

  • CPU : Intel® Core™ i7-8750H CPU @ 2.20GHz 六核
  • OS : ubuntu16.04
  • GCC : gcc version 5.5.0 20171010 (Ubuntu 5.5.0-12ubuntu1)

3. 待編譯內核版本

  • 內核:linux-4.9.90
  • ipipe:ipipe-core-4.9.90-x86-6.patch
  • xenomai:ipipe-core-4.9.90-x86-6.patch

內核是在阿里mirror裏下載的,速度比較快。ipipe和xenomai是在xenomia.org/download 下載的,速度還可以

步驟

1. 打補丁

tar xf linux-4.9.90.tar.gz
cd linux-4.9.90
../xenomai-3.0.9/scripts/prepare-kernel.sh --arch=x86_64 --ipipe=../ipipe-core-4.9.90-x86-6.patch

2. 內核配置

sudo apt-get install libncurses5-dev
make menuconfig

以下參考(Beta) Xenomai 3.0.5 on Ubuntu 14.04/16.04

* General setup
  --> Local version - append to kernel release: -xenomai-3.0.5
  --> Timers subsystem
      --> High Resolution Timer Support (Enable)
* Xenomai/cobalt
  --> Sizes and static limits
    --> Number of registry slots (512 --> 4096)
    --> Size of system heap (Kb) (512 --> 4096)
    --> Size of private heap (Kb) (64 --> 256)
    --> Size of shared heap (Kb) (64 --> 256)
    --> Maximum number of POSIX timers per process (128 --> 512)
  --> Drivers
    --> RTnet
        --> RTnet, TCP/IP socket interface (Enable)
            --> Drivers
                --> New intel(R) PRO/1000 PCIe (Enable)
                --> Realtek 8169 (Enable)
                --> Loopback (Enable)
        --> Add-Ons
            --> Real-Time Capturing Support (Enable)
* Power management and ACPI options
  --> CPU Frequency scaling
      --> CPU Frequency scaling (Disable)
  --> ACPI (Advanced Configuration and Power Interface) Support
      --> Processor (Disable)
  --> CPU Idle
      --> CPU idle PM support (Disable)
* Pocessor type and features
  --> Enable maximum number of SMP processors and NUMA nodes (Disable)
  // Ref : http://xenomai.org/pipermail/xenomai/2017-September/037718.html
  --> Processor family
      --> Core 2/newer Xeon (if "cat /proc/cpuinfo | grep family" returns 6, set as Generic otherwise)
  // Xenomai will issue a warning about CONFIG_MIGRATION, disable those in this order
  --> Transparent Hugepage Support (Disable)
  --> Allow for memory compaction (Disable)
  --> Contiguous Memory Allocation (Disable)
  --> Allow for memory compaction
    --> Page Migration (Disable)
* Device Drivers
  --> Staging drivers
      --> Unisys SPAR driver support
         --> Unisys visorbus driver (Disable)

3. 編譯

sudo apt-get install kernel-package
CONCURRENCY_LEVEL=$(nproc) make-kpkg --rootcmd fakeroot --initrd kernel_image kernel_headers

漫長的等待後,你會在上一級目錄目錄得到linux-headers-4.9.90-xenomai-3.0.9_4.9.90-xenomai-3.0.5-10.00.Custom_amd64.deblinux-image-4.9.38-xenomai-3.0.5_4.9.38-xenomai-3.0.5-10.00.Custom_amd64.deb 兩個安裝包。將其拷貝到運行環境下

4. 運行環境配置

4.1 允許非root用戶

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

4.2 配置grub

sudo vi /etc/default/grub

可參考如下:

GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.9.38-xenomai-3.0.5"
#GRUB_DEFAULT=saved
#GRUB_SAVEDEFAULT=true
# Comment the following lines
#GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.enable_rc6=0 i915.enable_dc=0 noapic xenomai.allowed_group=1234  xeno_nucleus.xenomai_gid=1234 nosmap"
GRUB_CMDLINE_LINUX=""
  • 我的運行環境是intel的集成顯卡,所以GRUB_CMDLINE_LINUX_DEFAULT得加上i915.enable_rc6=0 i915.enable_dc=0 noapic。這是因爲“This removes powersavings from the graphics, that creates disturbing interruptions.”
  • 其次CPU爲G4400,其爲Skylake架構,所以GRUB_CMDLINE_LINUX_DEFAULT得加上 xeno_nucleus.xenomai_gid=1234 nosmap。因爲(https://xenomai.org/pipermail/xenomai/2016-October/036787.html)

最後更新grub配置並重啓

sudo update-grub
sudo reboot

5. 安裝xenomai用戶空間庫

5.1 檢查重啓後的運行環境

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]

5.2 編譯庫

cd xenomai-3.0.5
./configure --with-pic --with-core=cobalt --enable-smp --disable-tls --enable-dlopen-libs --disable-clock-monotonic-raw
make -j`nproc`
sudo make install
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章