特殊:Badtitle/NS100:HowToVanillaKernelWithRealtimePreemption:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Wikibot留言 | 贡献
无编辑摘要
Wikibot留言 | 贡献
无编辑摘要
 
(未显示同一用户的2个中间版本)
第1行: 第1行:
{{From|https://help.ubuntu.com/community/HowToVanillaKernelWithRealtimePreemption}}
{{From|https://help.ubuntu.com/community/HowToVanillaKernelWithRealtimePreemption}}
{{Languages|UbuntuHelp:HowToVanillaKernelWithRealtimePreemption}}
{{Languages|UbuntuHelp:HowToVanillaKernelWithRealtimePreemption}}
'''''Please note: This is an outdated [[UbuntuHelp:HowTo|HowTo]].'''  Current versions of Ubuntu have the Realtime Kernel in the repositories, and no patching is required.  Simply do <code><nowiki>sudo apt-get install linux-rt</nowiki></code> to install the current realtime kernel, or <code><nowiki>sudo apt-get install ubuntustudio-audio</nowiki></code> to get the realtime kernel along with a suite of audio applications.''
To get to the goal of true real-time, low-latency audio work under Linux, you will absolutely require Realtime-Preemption. Ingo Molnar, who currently works for Red Hat, wrote a patch that will apply to the the [http://www.kernel.org/ official vanilla kernel sources]. This patch gives you roughly 95% preemption, as compared to about 50% preemption without the patch. If you don't think you need the extra preemption, you can stick with Dapper's default kernel.
To get to the goal of true real-time, low-latency audio work under Linux, you will absolutely require Realtime-Preemption. Ingo Molnar, who currently works for Red Hat, wrote a patch that will apply to the the [http://www.kernel.org/ official vanilla kernel sources]. This patch gives you roughly 95% preemption, as compared to about 50% preemption without the patch. If you don't think you need the extra preemption, you can stick with Dapper's default kernel.
Take note that if you follow this tutorial, you may lose some of the Ubuntu-specific features that are not supported by the official Linux kernel (generally device driver modules). This should only affect a small group of users, but if you find that a particular piece of hardware stops working with this kernel, you may require additional manual patching.
Take note that if you follow this tutorial, you may lose some of the Ubuntu-specific features that are not supported by the official Linux kernel (generally device driver modules). This should only affect a small group of users, but if you find that a particular piece of hardware stops working with this kernel, you may require additional manual patching.
Firstly, get the latest patch from [http://people.redhat.com/mingo/realtime-preempt/ http://people.redhat.com/mingo/realtime-preempt/]. At the time of writing, the latest patch listed there is ''patch-2.6.16-rt26''. We also will want the bd-claim.patch as well, which fixes EVMS (one of the things Ubuntu's patched kernel fixes).
Firstly, get the latest patch from [http://people.redhat.com/mingo/realtime-preempt/ http://people.redhat.com/mingo/realtime-preempt/]. At the time of writing, the latest patch listed there is ''patch-2.6.16-rt26''. We also will want the bd-claim.patch as well, which fixes EVMS (one of the things Ubuntu's patched kernel fixes).
<pre><nowiki>
<pre><nowiki>
sudo su
sudo su
cd /usr/src
cd /usr/src
wget http://people.redhat.com/mingo/realtime-preempt/older/patch-2.6.16-rt26
wget http://people.redhat.com/mingo/realtime-preempt/older/patch-2.6.16-rt26
apt-get install kernel-patch-evms
apt-get install kernel-patch-evms
gunzip kernel-patches/diffs/evms-bd-claim/2.6-bd-claim.patch.gz
gunzip kernel-patches/diffs/evms-bd-claim/2.6-bd-claim.patch.gz
</nowiki></pre>
</nowiki></pre>
Now download the latest matching official kernel source from [http://www.kernel.org/ http://www.kernel.org/]. At the time of writing, the latest kernel is 2.6.16 (do not use the 2.6.16.x kernels, they will cause issues when patching!).
Now download the latest matching official kernel source from [http://www.kernel.org/ http://www.kernel.org/]. At the time of writing, the latest kernel is 2.6.16 (do not use the 2.6.16.x kernels, they will cause issues when patching!).
<pre><nowiki>
<pre><nowiki>
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.tar.bz2
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.tar.bz2
tar jxf linux-2.6.16.tar.bz2
tar jxf linux-2.6.16.tar.bz2
mv linux-2.6.16 linux-2.6.16-rt26
mv linux-2.6.16 linux-2.6.16-rt26
mv linux linux.old
mv linux linux.old
ln -s linux-2.6.16-rt26/ linux
ln -s linux-2.6.16-rt26/ linux
</nowiki></pre>
</nowiki></pre>
If you use the NVIDIA module for your video, you can prepare to make the deb package for this as well:
If you use the NVIDIA module for your video, you can prepare to make the deb package for this as well:
<pre><nowiki>
<pre><nowiki>
apt-get install nvidia-kernel-source
apt-get install nvidia-kernel-source
tar zxf nvidia-kernel-source.tar.gz
tar zxf nvidia-kernel-source.tar.gz
</nowiki></pre>
</nowiki></pre>
''There are other modules that you may require as well. Please add them to the wiki here if you have the package names. If you require assistance, post on the discussion page of this wiki and one of the editors will hopefully be able to assist you.''
''There are other modules that you may require as well. Please add them to the wiki here if you have the package names. If you require assistance, post on the discussion page of this wiki and one of the editors will hopefully be able to assist you.''
Now, let's patch the kernel source.
Now, let's patch the kernel source.
<pre><nowiki>
<pre><nowiki>
cd linux/
cd linux/
patch -sp1 < ../patch-2.6.16-rt26
patch -sp1 < ../patch-2.6.16-rt26
patch -sp1 < ../kernel-patches/diffs/evms-bd-claim/2.6-bd-claim.patch
patch -sp1 < ../kernel-patches/diffs/evms-bd-claim/2.6-bd-claim.patch
</nowiki></pre>
</nowiki></pre>
For other patches, test them first without making changes using the --dry-run option. If the test applied cleanly, successfully, then apply your extra patch.
For other patches, test them first without making changes using the --dry-run option. If the test applied cleanly, successfully, then apply your extra patch.
If you like the fancy Ubuntu screen while booting, you can apply the bootsplash patch.
If you like the fancy Ubuntu screen while booting, you can apply the bootsplash patch.
<pre><nowiki>
<pre><nowiki>
cd ..
cd ..
wget ftp://ftp.bootsplash.org/pub/bootsplash/kernel/bootsplash-3.1.6-2.6.15.diff
wget ftp://ftp.bootsplash.org/pub/bootsplash/kernel/bootsplash-3.1.6-2.6.15.diff
cd linux/
cd linux/
patch -p1 < ../bootsplash-3.1.6-2.6.15.diff
patch -p1 < ../bootsplash-3.1.6-2.6.15.diff
</nowiki></pre>
</nowiki></pre>
Now, copy the config from Ubuntu's default kernel, install libncurses-dev dependency and run menuconfig.
Now, copy the config from Ubuntu's default kernel, install libncurses-dev dependency and run menuconfig.
<pre><nowiki>
<pre><nowiki>
cp /boot/config-`uname -r` .config
cp /boot/config-`uname -r` .config
apt-get install libncurses-dev build-essential
apt-get install libncurses-dev build-essential
make menuconfig
make menuconfig
</nowiki></pre>
</nowiki></pre>
If you have never used menuconfig before, you should learn. Look around, change the settings that you are certain you want to change. In this step, you must change the following settings:
If you have never used menuconfig before, you should learn. Look around, change the settings that you are certain you want to change. In this step, you must change the following settings:
第55行: 第56行:
Now build the kernel and module debs. This step will take a very long time (possibly in the hours range, depending on your hardware). You will need kernel-package installed for this:
Now build the kernel and module debs. This step will take a very long time (possibly in the hours range, depending on your hardware). You will need kernel-package installed for this:
<pre><nowiki>
<pre><nowiki>
apt-get install kernel-package
apt-get install kernel-package
make-kpkg clean
make-kpkg clean
make-kpkg modules_clean
make-kpkg modules_clean
make-kpkg --revision 1 --initrd kernel_image kernel_headers modules_image
make-kpkg --revision 1 --initrd kernel_image kernel_headers modules_image
</nowiki></pre>
</nowiki></pre>
Once that is complete with no errors, you can then install the new deb packages:
Once that is complete with no errors, you can then install the new deb packages:
<pre><nowiki>
<pre><nowiki>
cd ..
cd ..
dpkg -i *2.6.16-rt26*.deb
dpkg -i *2.6.16-rt26*.deb
exit
exit
</nowiki></pre>
</nowiki></pre>
Now you probably want to tell GRUB to remember your default kernel choice. This is optional though, if you don't want to set this, you'll just have to always select your kernel from the GRUB menu at every boot.
Now you probably want to tell GRUB to remember your default kernel choice. This is optional though, if you don't want to set this, you'll just have to always select your kernel from the GRUB menu at every boot.
<pre><nowiki>
<pre><nowiki>
nano /boot/grub/menu.lst
nano /boot/grub/menu.lst
</nowiki></pre>
</nowiki></pre>
Change the line that says ''default 0'' to say ''default saved'' located near the top of the file.
Change the line that says ''default 0'' to say ''default saved'' located near the top of the file.
第75行: 第76行:
If something goes wrong, just choose the original kernel from the GRUB menu during bootup, and then remove the kernel packages:
If something goes wrong, just choose the original kernel from the GRUB menu during bootup, and then remove the kernel packages:
<pre><nowiki>
<pre><nowiki>
sudo apt-get remove kernel-image-2.6.16-rt26 kernel-headers-2.6.16-rt26
sudo apt-get remove kernel-image-2.6.16-rt26 kernel-headers-2.6.16-rt26
</nowiki></pre>
</nowiki></pre>
If you installed modules, you can remove them as well:
If you installed modules, you can remove them as well:
<pre><nowiki>
<pre><nowiki>
sudo apt-get remove nvidia-kernel-2.6.16-rt26
sudo apt-get remove nvidia-kernel-2.6.16-rt26
</nowiki></pre>
</nowiki></pre>


[[category:UbuntuHelp]]
[[category:UbuntuHelp]]

2008年10月19日 (日) 15:37的最新版本

{{#ifexist: :HowToVanillaKernelWithRealtimePreemption/zh | | {{#ifexist: HowToVanillaKernelWithRealtimePreemption/zh | | {{#ifeq: {{#titleparts:HowToVanillaKernelWithRealtimePreemption|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:HowToVanillaKernelWithRealtimePreemption|1|-1|}} | zh | | }}

Please note: This is an outdated HowTo. Current versions of Ubuntu have the Realtime Kernel in the repositories, and no patching is required. Simply do sudo apt-get install linux-rt to install the current realtime kernel, or sudo apt-get install ubuntustudio-audio to get the realtime kernel along with a suite of audio applications. To get to the goal of true real-time, low-latency audio work under Linux, you will absolutely require Realtime-Preemption. Ingo Molnar, who currently works for Red Hat, wrote a patch that will apply to the the official vanilla kernel sources. This patch gives you roughly 95% preemption, as compared to about 50% preemption without the patch. If you don't think you need the extra preemption, you can stick with Dapper's default kernel. Take note that if you follow this tutorial, you may lose some of the Ubuntu-specific features that are not supported by the official Linux kernel (generally device driver modules). This should only affect a small group of users, but if you find that a particular piece of hardware stops working with this kernel, you may require additional manual patching. Firstly, get the latest patch from http://people.redhat.com/mingo/realtime-preempt/. At the time of writing, the latest patch listed there is patch-2.6.16-rt26. We also will want the bd-claim.patch as well, which fixes EVMS (one of the things Ubuntu's patched kernel fixes).

 sudo su
 cd /usr/src
 wget http://people.redhat.com/mingo/realtime-preempt/older/patch-2.6.16-rt26
 apt-get install kernel-patch-evms
 gunzip kernel-patches/diffs/evms-bd-claim/2.6-bd-claim.patch.gz

Now download the latest matching official kernel source from http://www.kernel.org/. At the time of writing, the latest kernel is 2.6.16 (do not use the 2.6.16.x kernels, they will cause issues when patching!).

 wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.tar.bz2
 tar jxf linux-2.6.16.tar.bz2
 mv linux-2.6.16 linux-2.6.16-rt26
 mv linux linux.old
 ln -s linux-2.6.16-rt26/ linux

If you use the NVIDIA module for your video, you can prepare to make the deb package for this as well:

 apt-get install nvidia-kernel-source
 tar zxf nvidia-kernel-source.tar.gz

There are other modules that you may require as well. Please add them to the wiki here if you have the package names. If you require assistance, post on the discussion page of this wiki and one of the editors will hopefully be able to assist you. Now, let's patch the kernel source.

 cd linux/
 patch -sp1 < ../patch-2.6.16-rt26
 patch -sp1 < ../kernel-patches/diffs/evms-bd-claim/2.6-bd-claim.patch

For other patches, test them first without making changes using the --dry-run option. If the test applied cleanly, successfully, then apply your extra patch. If you like the fancy Ubuntu screen while booting, you can apply the bootsplash patch.

 cd ..
 wget ftp://ftp.bootsplash.org/pub/bootsplash/kernel/bootsplash-3.1.6-2.6.15.diff
 cd linux/
 patch -p1 < ../bootsplash-3.1.6-2.6.15.diff

Now, copy the config from Ubuntu's default kernel, install libncurses-dev dependency and run menuconfig.

 cp /boot/config-`uname -r` .config
 apt-get install libncurses-dev build-essential
 make menuconfig

If you have never used menuconfig before, you should learn. Look around, change the settings that you are certain you want to change. In this step, you must change the following settings:

  • Enable Processor type and features > High Resolution Timer Support
  • Set Processor type and features > High Resolution Timer resolution (nanoseconds) to 1000.
  • Set Processor type and features > Processor family to the type of CPU in your system.
  • Set Processor type and features > Preemption Mode to Complete Preemption (Real-Time).
  • Set Processor type and features > Timer frequency to 1000 Hz.
  • Disable Kernel Hacking > Kernel debugging

Once you have done that, Exit from menuconfig and select Yes to save your kernel configuration. Now build the kernel and module debs. This step will take a very long time (possibly in the hours range, depending on your hardware). You will need kernel-package installed for this:

 apt-get install kernel-package
 make-kpkg clean
 make-kpkg modules_clean
 make-kpkg --revision 1 --initrd kernel_image kernel_headers modules_image

Once that is complete with no errors, you can then install the new deb packages:

 cd ..
 dpkg -i *2.6.16-rt26*.deb
 exit

Now you probably want to tell GRUB to remember your default kernel choice. This is optional though, if you don't want to set this, you'll just have to always select your kernel from the GRUB menu at every boot.

 nano /boot/grub/menu.lst

Change the line that says default 0 to say default saved located near the top of the file. Next, find the line that says something similar to kernel /vmlinuz-2.6.16-rt26 root=/dev/hda2 ro quiet splash located nearer the bottom of the file, and remove the word splash from the end of the line. This will prevent your screen from being blank as your system boots the realtime kernel. Exit nano, saving the changes, and then restart your computer. At the GRUB prompt, hit Esc and choose the kernel from the menu. You will boot into the new kernel with realtime-preemption, allowing you to be as close as currently possible to true, low-latency real-time audio. If something goes wrong, just choose the original kernel from the GRUB menu during bootup, and then remove the kernel packages:

 sudo apt-get remove kernel-image-2.6.16-rt26 kernel-headers-2.6.16-rt26

If you installed modules, you can remove them as well:

 sudo apt-get remove nvidia-kernel-2.6.16-rt26