[Audio Arch] 1. Install realtime kernel

Why real-time?

According to Arch Linux Wiki Realtime kernel(or RT kernel):

Realtime applications have operational deadlines between some triggering event and the application’s response to that event. To meet these operational deadlines, programmers use realtime operating systems (RTOS) on which the maximum response time can be calculated or measured reliably for the given application and environment. A typical RTOS uses priorities. The highest priority task wanting the CPU always gets the CPU within a fixed amount of time after the event waking the task has taken place. On such an RTOS the latency of a task only depends on the tasks running at equal or higher priorities, all other tasks can be ignored. On a normal OS (such as normal Linux) the latencies depend on everything running on the system, which of course makes it much harder to be convinced that the deadlines will be met every time on a reasonably complicated system. This is because preemption can be switched off for an unknown amount of time. The high priority task wanting to run can thus be delayed for an unknown amount of time by low priority tasks running with preemption switched off.

I know you will not read it :) . In human’s language, realtime kernel means less latecy for applicationos. It is perfect for audio studio since it can improve accuracy of recording and playing.

However, according to the official JACK FAQ, you do not have to use a RT kernel since the mainline kernel also provides realtime scheduling support and has a quite reasonable latecy. So, unless you can feel there’s something wrong with the audio, you can simply forget about RT kernel, close this page and enjoy your time.

Still have interest? Just do it! The following setions introduces the prosedure to install RT kernel on Arch Linux.

Install kernel

The linux-rt package at AUR contains everything we need. If you have yaourt, simply use
yaourt -S linux-rt
Some GPG errors may occur. This is because the patch file is signed by the RT kernel maintainers and their GPG key are not included in the Arch Linux keyring. Simply run these commands to fix this(remember to search the GPG key first!):
gpg --recv-keys --keyserver hkp://pgp.mit.edu /*Missing keys*/
Then, relaunch the installation.

The compiling may take many time (several hours, depend on your hardware). You can just do your normal work during this time.

If no further error is reported and pacman finish the intallaion, it means the kernel should be ready to go. But before we use it, we still need to add it to the bootloader.

Add kernel to bootloader

Personally I use systemd-boot so this tutorial is based on a Arch Linux with systemd-boot. If you are using something other, simply check ArchWiki.

First, go to the /boot

If the installtion is finished successfully, you should be able to see these things:

We need to add these two buddy into the bootloader. Since I’ve written a boot entry for the normal kernel, I just copy that thing and make some changes:

My entry file looks like this:

If you have Secure Boot enabled, don’t forget to sign the kernel!

Then, save the file, reboot. Now in the boot screen you should see a entry called Arch Linux with Real-time Kernel. Choose this, wait for the boot, finished!


Thanks for reading! This post contains many information from online documents. They are listed below.



电子邮件地址不会被公开。 必填项已用*标注