HOWTO: Realtime 2.6.20 kernel!

Share your own howto's etc. Not for support questions!

HOWTO: Realtime 2.6.20 kernel!

Postby thamarok » 2007-03-18 13:01

Hello!

There is a similar topic to this one located at: viewtopic.php?t=12417
But it is a little outdated and I find my approach a little bit easier..

Introduction

A realtime kernel enables realtime preemption for the kernel which enhances the performance of multimedia applications greatly. A realtime kernel is recommended for small music studios, for people who want to live record MIDI keyboards or for people who want to get overall better performance from their PC. So you want to build your own realtime kernel? Fine, now let's get started!

1. Preparations

If you are familiar with the Terminal and you know how to compile programs, then you are ready to build a realtime kernel. Before we start, I would like to add that you need to run all the commands mentioned in this post as root. Ok, let's do some preparations before the actual kernel building:
Code: Select all
cd /usr/src/
apt-get install wget bzip2 binutils kernel-package module-init-tools initrd-tools yaird
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.3.tar.bz2
wget http://people.redhat.com/mingo/realtime-preempt/older/patch-2.6.20-rt8
tar xvjf linux-2.6.20.3.tar.bz2
cd linux-2.6.20.3
patch -p1 < ../patch-2.6.20-rt8
(Note: Don't mind any failed HUNKs)

And let's edit the /etc/kernel-img.conf file:
Code: Select all
cp /etc/kernel-img.conf /etc/kernel-img.conf.backup
nano /etc/kernel-img.conf

Make it look like this:
do_symlinks = yes
warn_initrd = no
ramdisk = /usr/sbin/yaird
do_bootloader = no
do_bootfloppy = no
link_in_boot = no
postinst_hook = /usr/sbin/update-grub
postrm_hook = /usr/sbin/update-grub
Now save the file and proceed to the next step.

2. Configuring the kernel

Ok, now we are ready to build the kernel, but before that, we need to configure it.
For a text-based configuring application fire up menuconfig:
Code: Select all
apt-get install libncurses5-dev
make menuconfig

Or if you prefer a GUI, then you can use xconfig:
Code: Select all
apt-get install libqt3-mt-dev
make xconfig

I recommend to use xconfig as it's easier to use, but it requires an X Server.

Now you need to configure your kernel from the ground up, but if you don't have any clue on what to set, then you can use these configurations as a base (I ripped them from the Debian 2.6.20 kernel packages from this trunk):
For 486: http://h.1asphost.com/thamarok/config-2.6.20-1-486
For 686: http://h.1asphost.com/thamarok/config-2.6.20-1-686
For amd64: http://h.1asphost.com/thamarok/config-2.6.20-1-amd64

You can easily load the configuration files from xconfig by choosing File -> Load from the menu. If you use menuconfig, then you need to scroll down and choose "Load an Alternate Configuration File".. But remember to save your configuration before building the kernel!

To have a realtime kernel, make sure you have these marked as Y:
Processor type and features -> Preemption Mode -> Complete Preemption (Real-Time)
Processor type and features -> Timer frequency -> 1000 HZ

If you are ready and you have saved your configuration, let's build the kernel!

3. Building the kernel

Building the kernel is a fairly easy process, but may take very long depending on your PC's specifications and how the kernel was configured.
Also note that with even a little misconfiguration, you can make a bad kernel.
Despite the consequences of what can happen, let's build the kernel:
Code: Select all
make-kpkg clean
make-kpkg --initrd kernel_image kernel_headers

On my PC this took about 20 minutes, but your mileage may vary (on some systems it takes up to 4 hours!)

After the kernel has compiled, you can install it very easily by executing this:
Code: Select all
dpkg -i *.deb

And voilá! Your new kernel is installed!
If everything went correctly, the GRUB bootloader should have updated its menu.lst file so that you can boot your new kernel on the next boot.

So, that was it :P
- Thamarok
thamarok
 
Posts: 1798
Joined: 2006-10-12 16:36

Postby Simpatico » 2007-04-27 02:11

thamarok,

This seems to be really good. It's my first time doing anything with a kernel, though, so I will let you know.

I'm in step 2, and I'm stuck because the configuration links are not working. Can you suggest any alternatives?
User avatar
Simpatico
 
Posts: 87
Joined: 2007-04-25 14:07

Postby Dargor » 2007-04-27 05:21

go to the "trunk" that he got them from and get them from there.
User avatar
Dargor
 
Posts: 671
Joined: 2006-08-14 08:54
Location: New Zealand, Hamilton

Postby Simpatico » 2007-04-27 12:27

Thanks, Dargor. Will do.
User avatar
Simpatico
 
Posts: 87
Joined: 2007-04-25 14:07

Postby thamarok » 2007-04-27 15:25

Sorry for the inconvenience; but it's just my bad hosting.. When I find a new one, I will update the links and polish this one a bit. Thanks for understanding.
thamarok
 
Posts: 1798
Joined: 2006-10-12 16:36

Postby Simpatico » 2007-04-27 16:29

thamarok,

Thank you - no worries. I'm looking forward to it.
User avatar
Simpatico
 
Posts: 87
Joined: 2007-04-25 14:07

Postby thamarok » 2007-04-28 18:04

Simpatico wrote:thamarok,

Thank you - no worries. I'm looking forward to it.
I have some good news (and a bad one too).. but good first:
Now that Linux 2.6.21is out, I tried to build that using my procedure and it worked fine, so when I update this one, I will make the links point to 2.6.21 instead.

And the bad news:
I have tried more than 20 free hosting providers, but none of them did either accept the format of the configs, or their uptime was just as bad as that ASPHost one.. Hopefully I am going to find a good host :(
thamarok
 
Posts: 1798
Joined: 2006-10-12 16:36

Postby fvs » 2007-04-28 19:16

I'm also having problems,

debian:/home/frank# apt-get install libqt3-mt-dev
Reading package lists... Done
Building dependency tree... Done
libqt3-mt-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
debian:/home/frank# make xconfig
make: *** No rule to make target `xconfig'. Stop.
fvs
 
Posts: 139
Joined: 2006-06-16 22:33

Postby Dargor » 2007-04-28 19:50

unless you have extracted your kernel in your home dir then its not supposed to work. go to where your kernel source is.
User avatar
Dargor
 
Posts: 671
Joined: 2006-08-14 08:54
Location: New Zealand, Hamilton

Postby fvs » 2007-04-28 21:27

Started all over from scratch got to this point and here i got stuck,

apt-get install libqt3-mt-dev
make xconfig

bin/sh: g++: command not found
make[1]: *** [scripts/kconfig/qconf.o] Error 127
make: *** [xconfig] Error 2
debian:/usr/src/linux-2.6.20.3#
fvs
 
Posts: 139
Joined: 2006-06-16 22:33

Postby thamarok » 2007-04-28 22:07

Run xhost + before that.
Try also apt-get install g++
thamarok
 
Posts: 1798
Joined: 2006-10-12 16:36

Postby Simpatico » 2007-04-29 00:33

thamarok wrote:I have some good news (and a bad one too)...

thamarok,

Still sounds good. I hope you can find a good host.
User avatar
Simpatico
 
Posts: 87
Joined: 2007-04-25 14:07

Postby fvs » 2007-04-29 11:00

thamarok wrote:Run xhost + before that.
Try also apt-get install g++


This is the results.

debian:/usr/src/linux-2.6.20.3# xhost +
access control disabled, clients can connect from any host
debian:/usr/src/linux-2.6.20.3# make xconfig
HOSTCXX scripts/kconfig/qconf.o
HOSTLD scripts/kconfig/qconf
scripts/kconfig/qconf arch/i386/Kconfig
Session management error: Authentication Rejected, reason : None of the authenti cation protocols specified are supported and host-based authentication failed
fvs
 
Posts: 139
Joined: 2006-06-16 22:33

Postby thamarok » 2007-04-29 11:40

Try running it with sudo
I'm running out of ideas; it has worked for me everytime I tried :roll:
thamarok
 
Posts: 1798
Joined: 2006-10-12 16:36

Postby fvs » 2007-04-29 12:08

Not yet?

debian:/usr/src/linux-2.6.20.3# make xconfig
scripts/kconfig/qconf arch/i386/Kconfig
qconf: cannot connect to X server
make[1]: *** [xconfig] Error 1
make: *** [xconfig] Error 2
fvs
 
Posts: 139
Joined: 2006-06-16 22:33

Next

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable