Realtime kernel build quickie + bootsplash (or not)

Share your own howto's etc. Not for support questions!
Message
Author
User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Realtime kernel build quickie + bootsplash (or not)

#1 Post by mzilikazi »

Edit 09.11.08 Updated for latest 2.6.26.5-rt8 - see last thread on page 5.
Edit 05.27.08 Updated for latest kernel 2.6.25.4
Edit 02.29.08 Added some tips, small revision.
Edit 01.28.08 Updated for latest kernel 2.6.24
Edit 10.12.07 Updated for latest 2.6.23-rt1 patch.
Added bootsplash patch.
Added downloadable pre-patched kernel source.
A big THANKS to hotlinkfiles.com for free file uploads and direct links.
linux-2.6.25.4-rt3.bz2
linux-2.6.25.4-rt3.md5sum

Execpt for the last step, (dpkg -i) there is no need to do any of this as root.
I prefer to create a simple build directory for all kernels something like KERNEL No need to do it in /usr/src since $USER cannot write there.

Code: Select all

mkdir KERNEL
cd KERNEL
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.4.tar.bz2
wget http://www.kernel.org/pub/linux/kernel/projects/rt/patch-2.6.25.4-rt3.bz2
wget http://fatcat.ftj.agh.edu.pl/~przyboro/other/bootsplash/bootsplash-3.1.6a-2.6.25.diff
unp linux-2.6.25.4.tar.bz2 
mv linux-2.6.25.4 linux-2.6.25.4-rt3
cd linux-2.6.25.4-rt3
bzcat ../patch-2.6.25.4-rt3.bz2 |patch -p1
patch -p1<../bootsplash-3.1.6a-2.6.25.diff
Note the Makefile in your kernel source. It will automatically update the EXTRAVERSION string for you. In this case:

Code: Select all

EXTRAVERSION = .4-rt3
This will be appended to your kernel name.

Code: Select all

make menuconfig
OR if you wish to start with the same .config of your current kernel:

Code: Select all

make oldconfig
Then run

Code: Select all

make menuconfig
Enable Real-time preemption.

Code: Select all

Processor type and features> Preemption Mode (Complete Preemption (Real-Time))
Set kernel timer frequency to 1000 HZ

Code: Select all

Processor type and features>Timer frequency (1000 HZ)
Build a kernel the Debian way:

Code: Select all

make-kpkg clean
time fakeroot make-kpkg --initrd -rev mz1 kernel_image kernel_headers
Your new kernel & headers now live in ../KERNEL Use dpkg -i to install.

Code: Select all

$ dpkg -i ../linux-headers-*.deb ../linux-image-*.deb
*TIPS*
Dual core CPU?
Use paralell make processes:

Code: Select all

export CONCURRENCY_LEVEL=2

Skip the patches.

You can just skip the realtime patch and/or the bootsplash patch(es) all together for a basic kernel build. No need to apply either patch.

Nvidia graphics driver:
You might want to disable Paravirtualization in make menuconfig. The Nvidia driver does not build against kernels with this enabled.

You can build the nvidia-kernel driver (or any other drivers like ndiswrapper or rfswitch) before you even boot into your new kernel if you prefer but it must be done as root. If you use sudo it might work w/ fakeroot. You must be in the same dir as your kernel source.

Code: Select all

root@finn:/home/glenn/KERNEL#
m-a -t -k linux-2.6.25.4-rt3/ -l linux-2.6.25.4-rt3 a-b nvidia
m-a -t -k linux-2.6.25.4-rt3/ -l linux-2.6.25.4-rt3 a-b ndiswrapper
m-a -t -k linux-2.6.25.4-rt3/ -l linux-2.6.25.4-rt3 a-b rfswitch
OR just build them all at once:

Code: Select all

m-a -t -k linux-2.6.25.4-rt3/ -l linux-2.6.25.4-rt3 a-b nvidia ndiswrapper rfswitch
Build nvidia driver after booting into your new kernel.
After booting your new kernel, log in as root on a VT and build Nvidia the Debian way via module assistant:

Code: Select all

m-a a-i nvidia
Restart your login manager:

Code: Select all

/etc/init.d/gdm restart
You don't need a link to /usr/src/linux.
When you build modules against this kernel your source will automatically be found. No need to link anything to /some/dir/linux. An exceprt from nvidia-kernel-source.buildlog.2.6.23-rt1

Code: Select all

NVIDIA: calling KBUILD...
make CC=gcc-4.2 -C /lib/modules/2.6.23-rt1/source SUBDIRS=/usr/src/modules/nvidia-kernel/nv modules
make[3]: Entering directory `/home/glenn/Storage/KERNEL/linux-2.6.23-rt1'
Additionally, any debs you build against this kernel using module assistant will live in the same place as your kernel & header debs.

Code: Select all

KERNEL# ls|grep .deb
linux-headers-2.6.25.4-rt3_mz1_amd64.deb
linux-image-2.6.25.4-rt3_mz1_amd64.deb
nvidia-kernel-2.6.25.4-rt3_169.12-3+mz1_amd64.deb
rfswitch-modules-2.6.25.4-rt3_1.3-1+mz1_amd64.deb
Remove a patch. For example, the bootsplash patch:

Code: Select all

patch -p1 -R <../bootsplash-3.1.6a-2.6.25.diff
Run make menuconfig after make oldconfig to fine tune, confirm and/or remove items you do not need. If you really want to slim down your kernel be careful w/ what you change. Make small changes and be prepared to build more than 1 kernel. Patience is a virtue! ;) When you get a build error you can *usually* figure it out from the error message. Sometimes disabling something in one place will break something elsewhere.

Make an optional tarball of your patched linux source:

Code: Select all

tar cjvf linux-2.6.25.4-rt3.bz2 linux-2.6.25.4-rt3
OR
You can make a .deb of your kernel source for easy portability

Code: Select all

fakeroot make-kpkg -rev mz1 kernel_source
Alternatively, the make-kpkg target kernel_source can be added to the initial make-kpkg command.

Code: Select all

fakeroot make-kpkg --initrd -rev mz1 kernel_image kernel_headers kernel_source
All done

Code: Select all

$ uname -r
Linux hestviken 2.6.25.4-rt3 
Last edited by mzilikazi on 2008-09-12 02:18, edited 43 times in total.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
Chris Cornell
Posts: 18
Joined: 2007-07-10 09:12

#2 Post by Chris Cornell »

tiny question: Isn't the realtime-preempt patch-2.6.22.1-rt2 supposed to work on version 2.6.22.1 of the linux kernel?
etch || 2.6.24-rt1 || NVIDIA 169.09 || fvwm cvs patched || pekwm

Licence: by-nc-sa

User avatar
Telemachus
Posts: 4677
Joined: 2006-12-25 15:53

#3 Post by Telemachus »

Two things worth knowing about 2.6.22 that could be "gotchas" for some people - both were for me when I built on earlier this week. First, if you have SATA/PATA drives look through the section on your drives very carefully since things have moved around a bit again. Second, if you have SATA/PATA drives, you may experience an error at shutdown about your disc not spinning down properly. It's not exactly the kernel, but it's also not going away super soon, as far as I can tell. Here's a link: SATA shutdown info

User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#4 Post by mzilikazi »

Chris Cornell wrote:tiny question: Isn't the realtime-preempt patch-2.6.22.1-rt2 supposed to work on version 2.6.22.1 of the linux kernel?
Yep. The rt patch got updated just as I was building and I forgot to make the change to the next kernel verion. ;/ Good catch!
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
Chris Cornell
Posts: 18
Joined: 2007-07-10 09:12

#5 Post by Chris Cornell »

mzilikazi wrote:
Chris Cornell wrote:tiny question: Isn't the realtime-preempt patch-2.6.22.1-rt2 supposed to work on version 2.6.22.1 of the linux kernel?
Yep. The rt patch got updated just as I was building and I forgot to make the change to the next kernel verion. ;/ Good catch!
anyway..thx for your hint! ^-^
etch || 2.6.24-rt1 || NVIDIA 169.09 || fvwm cvs patched || pekwm

Licence: by-nc-sa

ea66
Posts: 7
Joined: 2007-06-13 15:21
Location: Poland

#6 Post by ea66 »

A silly question maybe but is this patch suitable for laptops? I mean, won't this real time kernel force a higher power consumption and as a result shorten the battery life?

User avatar
Telemachus
Posts: 4677
Joined: 2006-12-25 15:53

#7 Post by Telemachus »

It's a good question. As I understand it, the real time patches and other "alternative" scheduling patches have to do with how the kernel handles scheduling of different jobs and preemption. I'm not sure that it has to mean a full-throttle cpu. So, for example, I think you could have a notebook with a rt kernel, but still set the cpu-governor to "on demand" or "conservative" to preserve battery life. But I'll admit, I'm guessing here. Anybody else?

rdegraaf
Posts: 4
Joined: 2007-07-18 21:29

Real-time Linux Kernel Debian Etch

#8 Post by rdegraaf »

I noticed that many people use the kernel from kernel.org while the kernel-source is in the package repository.

Here a how-to for real-time Linux Kernel for Debian Etch.
http://www.rdegraaf.nl/DEBIAN_Etch-realtime

Have fun and keep the latency below few ms :)

User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Real-time Linux Kernel Debian Etch

#9 Post by mzilikazi »

rdegraaf wrote: Here a how-to for real-time Linux Kernel for Debian Etch.
http://www.rdegraaf.nl/DEBIAN_Etch-realtime
While realtime-lsm might still be available in the Debian repos it is deprecated. This is not the same thing as the realtime patch from Ingo Molnar.

You can use source from anywhere you please but what version of Debian you build the kernel for (Etch, Sid) is irrelevant. If you choose to use Debian repos for kernel source you are (obviously) limited to "what's in stock" at the time. If you go to kernel.org you have it all.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

rdegraaf
Posts: 4
Joined: 2007-07-18 21:29

thank you

#10 Post by rdegraaf »

@mzilikazi: thank you for the information, I did not know there was another (new) patch. I also updated the info in the link above.

Best Regards,

Rob

jongi
Posts: 477
Joined: 2007-04-15 02:41

#11 Post by jongi »

As a matter of interest, do you have any particular reason for using make oldconfig instead of say menuconfig?

rdegraaf
Posts: 4
Joined: 2007-07-18 21:29

oldconfig vs menuconfig

#12 Post by rdegraaf »

make oldconfig copies the current settings and asks you for new settings which are introduced in the new config.

User avatar
Telemachus
Posts: 4677
Joined: 2006-12-25 15:53

#13 Post by Telemachus »

Think of it this way, with "make oldconfig" you don't have to search out the new options and you don't have to mess with the old (and presumably functioning) options. Sometimes, though, it can be a bit more complex because a new option can affect an old one. I usually start with "make oldconfig" and then check over key things (filesystems, disc support, wireless, etc.) more fully with "make menuconfig".

User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#14 Post by mzilikazi »

Updated and added bootsplash patch. Bootsplash needs to be applied first against 2.6.22 source then -rt and/or 2.6.23-rc9 patch. Any other patches after that should apply fine.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
garrincha
Posts: 2340
Joined: 2006-06-02 16:38

#15 Post by garrincha »

I made my own bootsplash art, here's a screenshot of the fb console:
Image

Bootsplash and silent bootsplash images:
http://xs220.xs.to/xs220/07412/bootsplash-1024x768.jpg
http://xs320.xs.to/xs320/07412/silent-1024x768.jpg
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

jongi
Posts: 477
Joined: 2007-04-15 02:41

#16 Post by jongi »

If there is a later rt patch againgst say the 2.6.23 kernel, what is the quickest and easiest way to recompile deb files?

User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#17 Post by mzilikazi »

jongi wrote:If there is a later rt patch againgst say the 2.6.23 kernel, what is the quickest and easiest way to recompile deb files?
Using the same kernel source you must first unapply the patch w/ the -R switch:

Code: Select all

cd linux-2.6.23-rt1
bzcat ../patch-2.6.23-rt1.bz2|patch -p1 -R
Then apply the new patch:

Code: Select all

bzcat ../patch-2.6.23-rt2.bz2|patch -p1
Then build as per usual.

Code: Select all

cd ..
mv linux-2.6.23-rt1 linux-2.6.23-rt2
cd linux-2.6.23-rt2
make menuconfig
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

Scoop
Posts: 21
Joined: 2004-09-14 20:18
Location: Australia

#18 Post by Scoop »

Thanx for this howto.
I built a 2.6.23-rt kernel and got nvidia working on Debian sid amd64.

I could not find Virtualization under Processor Type and Features in make menuconfig.
For me it was under Device IDs (I think that's it).

Also I was missing a couple of important pkgs at the start like libncurses5-dev but Googling sorted that out.
Now I'm going to recomplie with a couple of tweaks mentioned in the Alsa low-latency howto.
http://alsa-project.org/main/index.php/ ... ency_howto

Thanks again
Norv

User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#19 Post by mzilikazi »

Scoop wrote: Also I was missing a couple of important pkgs at the start like libncurses5-dev but Googling sorted that out.
Now I'm going to recomplie with a couple of tweaks mentioned in the Alsa low-latency howto.
http://alsa-project.org/main/index.php/ ... ency_howto

Thanks again
Norv
Initially this howto was just a few lines and was aimed mostly at those folks that were already setup to build kernels. More of a crash course in kernel building if you will. It has since grown a bit. :)

Thanks for the ALSA link. I had not seen that before and am anxious to try some of those tweaks.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#20 Post by mzilikazi »

A quick update for patch-2.6.23.1-rt5

Code: Select all

wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.23.tar.bz2
wget http://kernel.org/pub/linux/kernel/v2.6/patch-2.6.23.1.bz2
wget http://fatcat.ftj.agh.edu.pl/~przyboro/other/bootsplash/bootsplash-3.1.6-2.6.23.diff
wget http://www.kernel.org/pub/linux/kernel/projects/rt/patch-2.6.23.1-rt5.bz2
tar xjvf linux-2.6.23.tar.bz2
cd linux-2.6.23 
patch -p1 <../bootsplash-3.1.6-2.6.23.diff
bzcat ../patch-2.6.23.1.bz2 |patch -p1
bzcat ../patch-2.6.23.1-rt5.bz2 |patch -p1
The reason we start with 2.6.23 source is that bootsplash has not been updated for 2.6.23.1 so apply the bootsplash patch first then the 2.6.23.1 patch and finally the rt patch.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

Post Reply