Xenomai is real-time framework, which can run seamlessly side-by-side Linux as a co-kernel system, or natively over mainline Linux kernels (with or without PREEMPT-RT patch). The dual kernel nicknamed Cobalt, is a significant rework of the Xenomai 2.x system. Cobalt implements the RTDM specification for interfacing with real-time device drivers. The native linux version, an enhanced implementation of the experimental Xenomai/SOLO work, is called Mercury. In this environment, only a standalone implementation of the RTDM specification in a kernel module is required, for interfacing the RTDM-compliant device drivers with the native kernel. You can get more detailed information from Home · Wiki · xenomai / xenomai · GitLab
I have ported xenomai 3.1 to i.MX Yocto 4.19.35-1.1.0, and currently support ARMv7 and tested on imx6ulevk/imx6ull14x14evk/imx6qpsabresd/imx6dlsabresd/imx6sxsabresdimx6slevk boards. I also did stress test by tool stress-ng on some boards.
You need to git clone https://gitee.com/zxd2021-imx/xenomai-arm.git, and git checkout Linux-4.19.35-1.1.0. (which inlcudes all patches and bb file) and add the following variable in conf/local.conf before build xenomai by command bitake xenomai.
XENOMAI_KERNEL_MODE = "cobalt"
PREFERRED_VERSION_linux-imx = "4.19-${XENOMAI_KERNEL_MODE}"
IMAGE_INSTALL_append += " xenomai"
DISTRO_FEATURES_remove = "optee"
or
XENOMAI_KERNEL_MODE = "mercury"
PREFERRED_VERSION_linux-imx = "4.19-${XENOMAI_KERNEL_MODE}"
IMAGE_INSTALL_append += " xenomai"
DISTRO_FEATURES_remove = "optee"
If XENOMAI_KERNEL_MODE = "cobalt", you can build dual kernel version. And If XENOMAI_KERNEL_MODE = "mercury", it is single kernel with PREEMPT-RT patch.
The following is test result by the command (/usr/xenomai/demo/cyclictest -p 50 -t 5 -m -n -i 1000
//Mecury on 6ULL with stress-ng --cpu 4 --io 2 --vm 1 --vm-bytes 128M --metrics-brief
policy: fifo: loadavg: 6.08 2.17 0.81 8/101 534
T: 0 ( 530) P:99 I:1000 C: 74474 Min: 23 Act: 235 Avg: 77 Max: 8278
T: 1 ( 531) P:99 I:1500 C: 49482 Min: 24 Act: 32 Avg: 56 Max: 8277
T: 2 ( 532) P:99 I:2000 C: 36805 Min: 24 Act: 38 Avg: 79 Max: 8170
T: 3 ( 533) P:99 I:2500 C: 29333 Min: 25 Act: 41 Avg: 54 Max: 7069
T: 4 ( 534) P:99 I:3000 C: 24344 Min: 24 Act: 51 Avg: 60 Max: 7193
//Cobalt on 6ULL with stress-ng --cpu 4 --io 2 --vm 1 --vm-bytes 128M --metrics-brief
policy: fifo: loadavg: 7.02 6.50 4.01 8/100 660
T: 0 ( 652) P:50 I:1000 C: 560348 Min: 1 Act: 10 Avg: 15 Max: 71
T: 1 ( 653) P:50 I:1500 C: 373556 Min: 1 Act: 9 Avg: 17 Max: 78
T: 2 ( 654) P:50 I:2000 C: 280157 Min: 2 Act: 14 Avg: 20 Max: 64
T: 3 ( 655) P:50 I:2500 C: 224120 Min: 1 Act: 12 Avg: 15 Max: 57
T: 4 ( 656) P:50 I:3000 C: 186765 Min: 1 Act: 31 Avg: 19 Max: 53
//Cobalt on 6qp with stress-ng --cpu 4 --io 2 --vm 1 --vm-bytes 512M --metrics-brief
policy: fifo: loadavg: 8.11 7.44 4.45 8/156 1057
T: 0 ( 917) P:50 I:1000 C: 686106 Min: 0 Act: 3 Avg: 5 Max: 53
T: 1 ( 918) P:50 I:1500 C: 457395 Min: 0 Act: 3 Avg: 5 Max: 49
T: 2 ( 919) P:50 I:2000 C: 342866 Min: 0 Act: 2 Avg: 4 Max: 43
T: 3 ( 920) P:50 I:2500 C: 274425 Min: 0 Act: 3 Avg: 5 Max: 58
T: 4 ( 921) P:50 I:3000 C: 228682 Min: 0 Act: 2 Avg: 6 Max: 46
//Cobalt on 6dl with stress-ng --cpu 2 --io 2 --vm 1 --vm-bytes 256M --metrics-brief
policy: fifo: loadavg: 3.35 4.15 2.47 1/122 850
T: 0 ( 729) P:50 I:1000 C: 608088 Min: 0 Act: 1 Avg: 3 Max: 34
T: 1 ( 730) P:50 I:1500 C: 405389 Min: 0 Act: 0 Avg: 4 Max: 38
T: 2 ( 731) P:50 I:2000 C: 304039 Min: 0 Act: 1 Avg: 4 Max: 45
T: 3 ( 732) P:50 I:2500 C: 243225 Min: 0 Act: 0 Avg: 4 Max: 49
T: 4 ( 733) P:50 I:3000 C: 202683 Min: 0 Act: 0 Avg: 5 Max: 38
//Cobalt on 6SX stress-ng --cpu 4 --io 2 --vm 1 --vm-bytes 512M --metrics-brief
policy: fifo: loadavg: 7.51 7.19 6.66 8/123 670
T: 0 ( 598) P:50 I:1000 C:2314339 Min: 0 Act: 3 Avg: 8 Max: 60
T: 1 ( 599) P:50 I:1500 C:1542873 Min: 0 Act: 15 Avg: 8 Max: 72
T: 2 ( 600) P:50 I:2000 C:1157152 Min: 0 Act: 4 Avg: 9 Max: 55
T: 3 ( 601) P:50 I:2500 C: 925721 Min: 0 Act: 5 Avg: 9 Max: 57
T: 4 ( 602) P:50 I:3000 C: 771434 Min: 0 Act: 6 Avg: 6 Max: 41
//Cobalt on 6Solo lite stress-ng --cpu 4 --io 2 --vm 1 --vm-bytes 512M --metrics-brief
policy: fifo: loadavg: 7.01 7.04 6.93 8/104 598
T: 0 ( 571) P:50 I:1000 C:3639967 Min: 0 Act: 9 Avg: 7 Max: 60
T: 1 ( 572) P:50 I:1500 C:2426642 Min: 0 Act: 9 Avg: 11 Max: 66
T: 2 ( 573) P:50 I:2000 C:1819980 Min: 0 Act: 11 Avg: 10 Max: 57
T: 3 ( 574) P:50 I:2500 C:1455983 Min: 0 Act: 12 Avg: 10 Max: 56
T: 4 ( 575) P:50 I:3000 C:1213316 Min: 0 Act: 7 Avg: 9 Max: 43
//Cobalt on 7d with stress-ng --cpu 2 --io 2 --vm 1 --vm-bytes 256M --metrics-brief
policy: fifo: loadavg: 5.03 5.11 5.15 6/107 683
T: 0 ( 626) P:50 I:1000 C:6842938 Min: 0 Act: 1 Avg: 2 Max: 63
T: 1 ( 627) P:50 I:1500 C:4561953 Min: 0 Act: 4 Avg: 2 Max: 66
T: 2 ( 628) P:50 I:2000 C:3421461 Min: 0 Act: 0 Avg: 2 Max: 69
T: 3 ( 629) P:50 I:2500 C:2737166 Min: 0 Act: 3 Avg: 2 Max: 71
T: 4 ( 630) P:50 I:3000 C:2280969 Min: 0 Act: 2 Avg: 1 Max: 33
//////////////////////////////////////// Update for Yocto L5.10.52 2.1.0 ///////////////////////////////////////////////////////////
New release for Yocto release L5.10.52 2.1.0. You need to git clone https://gitee.com/zxd2021-imx/xenomai-arm and git checkout xenomai-5.10.52-2.1.0.
Updating:
1, Upgrade Xenomai to v3.2
2, Enable Dovetail instead of ipipe.
Copy xenomai-arm to <Yocto folder>/sources/meta-imx/meta-bsp/recipes-kernel, and add the following variable in conf/local.conf before build Image with xenomai enable by command bitake imx-image-multimedia.
XENOMAI_KERNEL_MODE = "cobalt"
IMAGE_INSTALL_append += " xenomai"
or
XENOMAI_KERNEL_MODE = "mercury"
IMAGE_INSTALL_append += " xenomai"
Notice: If XENOMAI_KERNEL_MODE = "cobalt", you can build dual kernel version. And If XENOMAI_KERNEL_MODE = "mercury", it is single kernel with PREEMPT-RT patch.
//////////////////////////////////////// Update for Yocto L5.15.71 2.2.0 ///////////////////////////////////////////////////////////
New release for Yocto release L5.15.71 2.2.0. You need to git clone https://gitee.com/zxd2021-imx/xenomai-arm and git checkout xenomai-5.15.71-2.2.0.
Updating:
1, Upgrade Xenomai to v3.2.2
Copy xenomai-arm to <Yocto folder>/sources/meta-imx/meta-bsp/recipes-kernel, and add the following variable in conf/local.conf before build Image with xenomai enable by command bitake imx-image-multimedia.
XENOMAI_KERNEL_MODE = "cobalt"
IMAGE_INSTALL:append += " xenomai"
or
XENOMAI_KERNEL_MODE = "mercury"
IMAGE_INSTALL:append += " xenomai"
Notice: If XENOMAI_KERNEL_MODE = "cobalt", you can build dual kernel version. And If XENOMAI_KERNEL_MODE = "mercury", it is single kernel with PREEMPT-RT patch.
///////// Later update for Later Yocto release, please refer to the following community post ////////////
移植实时Linux方案Xenomai到i.MX ARM64平台 (Enable real-time Linux Xenomai on i.MX ARM64 Platform)