配置、编译 Linux Real Time Kernel(ZZ)
2010-04-12 21:08
447 查看
Ingo's RT patch
是又一个Linux实时实现,它采用了与TimeSys完全相 同的技术路线,而且有一些实现是基于TimeSys的源代码的,如IRQ和 softirq线程化。在新的内核主线中已经包含了这个补丁。以下介绍给内核打上这个实时补丁的方法。
编译内核
在没有打上这个补丁时,编译内核时就会有这些选项可供选择,它们位于:
Processor type and features ---> Preemption Model (Preemptible Kernel (Low-Latency Desktop)) --->
说明:抢占模式:
No Forced Preemption (Server),这种模式等同于没有使能抢占选项的标准内核,主要适用于科学计算等服务器环境。
Voluntary Kernel Preemption (Desktop),这种模式使能了自愿抢占,但仍然失效抢占内核选项,它通过增加抢占点缩减了抢占延迟,因此适用于一些需要较好的响应性的环境,如桌面环境,当然这种好的响应性是以牺牲一些吞吐率为代价的。
Preemptible Kernel (Low-Latency Desktop),这种模式既包含了自愿抢占,又使能了可抢占内核选项,因此有很好的响应延迟,实际上在一定程度上已经达到了软实时性。它主要适用于桌面和一些嵌入式系统,但是吞吐率比模式2更低。
在打上这个补丁后再编译,就会出现一个Complete Preemption (Real-Time)的选项,这种模式使能了所有实时功能,因此完全能够满足软实时需求,它适用于延迟要求为100微秒或稍低的实时系统。
patch kernel
----------------------------
# cd /usr/src/ingo-linux
# ls
linux-2.6.21.5.tar.bz2 patch-2.6.21.5-rt18
# tar jxf linux-2.6.21.5.tar.bz2
# mv linux-2.6.21.5 linux-2.6.21.5-realtime
# cd linux-2.6.21.5-realtime
# patch -p1 < ../patch-2.6.21.5-rt18
补丁文件可从以下地址下载:http://www.kernel.org/pub/linux/kernel/projects/rt/,选择适当的内核版本。
[zz from http://blog.chinaunix.net/u3/111966/showart_2186840.html]
Ingo Molnar的Realtime补丁效果很好,在我这里,我从前年10月份的第一版一直跟踪和使用到现在。在自己机器上作了一些修改和试验,效果都很好。
Ingo的realtime patch经过一年的测试,realtime patch颠覆了很多Linux Kernel的传统思路。估计马上要合入主流版本了。从patch第一次发布,跟踪到现在,觉得这个patch太精彩了,特别是对于kernel hacker来说。
http://en.opensuse.org/RT_Kernel_Instructions http://proaudio.tuxfamily.org/wiki/index.php?title=Howto_RT_Kernel
Realtime (RT) Kernel
RT Kernel - why?
The main goal in audio-processing is the latency. The latency is the delay beetween signal-creating and reaching the processing in the system (e.g time between pressing a key on the keyboard and hearing the tone). The standard kernels have the disadvantage that the processing is slower (~11ms) as in Windows or using a MAC . The faster the system, means the lower the latency, the more things can happen simular on a the system Ingo Molnar, a RedHat developer and some others have started a project to minimize the latency in Linux: Realtime Preemption. By using excellent audio-hardware the JACK demon (Jack Audio Connection Kit) reach latency < 1ms, similar to the MacOS X "coreaudio" system. For interested people follows a little step-by-step HowTo to patch a vanilla kernel with Realtime Preemption stuff and how to compile and install this new kernel.
Note
------------------------------------------------------
This is an experimental kernel.
the -rt patch is under heavy development all the time. So if you hit a bad day, you'll get a unstable/unusable kernel. See http://lkml.org for support, and check for a new version some days later if you happen to run into problems.
Sample kernel is the stable linux-2.6.21
Obtain the kernel-source and necessary patches
------------------------------------------------------
Download the sources
----------------------------
* download current vanilla kernel http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.5.tar.bz2
* download Realtime Preemption patch http://people.redhat.com/mingo/realtime-preempt/patch-2.6.21.5-rt18
Note: this is an example, the version of the -rt patch changes almost daily. So just take a look at http://people.redhat.com/mingo/realtime-preempt, choose the latest version and replace -rt18 with the current version throughout the whole guide.
patch kernel
----------------------------
# cd /usr/src/ingo-linux
# ls
linux-2.6.21.5.tar.bz2 patch-2.6.21.5-rt18
# tar jxf linux-2.6.21.5.tar.bz2
# mv linux-2.6.21.5 linux-2.6.21.5-realtime
# cd linux-2.6.21.5-realtime
# patch -p1 < ../patch-2.6.21.5-rt18
Kernel configuration
----------------------------
Clone the config
* if you don't, then copy the config from the current kernel's source tree
cp /usr/src/linux-`uname -r`/.config .config
# make menuconfig
----------------------------
Processor type and features --->
[*] High Resolution Timer Support
Preemption Mode (Complete Preemption (Real-Time)) --->
( ) No Forced Preemption (Server)
( ) Voluntary Kernel Preemption (Desktop)
( ) Preemptible Kernel (Low-Latency Desktop)
(X) Complete Preemption (Real-Time)
Timer frequency (1000 HZ) --->
( ) 100 HZ
( ) 250 HZ
( ) 300 HZ
(X) 1000 HZ
Kernel hacking --->
[*] Magic SysRq key
[ ] Kernel debugging
(note: need to look at a -rt kernel config for a full list)
下来配置默认配置已经能够满足要求:
----------------------------------
Note that since kernel 2.6.18-rt8, you may have to activate ACPI option to activate high resolution timer.
Power management options (ACPI, APM) --->
ACPI (Advanced Configuration and Power Interface) Support --->
[*] ACPI Support
[*] Power Management Timer Support (2.6.21没有此项)
Device drivers --->
Character devices --->
<*> Enhanced Real Time Clock Support
Device drivers --->
Sound --->
<M> Advanced Linux Sound Architecture
Advanced Linux Sound Architecture --->
<M> RTC Timer support
[*] Use RTC as default sequencer timer
activate realtime-lsm (deprecated)
----------------------------------
Note that the kernel config option is only available when the kernel is patched with rt-lsm patch. If it isn't, you can emerge realtime-lsm to get the module after the kernel is compiled an installed. Only activate "Default Linux Capabilities" in that case.
Security options --->
[*] Enable different security models
<M> Default Linux Capabilities
<M> Realtime Capabilities
Leave the menu with "Exit" and save configuration.
# make
# make modules_install install
[b]# mkinitrd -o /boot/initrd.img-2.6.21.5 2.6.21.5
[zz from http://hi.baidu.com/zengzhaonong/blog/item/4098297a074e1cef2f73b31a.html]
http://myth.audividi.com.cn/doku.php?id=divoffice:geminis:private:编译内核
[/b]
是又一个Linux实时实现,它采用了与TimeSys完全相 同的技术路线,而且有一些实现是基于TimeSys的源代码的,如IRQ和 softirq线程化。在新的内核主线中已经包含了这个补丁。以下介绍给内核打上这个实时补丁的方法。
编译内核
在没有打上这个补丁时,编译内核时就会有这些选项可供选择,它们位于:
Processor type and features ---> Preemption Model (Preemptible Kernel (Low-Latency Desktop)) --->
说明:抢占模式:
No Forced Preemption (Server),这种模式等同于没有使能抢占选项的标准内核,主要适用于科学计算等服务器环境。
Voluntary Kernel Preemption (Desktop),这种模式使能了自愿抢占,但仍然失效抢占内核选项,它通过增加抢占点缩减了抢占延迟,因此适用于一些需要较好的响应性的环境,如桌面环境,当然这种好的响应性是以牺牲一些吞吐率为代价的。
Preemptible Kernel (Low-Latency Desktop),这种模式既包含了自愿抢占,又使能了可抢占内核选项,因此有很好的响应延迟,实际上在一定程度上已经达到了软实时性。它主要适用于桌面和一些嵌入式系统,但是吞吐率比模式2更低。
在打上这个补丁后再编译,就会出现一个Complete Preemption (Real-Time)的选项,这种模式使能了所有实时功能,因此完全能够满足软实时需求,它适用于延迟要求为100微秒或稍低的实时系统。
patch kernel
----------------------------
# cd /usr/src/ingo-linux
# ls
linux-2.6.21.5.tar.bz2 patch-2.6.21.5-rt18
# tar jxf linux-2.6.21.5.tar.bz2
# mv linux-2.6.21.5 linux-2.6.21.5-realtime
# cd linux-2.6.21.5-realtime
# patch -p1 < ../patch-2.6.21.5-rt18
补丁文件可从以下地址下载:http://www.kernel.org/pub/linux/kernel/projects/rt/,选择适当的内核版本。
[zz from http://blog.chinaunix.net/u3/111966/showart_2186840.html]
Ingo Molnar的Realtime补丁效果很好,在我这里,我从前年10月份的第一版一直跟踪和使用到现在。在自己机器上作了一些修改和试验,效果都很好。
Ingo的realtime patch经过一年的测试,realtime patch颠覆了很多Linux Kernel的传统思路。估计马上要合入主流版本了。从patch第一次发布,跟踪到现在,觉得这个patch太精彩了,特别是对于kernel hacker来说。
http://en.opensuse.org/RT_Kernel_Instructions http://proaudio.tuxfamily.org/wiki/index.php?title=Howto_RT_Kernel
Realtime (RT) Kernel
RT Kernel - why?
The main goal in audio-processing is the latency. The latency is the delay beetween signal-creating and reaching the processing in the system (e.g time between pressing a key on the keyboard and hearing the tone). The standard kernels have the disadvantage that the processing is slower (~11ms) as in Windows or using a MAC . The faster the system, means the lower the latency, the more things can happen simular on a the system Ingo Molnar, a RedHat developer and some others have started a project to minimize the latency in Linux: Realtime Preemption. By using excellent audio-hardware the JACK demon (Jack Audio Connection Kit) reach latency < 1ms, similar to the MacOS X "coreaudio" system. For interested people follows a little step-by-step HowTo to patch a vanilla kernel with Realtime Preemption stuff and how to compile and install this new kernel.
Note
------------------------------------------------------
This is an experimental kernel.
the -rt patch is under heavy development all the time. So if you hit a bad day, you'll get a unstable/unusable kernel. See http://lkml.org for support, and check for a new version some days later if you happen to run into problems.
Sample kernel is the stable linux-2.6.21
Obtain the kernel-source and necessary patches
------------------------------------------------------
Download the sources
----------------------------
* download current vanilla kernel http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.5.tar.bz2
* download Realtime Preemption patch http://people.redhat.com/mingo/realtime-preempt/patch-2.6.21.5-rt18
Note: this is an example, the version of the -rt patch changes almost daily. So just take a look at http://people.redhat.com/mingo/realtime-preempt, choose the latest version and replace -rt18 with the current version throughout the whole guide.
patch kernel
----------------------------
# cd /usr/src/ingo-linux
# ls
linux-2.6.21.5.tar.bz2 patch-2.6.21.5-rt18
# tar jxf linux-2.6.21.5.tar.bz2
# mv linux-2.6.21.5 linux-2.6.21.5-realtime
# cd linux-2.6.21.5-realtime
# patch -p1 < ../patch-2.6.21.5-rt18
Kernel configuration
----------------------------
Clone the config
* if you don't, then copy the config from the current kernel's source tree
cp /usr/src/linux-`uname -r`/.config .config
# make menuconfig
----------------------------
Processor type and features --->
[*] High Resolution Timer Support
Preemption Mode (Complete Preemption (Real-Time)) --->
( ) No Forced Preemption (Server)
( ) Voluntary Kernel Preemption (Desktop)
( ) Preemptible Kernel (Low-Latency Desktop)
(X) Complete Preemption (Real-Time)
Timer frequency (1000 HZ) --->
( ) 100 HZ
( ) 250 HZ
( ) 300 HZ
(X) 1000 HZ
Kernel hacking --->
[*] Magic SysRq key
[ ] Kernel debugging
(note: need to look at a -rt kernel config for a full list)
下来配置默认配置已经能够满足要求:
----------------------------------
Note that since kernel 2.6.18-rt8, you may have to activate ACPI option to activate high resolution timer.
Power management options (ACPI, APM) --->
ACPI (Advanced Configuration and Power Interface) Support --->
[*] ACPI Support
[*] Power Management Timer Support (2.6.21没有此项)
Device drivers --->
Character devices --->
<*> Enhanced Real Time Clock Support
Device drivers --->
Sound --->
<M> Advanced Linux Sound Architecture
Advanced Linux Sound Architecture --->
<M> RTC Timer support
[*] Use RTC as default sequencer timer
activate realtime-lsm (deprecated)
----------------------------------
Note that the kernel config option is only available when the kernel is patched with rt-lsm patch. If it isn't, you can emerge realtime-lsm to get the module after the kernel is compiled an installed. Only activate "Default Linux Capabilities" in that case.
Security options --->
[*] Enable different security models
<M> Default Linux Capabilities
<M> Realtime Capabilities
Leave the menu with "Exit" and save configuration.
# make
# make modules_install install
[b]# mkinitrd -o /boot/initrd.img-2.6.21.5 2.6.21.5
[zz from http://hi.baidu.com/zengzhaonong/blog/item/4098297a074e1cef2f73b31a.html]
http://myth.audividi.com.cn/doku.php?id=divoffice:geminis:private:编译内核
[/b]
相关文章推荐
- 在Ubuntu16.04-64中编译Linux-2.6.35.7版本内核出错[kernel/timeconst.h] Error 255
- 嵌入式 Linux开发Kernel移植(二)——kernel内核配置和编译
- 嵌入式 Linux开发Kernel移植(二)——kernel内核配置和编译
- 在新版linux上编译老版本的kernel出现kernel/timeconst.h] Error 255
- Linux 2.6.19.x 内核编译配置选项简介
- How to implement realtime periodic tasks in Linux applications
- Linux 2.6.19.x 内核编译配置选项简介
- arm-linux-gcc4.3.2编译kernel 2.6.24成功,gcc4.3 内核
- Linux 内核配置与编译
- 【原】Boost下载安装编译配置使用指南(含Windows、Linux以及ARM Linux)
- [转]Linux 下编译、安装、配置 QT
- Linux下交叉编译环境配置及boost库的配置
- Linux 下编译并安装配置 Qt 全过程
- Linux程序源码编译安装的configure配置详解
- Boost下载安装编译配置使用指南(含Windows和Linux)
- Windows&Linux平台编译配置boost1.45
- Linux 环境下编译 0.11版本内核 kernel
- linux笔记 第二十一天 http高级配置及ab工具使用及编译安装http2.4
- 开发人员学Linux(7):CentOS7编译安装PHP并配置PHP-FPM
- Linux NTP配置详解 (Network Time Protocol)