0. needed tools:
sudo apt-get install bin86 build-essential bzip2 fakeroot gcc kernel-package make libncurses5-dev
1. get kernel source & rt patch
www.kernel.org
main line stable kernel version:
at this time (2011/Aug), last stable kernel is 3.0: http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.bz2
rt kerne patch:
at this time (2011/Aug), last patch for rt kernel is:
http://kernel.org/pub/linux/kernel/projects/rt/patch-3.0-rt6.patch.bz2
be aware since the rt patch will be merged in the main stable kernel release.
Since kernel 2.6.39 the IRQ handlers will be threaded which is the most important part of the RT Patch.
rt kernel compilation will be considered from here.
2. uncompress, patch, configure and compile
tar xvjf linux-3.0.tar.bz2
cd linux-3.0
cp ../patch-3.0-rt6.patch.bz2 .
bunzip patch-3.0-rt6.patch.bz2
patch -p1 < patch-3.0-rt6.patch
copy for example your current kernel config file:
cp /boot/config-$(uname -r) .config
configure your kernel
make menuconfig
now you must change all the desired options for your new kernel here
when you decide to exit, all changes will be saved to .config file
more info to come here....
Config options for kernel >= 2.6.39:
$ cat config-2.6.39.1 | grep PREEMPT
CONFIG_TREE_PREEMPT_RCU=y
CONFIG_PREEMPT_RCU=y
CONFIG_PREEMPT_NOTIFIERS=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
CONFIG_PREEMPT=y
Threadirqs forced option:
CONFIG_IRQ_FORCED_THREADING=y
You must enable threadirqs at boot option. Threadirqs is a boot argument, CONFIG_IRQ_FORCED_THREADING is a kernel compilation config option which matters if you compile the kernel. The boot argument will of course only work at runtime if the config option had been turned on before compiling the kernel. You can replace the default you have, which is "quiet", by "quiet threadirqs" in the grub config file.
example:
menuentry 'Ubuntu, with Linux 2.6.39' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set cff691dc-fa7f-43d4-9875-60d91180b1c6
linux /boot/vmlinuz-2.6.39 root=UUID=cff691dc-fa7f-43d4-9875-60d91180b1c6 ro quiet threadirqs splash
initrd /boot/initrd.img-2.6.39
}
Other config options:
CONFIG_HZ_1000=y
CONFIG_HZ=1000
clear current source kernel directories:
make-kpkg clean
build the kernel, I’m using a 2 core so concurrency will be 2.
in this machine it takes about 1 hour to complete...
CONCURRENCY_LEVEL=2 make-kpkg --rootcmd fakeroot --initrd kernel-image kernel-headers kernel-source
if by chance the compilation finish with this error:
dpkg-gencontrol: error: package linux-image-xxxxxxxxxxx not in control info
then you must follow exactly what is expressed here, it worked for me:
http://ubuntuforums.org/showthread.php?t=1561762
3. install the kernel
cd .. && sudo dpkg -i *.deb
4. create an initrd
just replace the related kernel version number....:
sudo update-initramfs -c -k 3.0
5. update grub with new initrd
sudo update-grub
6. reboot and choose your new kernel version
7. end
References:
Realtime Scheduling Vs Realtime Preemption
http://boomtschak.tumblr.com/post/4638780228/rt-scheduling-vs-rt-preemption
Realtime Preemption Overview:
http://lwn.net/Articles/146861/
Jack and Realtime Scheduling:
http://jackaudio.org/linux_rt_config
Jack and Realtime Group Scheduling:
http://lwn.net/Articles/420407/
No comments:
Post a Comment