个人工具

“UbuntuHelp:HowToVanillaKernelWithRealtimePreemption”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(New page: {{From|https://help.ubuntu.com/community/HowToVanillaKernelWithRealtimePreemption}} {{Languages|php5}} To get to the goal of true real-time, low-latency audio work under Linux, you will ab...)
 
第12行: 第12行:
 
  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></code>
+
</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!).
第21行: 第21行:
 
  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></code>
+
</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:
第27行: 第27行:
 
  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></code>
+
</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.''
第36行: 第36行:
 
  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></code>
+
</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.
第46行: 第46行:
 
  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></code>
+
</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.
第53行: 第53行:
 
  apt-get install libncurses-dev build-essential
 
  apt-get install libncurses-dev build-essential
 
  make menuconfig
 
  make menuconfig
</nowiki></code>
+
</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:
第71行: 第71行:
 
  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></code>
+
</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:
第78行: 第78行:
 
  dpkg -i *2.6.16-rt26*.deb
 
  dpkg -i *2.6.16-rt26*.deb
 
  exit
 
  exit
</nowiki></code>
+
</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></code>
+
</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.
第94行: 第94行:
 
<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></code>
+
</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></code>
+
</nowiki></pre>
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年5月13日 (日) 12:49的版本

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