您的位置:首页 > 运维架构 > Linux

Xenomai3.0.5+Linux4.9.24安装及配置

2017-07-22 08:35 253 查看
Xenomai3.0.5+Linux4.9.24安装及配置

1.下载Linux内核:https://www.kernel.org/pub/linux/kernel/

下载对应要使用内核的I-pipe补丁:http://xenomai.org/downloads/ipipe/

2.使用脚本来为Linux内核打补丁:(以下操作均需root权限)

scripts/prepare-kernel.sh [–linux=][–ipipe=] [–arch=]

–linux选项指出要打补丁的内核所在目录

–ipipe选项指出I-pipe补丁所在目录

–arch选项指出目标硬件架构,默认为自动检测到的本机的架构

3.配置内核(不同版本内核相应选项位置可能不同)

在内核所在目录执行make menuconfig命令,如果看到配置界面出现了Xenomai相关选项则说明补丁已经打上:



由于内核的一些配置选项会与Xenomai冲突或严重影响系统的实时性,需要修改内核自带的默认的设置:

(1)Processor type and features>Processor family选择目标硬件架构,这里默认为通用选项Generic,修改为目标硬件架构。



(2)关闭Power management and ACPI options>APM(Advanced Power Management) BIOS support,我这里没有显示这个选项,用/键搜索功能发现其已经关闭,可能是由于其他选项的选择使这个选项在界面上消失。



(3)关闭Power management and ACPI options>ACPI(Advanced Configuration and Power Interface) Support>Processor



(4)关闭Power management and ACPI options>CPU Frequency scaling> CPU Frequency scaling



(5)关闭Power management and ACPI options>CPU Idle>CPU idle PM support



(6)关闭Device Drivers>Input device support>Generic input layer>Miscellaneous devices



配置完成后保存,退出。

4.编译内核

(1)进入内核文件目录下

(2)清除临时文件:make clean

(3)编译内核:make bzImage

(4)编译模块:make modules

(5)编译过程大概用几个小时。

(6)安装模块:make modules_install

(7)移动内核文件到/boot:

(8)将内核文件目录下linux-x.x.x/arch/x86/boot/bzImage移动到/boot下

(9)新建initramfs: mkinitramfs -o /boot/initrd-4.9.24.img 4.9.24

(10)配置启动程序:update-grub

5.编译Xenomai库

(1)新建编译用的目录

(2)进入编译目录

(3)执行命令xenomai_root/configure –with-core=mercury –enable-smp –enable-pshared

(4) make install

6.测试Xenomai

重启,并以刚刚编译安装好的内核启动

(1)执行dmesg | grep -i xenomai



可以看到Xenomai运行的信息。

(2)运行Xenomai自带的实时性测试工具:

/usr/xenomai/bin/latency



这里发现延迟为负值。

参考xenomai开发者的一篇回复中提到的校准测试工具的方法:

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

执行echo 0 > /proc/xenomai/latency

取出本地校验运行结果中的最小延迟的值,我这里为0.630us

echo 630 > /proc/xenomai/latency (这里换算为ns)

校准后结果如下:



还有就是配置内核的时候关于SMI的选项在官网上的说明我没有看懂,希望能和大家交流。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息