HOWTO: Realtime 2.6.20 kernel!

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

HOWTO: Realtime 2.6.20 kernel!

#1 Post by thamarok »

Hello!

There is a similar topic to this one located at: http://forums.debian.net/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

User avatar
Simpatico
Posts: 87
Joined: 2007-04-25 14:07

#2 Post by Simpatico »

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
Dargor
Posts: 671
Joined: 2006-08-14 08:54
Location: New Zealand, Hamilton

#3 Post by Dargor »

go to the "trunk" that he got them from and get them from there.

User avatar
Simpatico
Posts: 87
Joined: 2007-04-25 14:07

#4 Post by Simpatico »

Thanks, Dargor. Will do.

thamarok

#5 Post by thamarok »

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.

User avatar
Simpatico
Posts: 87
Joined: 2007-04-25 14:07

#6 Post by Simpatico »

thamarok,

Thank you - no worries. I'm looking forward to it.

thamarok

#7 Post by thamarok »

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 :(

fvs
Posts: 144
Joined: 2006-06-16 22:33

#8 Post by fvs »

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.

User avatar
Dargor
Posts: 671
Joined: 2006-08-14 08:54
Location: New Zealand, Hamilton

#9 Post by Dargor »

unless you have extracted your kernel in your home dir then its not supposed to work. go to where your kernel source is.

fvs
Posts: 144
Joined: 2006-06-16 22:33

#10 Post by fvs »

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#

thamarok

#11 Post by thamarok »

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

User avatar
Simpatico
Posts: 87
Joined: 2007-04-25 14:07

#12 Post by Simpatico »

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

Still sounds good. I hope you can find a good host.

fvs
Posts: 144
Joined: 2006-06-16 22:33

#13 Post by fvs »

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

thamarok

#14 Post by thamarok »

Try running it with sudo
I'm running out of ideas; it has worked for me everytime I tried :roll:

fvs
Posts: 144
Joined: 2006-06-16 22:33

#15 Post by fvs »

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

thamarok

#16 Post by thamarok »

You do have an X Server open, do you? Now this is a mystery that is probably very hard to solve...

Try with make gconfig.. If that didn't work I think your best bet would be menuconfig :(

fvs
Posts: 144
Joined: 2006-06-16 22:33

#17 Post by fvs »

Tried
debian:/usr/src/linux-2.6.20.3# make gconfig
*
* Unable to find the GTK+ installation. Please make sure that
* the GTK+ 2.0 development package is correctly installed...
* You need gtk+-2.0, glib-2.0 and libglade-2.0.
*
make[1]: *** No rule to make target `scripts/kconfig/.tmp_gtkcheck', needed by `scripts/kconfig/gconf.o'. Stop.
make: *** [gconfig] Error 2
If that didn't work I think your best bet would be menuconfig
_________________

Don't know right answers once I use menuconfig?
each time I select It wont do anything, need some more direction.When I get to the window that asks what to enter,
".config" I don't know what to enter? I have entered "2.6.20.3"
and it says it don't exist?

User avatar
Lost Dog
Posts: 250
Joined: 2006-08-11 21:54
Location: North of the Columbia River

#18 Post by Lost Dog »

fvs wrote:Tried
debian:/usr/src/linux-2.6.20.3# make gconfig
*
* Unable to find the GTK+ installation. Please make sure that
* the GTK+ 2.0 development package is correctly installed...
* You need gtk+-2.0, glib-2.0 and libglade-2.0.
*
make[1]: *** No rule to make target `scripts/kconfig/.tmp_gtkcheck', needed by `scripts/kconfig/gconf.o'. Stop.
make: *** [gconfig] Error 2
If that didn't work I think your best bet would be menuconfig
_________________

Don't know right answers once I use menuconfig?
each time I select It wont do anything, need some more direction.When I get to the window that asks what to enter,
".config" I don't know what to enter? I have entered "2.6.20.3"
and it says it don't exist?
This is telling you that you need gtk+-2.0, glib-2.0 and libglade-2.0.

You'll need to apt-get (or synaptic) libgtk2.0-common (maybe -dev as well), libglib2.0 (-dev) and libglade2-0 (-dev).

Sorry if I missed it earlier but what about "make xconfig"?

fvs
Posts: 144
Joined: 2006-06-16 22:33

#19 Post by fvs »

debian:/usr/src/linux-2.6.20.3# make xconfig
HOSTCXX scripts/kconfig/qconf.o
/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#

debian:/usr/src/linux-2.6.20.3# apt-get install gtk+-2.0
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package gtk+-2.0
debian:/usr/src/linux-2.6.20.3# apt-get install glib-2.0
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package glib-2.0
debian:/usr/src/linux-2.6.20.3# apt-get install libglade-2.0
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package libglade-2.0

User avatar
Lost Dog
Posts: 250
Joined: 2006-08-11 21:54
Location: North of the Columbia River

#20 Post by Lost Dog »

fvs wrote:debian:/usr/src/linux-2.6.20.3# make xconfig
HOSTCXX scripts/kconfig/qconf.o
/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#

debian:/usr/src/linux-2.6.20.3# apt-get install gtk+-2.0
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package gtk+-2.0
debian:/usr/src/linux-2.6.20.3# apt-get install glib-2.0
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package glib-2.0
debian:/usr/src/linux-2.6.20.3# apt-get install libglade-2.0
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package libglade-2.0
Try it through synaptic. I may not have had the names of the file exactly as apt wants them. Also, I don't believe "gtk+-2.0", "glib-2.0" and "libglade-2.0" are the names of the packages.

Also, do you have g++? Make sure you have gcc, g++, etc.

You need may need (some of these may be redundant and some may depend on others but this is just what I tracked down):

libglib2.0-0
libglib2.0-dev
libgtk2.0-common
libgtk2.0-dev
libgtk2.0-0
libglade2-0
libglade2-dev
libglade-gnome0
libglade-gnome0-dev

Post Reply