Realtime kernel build quickie + bootsplash (or not)

Share your own howto's etc. Not for support questions!
Message
Author
User avatar
Hadret
Posts: 354
Joined: 2007-07-19 13:04
Location: Berlin

#61 Post by Hadret »

So, I made few tests and definitely X.org doesn't start with Realtime-Prempt patch - without it, all works just fine ;)

User avatar
Red-guy
Posts: 252
Joined: 2005-10-16 06:00
Location: Vancouver Island,BC,Canada
Contact:

#62 Post by Red-guy »

For those interested in the bootsplash ....
http://www.patroclo7.org/zenwalk/bootsp ... .6.25.diff

Good luck...I am using it. :-)
Today I think...Tomorrow I solve
"Better to be thought a fool in silence, than to speak and remove all doubt"

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

#63 Post by Scoop »

Hi and thanks for updating this guide..

I am trying to build 2.6.25.4 realtime kernel with rt6 patch.
I am building 32-bit kernel on dual-core 64bit system (already got a 64bit partition with working rt kernel).
I have tried several times but cannot get any modules built. When I boot into the new kernel it boots ok but lsmod shows no modules.

Code: Select all

norv@sid32:~$ uname -a
Linux sid32 2.6.25.4-rt6 #1 SMP PREEMPT RT Fri Jun 13 16:45:28 EST 2008 i686 GNU/Linux
norv@sid32:~$ lsmod
Module                  Size  Used by
norv@sid32:~$ ls /lib/modules
2.6.24-1-686  2.6.25-2-686  2.6.25.4-rt6
norv@sid32:~$ ls /lib/modules/2.6.25-2-686/kernel
arch  crypto  drivers  fs  lib  net  sound
norv@sid32:~$ ls /lib/modules/2.6.25.4-rt6/kernel
drivers
norv@sid32:~$ 
I am running export CONCURRENCY_LEVEL=2 before any make commands and following the howto word by word.
Any ideas?

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

#64 Post by mzilikazi »

Scoop wrote: When I boot into the new kernel it boots ok but lsmod shows no modules.
One way this could happen would be if you had built all of your required drivers directly into the kernel and not as modules.

Are certain pieces of hardware failing?
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

#65 Post by Scoop »

Sound is not working with compiled rt6 kernel but is working with 2.6.25-2 kernel from sid.
But both kernels see my iPod automatically when I plug it in via USB.
lspci sees the soundcard.

What I did:
installed recent lenny businesscard iso and installed base system over net.
Changed lenny to sid in /etc/apt/sources.list
Ran aptitude update, dist-upgrade.
Installed Desktop Environment with tasksel.
Then followed your excellent howto, but used rt6 patch as that is most recent.

Possibilities:
*tasksel did not get all necessary packages, eg. basic pkgs like eog and gedit were not automatically installed by tasksel. But I am running tasksel 2.74.2
*The mirror I'm using doesn't have all packages. (I tried another mirror, no change.)
*The 'make modules' part of make-kpkg is failing.

I added stable and testing entries to sources.list and updated and upgraded but no extra (missing) packages were found.

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

#66 Post by Scoop »

I might reinstall and do tasksel and compile from lenny b4 upgrade to sid.

max
Posts: 3
Joined: 2008-07-02 20:36

#67 Post by max »

Nvidia graphics driver:
You might want to disable Paravirtualization in make menuconfig. The Nvidia driver does not build against kernels with this enabled.
how? I can't find it in menuconfig

EDIT: I've build the kernel but when starting I''get

BUG: using smpreprocessor-id () in preempt [0000000] code: khelper/1012

or something...

@mzilikazi
Can't I use a kernel made by you? I need to build a nvidia driver too...

User avatar
alidh
Posts: 334
Joined: 2007-07-14 21:54

#68 Post by alidh »

I ve build the kernel. Everything seems to went fine.

When I boot the kernel I get:

BUG: using smp_processor_id () in preeemtible [00000000] code khelper/1012


When I want to build my rt2500 driver for my wireless connection I'll get:

Code: Select all

touch config.mk \
		&& /usr/bin/make clean
make[1]: Map '/usr/src/modules/rt2500' wordt binnengegaan
make[1]: Map '/usr/src/modules/rt2500' wordt verlaten
dh_clean
/usr/bin/make  -f debian/rules kdist_clean kdist_config binary-modules
make[1]: Map '/usr/src/modules/rt2500' wordt binnengegaan
touch config.mk \
		&& /usr/bin/make clean
make[2]: Map '/usr/src/modules/rt2500' wordt binnengegaan
make[2]: Map '/usr/src/modules/rt2500' wordt verlaten
dh_clean
for templ in ; do \
    cp $templ `echo $templ | sed -e 's/_KVERS_/2.6.25.4-rt3/g'` ; \
  done
for templ in `ls debian/*.modules.in` ; do \
    test -e ${templ%.modules.in}.backup || cp ${templ%.modules.in} ${templ%.modules.in}.backup 2>/dev/null || true; \
    sed -e 's/##KVERS##/2.6.25.4-rt3/g ;s/#KVERS#/2.6.25.4-rt3/g ; s/_KVERS_/2.6.25.4-rt3/g ; s/##KDREV##/mz1/g ; s/#KDREV#/mz1/g ; s/_KDREV_/mz1/g  ' < $templ > ${templ%.modules.in}; \
  done
# Install module
dh_installdirs lib/modules/2.6.25.4-rt3/kernel/drivers/net/wireless
# Build modules
/usr/bin/make KERNDIR=/lib/modules/2.6.25.4-rt3/source PATCHLEVEL=6
make[2]: Map '/usr/src/modules/rt2500' wordt binnengegaan
make[3]: Map '/home/d/KERNEL/linux-2.6.25.4-rt3' wordt binnengegaan
  CC [M]  /usr/src/modules/rt2500/rtmp_main.o
/usr/src/modules/rt2500/rtmp_main.c: In function ‘RT2500_probe’:
/usr/src/modules/rt2500/rtmp_main.c:327: error: ‘struct net_device’ has no member named ‘wireless_handlers’
make[4]: *** [/usr/src/modules/rt2500/rtmp_main.o] Fout 1
make[3]: *** [_module_/usr/src/modules/rt2500] Fout 2
make[3]: Map '/home/d/KERNEL/linux-2.6.25.4-rt3' wordt verlaten
rt2500.ko failed to build!
make[2]: *** [module] Fout 1
make[2]: Map '/usr/src/modules/rt2500' wordt verlaten
make[1]: *** [binary_modules] Fout 2
make[1]: Map '/usr/src/modules/rt2500' wordt verlaten
make: *** [kdist_build] Fout 2

User avatar
alidh
Posts: 334
Joined: 2007-07-14 21:54

#69 Post by alidh »

Tried to download the prepatched kernel 25.4-rt3
The duration of the building process was about 10 minuts. I didn't seems to have wireless drivers included....





tried 24.7-rt7 building took a lot more time, but it works very badly..

When booting: fails such and so and he didn't recognize the /root system or so...

He don't recognize /dev/hda2 as ext2 file system... but the other kernels do :/

warnings when building:

Code: Select all

/keywords.c
  HOSTCC  scripts/genksyms/lex.o
scripts/genksyms/lex.c:1487: warning: ‘input’ defined but not used
  SHIPPED scripts/genksyms/parse.c
  

C      mm/highmem.o
  CC      mm/madvise.o
  CC      mm/memory.o
  CC      mm/mincore.o
  CC      mm/mlock.o
  CC      mm/mmap.o
mm/mmap.c: In function ‘insert_vm_struct’:
mm/mmap.c:2070: warning: ‘rb_parent’ may be used uninitialized in this function
mm/mmap.c:2070: warning: ‘rb_link’ may be used uninitialized in this function
mm/mmap.c:2069: warning: ‘prev’ may be used uninitialized in this function
mm/mmap.c: In function ‘copy_vma’:
mm/mmap.c:2109: warning: ‘rb_parent’ may be used uninitialized in this function
mm/mmap.c:2109: warning: ‘rb_link’ may be used uninitialized in this function
mm/mmap.c:2108: warning: ‘prev’ may be used uninitialized in this function
mm/mmap.c: In function ‘do_brk’:
mm/mmap.c:1936: warning: ‘rb_parent’ may be used uninitialized in this function
mm/mmap.c:1936: warning: ‘rb_link’ may be used uninitialized in this function
mm/mmap.c:1934: warning: ‘prev’ may be used uninitialized in this function
mm/mmap.c: In function ‘mmap_region’:
mm/mmap.c:1076: warning: ‘rb_parent’ may be used uninitialized in this function
mm/mmap.c:1076: warning: ‘rb_link’ may be used uninitialized in this function
mm/mmap.c:1073: warning: ‘prev’ may be used uninitialized in this function
  CC      mm/mprotect.o


LD      fs/ocfs2/cluster/built-in.o
  LD      fs/ocfs2/dlm/built-in.o
  CC      fs/partitions/check.o
fs/partitions/check.c: In function ‘add_partition’:
fs/partitions/check.c:393: warning: ignoring return value of ‘kobject_add’, declared with attribute warn_unused_result
fs/partitions/check.c:396: warning: ignoring return value of ‘sysfs_create_link’, declared with attribute warn_unused_result
fs/partitions/check.c:403: warning: ignoring return value of ‘sysfs_create_file’, declared with attribute warn_unused_result
  CC      fs/partitions/acorn.o

      drivers/acpi/tables/tbfadt.o
drivers/acpi/tables/tbfadt.c: In function ‘acpi_tb_create_local_fadt’:
include/asm/string_32.h:65: warning: array subscript is above array bounds
  LD      drivers/acpi/tables/built-in.o

CC      drivers/pci/pci.o
  CC      drivers/pci/quirks.o
  CC      drivers/pci/pci-driver.o
  CC      drivers/pci/search.o
drivers/pci/search.c: In function ‘pci_find_slot’:
drivers/pci/search.c:135: warning: ‘pci_find_device’ is deprecated (declared at include/linux/pci.h:493)
drivers/pci/search.c: At top level:
drivers/pci/search.c:478: warning: ‘pci_find_device’ is deprecated (declared at drivers/pci/search.c:283)
drivers/pci/search.c:478: warning: ‘pci_find_device’ is deprecated (declared at drivers/pci/search.c:283)
drivers/pci/search.c:479: warning: ‘pci_find_slot’ is deprecated (declared at drivers/pci/search.c:132)
drivers/pci/search.c:479: warning: ‘pci_find_slot’ is deprecated (declared at drivers/pci/search.c:132)
  CC      drivers/pci/pci-sysfs.o
  CC      drivers/pci/rom.

CC [M]  arch/x86/kernel/apm_32.o
arch/x86/kernel/apm_32.c: In function ‘suspend’:
arch/x86/kernel/apm_32.c:1192: warning: ‘pm_send_all’ is deprecated (declared at include/linux/pm_legacy.h:16)
arch/x86/kernel/apm_32.c:1227: warning: ‘pm_send_all’ is deprecated (declared at include/linux/pm_legacy.h:16)
arch/x86/kernel/apm_32.c: In function ‘check_events’:
arch/x86/kernel/apm_32.c:1340: warning: ‘pm_send_all’ is deprecated (declared at include/linux/pm_legacy.h:16)

CC [M]  fs/afs/dir.o
fs/afs/dir.c: In function ‘afs_d_revalidate’:
fs/afs/dir.c:566: warning: ‘fid.vnode’ may be used uninitialized in this function
fs/afs/dir.c:566: warning: ‘fid.unique’ may be used uninitialized in this function
  CC [M]  fs/afs/file.o
EDIT: is this tutorial for experienced kernel builders or can anyone just follow the steps?

Edit: 23.9-rt12 fails to build

Code: Select all

LD      init/built-in.o
  LD      .tmp_vmlinux1
kernel/built-in.o: In function `getnstimeofday':
(.text+0x1f1d0): undefined reference to `__umoddi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0x1f2be): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0x1f2e1): undefined reference to `__umoddi3'
kernel/built-in.o: In function `timekeeping_resume':
timekeeping.c:(.text+0x1f421): undefined reference to `__udivdi3'
timekeeping.c:(.text+0x1f444): undefined reference to `__umoddi3'
kernel/built-in.o: In function `update_wall_time':
(.text+0x1fbb1): undefined reference to `__udivdi3'
kernel/built-in.o: In function `update_wall_time':
(.text+0x1fbd4): undefined reference to `__umoddi3'
kernel/built-in.o: In function `update_wall_time':
(.text+0x1fc76): undefined reference to `__udivdi3'
kernel/built-in.o: In function `update_wall_time':
(.text+0x1fc99): undefined reference to `__umoddi3'
make[1]: *** [.tmp_vmlinux1] Fout 1
make[1]: Map '/home/d/KERNEL/linux-2.6.23.9-rt12' wordt verlaten
make: *** [debian/stamp-build-kernel] Fout 2

real    8m3.863s
user    6m42.849s
sys     1m1.300s
SHOOT!!!!!!

User avatar
alidh
Posts: 334
Joined: 2007-07-14 21:54

#70 Post by alidh »

Tried a new one 25.8-rt7

errors which i don't get with the normal kernel

http://pastebin.com/m5bc649d

getdf
Posts: 2
Joined: 2008-07-09 08:06

#71 Post by getdf »

Hi

Is there one patch for linux-2.6.22.1.tar.bz2 ?

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

#72 Post by garrincha »

getdf wrote:Hi

Is there one patch for linux-2.6.22.1.tar.bz2 ?
You need to look under "older" directory:
http://www.kernel.org/pub/linux/kernel/ ... /rt/older/

There is also a bootsplash patch for it as well:
http://fatcat.ftj.agh.edu.pl/~przyboro/ ... ootsplash/
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

getdf
Posts: 2
Joined: 2008-07-09 08:06

#73 Post by getdf »

There is not patch-2.6.22.1-rtx.bz2

can i use patch-2.6.22.1-rtx-broken-out.tar.bz2 ???

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

#74 Post by garrincha »

getdf wrote:There is not patch-2.6.22.1-rtx.bz2

can i use patch-2.6.22.1-rtx-broken-out.tar.bz2 ???
http://itmaze.com.au/articles/linux-tin ... t_vs_patch
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

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

#75 Post by mzilikazi »

I decided to write the latest RT kernel howto a little differently since it doesn't exactly follow the same procedure as the last one and I thought it would be good to have both howto's in place. If you want 2.6.26.5-rt8 read on. All of this is done as user!

Code: Select all

mkdir KERNEL
cd KERNEL
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.5.tar.bz2
wget http://jenggo.net/donlod/bootsplash-3.1.6-2.6.26.diff.tar.gz
wget http://www.kernel.org/pub/linux/kernel/projects/rt/patch-2.6.26.5-rt8.gz
unp linux-2.6.26.5.tar.bz2
unp bootsplash-3.1.6-2.6.26.diff.tar.gz
mv linux-2.6.26.5 linux-2.6.26.5-rt8
cd linux-2.6.26.5-rt8
patch -p1 <../bootsplash-3.1.6-2.6.26.diff
zcat ../patch-2.6.26.5-rt8.gz |patch -p1
Note the Makefile in your kernel source. It will automatically update the EXTRAVERSION string for you. In this case:

Code: Select all

VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 26
EXTRAVERSION = .5-rt8
NAME = Rotary Wombat
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. You must be in the same dir as your kernel source.

Code: Select all

apt-get update;apt-get install nvidia-kernel-source
Nvidia 173.14.09-5 doesn't play nice with the latest RT patch. If you try to build nvidia it will fail something like this:

Code: Select all

/usr/src/modules/nvidia-kernel/nv.c:1887: error: implicit declaration of function ‘__SEMAPHORE_INITIALIZER’
/usr/src/modules/nvidia-kernel/nv.c:1887: error: invalid initializer
/usr/src/modules/nvidia-kernel/nv.c: In function ‘nv_lock_init_locks’:
/usr/src/modules/nvidia-kernel/nv.c:3783: error: invalid initializer
/usr/src/modules/nvidia-kernel/nv.c:3784: error: invalid initializer
make[4]: *** [/usr/src/modules/nvidia-kernel/nv.o] Error 1
make[3]: *** [_module_/usr/src/modules/nvidia-kernel] Error 2
make[3]: Leaving directory `/home/glenn/KERNEL/linux-2.6.26.5-rt8'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
make[2]: *** [module] Error 1
make[2]: Leaving directory `/usr/src/modules/nvidia-kernel'
make[1]: *** [build-stamp] Error 2
make[1]: Leaving directory `/usr/src/modules/nvidia-kernel'
make: *** [kdist_image] Error 2
BUILD FAILED!
See /var/cache/modass/nvidia-kernel-source.buildlog.2.6.26.5-rt8.1221183345 for details.
Build failed. Press Return to continue...
Fortunately, it's not too difficult to work around. :)

Code: Select all

apt-get update;apt-get install nvidia-kernel-source
sed -i '/__SEMAPHORE_INITIALIZER/ s/__SEMAPHORE_INITIALIZER/__COMPAT_SEMAPHORE_INITIALIZER/' /usr/src/modules/nvidia-kernel/nv-linux.h
sed -i '/struct semaphore/ s/struct semaphore/struct compat_semaphore/' /usr/src/modules/nvidia-kernel/nv-linux.h
If you run your usual m-a line for nvidia it will unpack the source again and your edits to nv-linux.h will be wasted. Lucky for us m-a has a workaround for this too in the form of the -O switch.

Code: Select all

man m-a
/snip/

Code: Select all

-O

       --not-unpack
              Never unpack the source tarball. Usefull after manual manipulation of module source.
Just put that switch right in front of the module you wish to build like so:

Code: Select all

m-a -t -k linux-2.6.26.5-rt8/ -l linux-2.6.26-5-rt8 a-b -O nvidia
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

#76 Post by Scoop »

Thank you mzilikazi for the latest update.
I just built a 2.6.26-5-rt9 nvidia kernel from your instructions. I just changed rt8 to rt9 where applicable as rt9 is the latest patch.
Thanks again!

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

#77 Post by mzilikazi »

Scoop wrote:Thank you mzilikazi for the latest update.
I just built a 2.6.26-5-rt9 nvidia kernel from your instructions. I just changed rt8 to rt9 where applicable as rt9 is the latest patch.
Thanks again!
Thanks for the reply! It's always nice to get confirmation that something works. ;) It's just too easy to make typos.
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

#78 Post by garrincha »

For those with nvidia legacy cards, do the same steps as in mzilikazi's recent post. The lastest nvidia legacy version 96xx (and I assumed 71xx as well) also doesn't play nice with real-time patch as I discovered a few weeks ago when I returned to compiling a RT kernel and you'll get the same error as in mzilikazi's. I solved it by manually editing the nv-linux.h file, but basically it's same as mziliazi's.

Install nvidia using modules-assistant & auto-assistant:

Code: Select all

# apt-get install module-assistant gcc nvidia-kernel-common
# m-a update
# m-a prepare
# m-a a-i nvidia-kernel-legacy-96xx-source
If you get the error, do this - note the location of nv-linux.h:

Code: Select all

# sed -i '/__SEMAPHORE_INITIALIZER/ s/__SEMAPHORE_INITIALIZER/__COMPAT_SEMAPHORE_INITIALIZER/' /usr/src/modules/nvidia-kernel-legacy-96xx/nv/nv-linux.h
# sed -i '/struct semaphore/ s/struct semaphore/struct compat_semaphore/' /usr/src/modules/nvidia-kernel-legacy-96xx/nv/nv-linux.h
To avoid losing the edit to nv-linux.h file:

Code: Select all

# m-a a-i -O nvidia-kernel-legacy-96xx-source
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

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

#79 Post by Scoop »

Audio users note:
The 2.6.26 kernel has major problems for audio, esp. MIDI. See
http://kerneltrap.org/Linux/Removing_th ... ernel_Lock
2.6.25-rt8 is reported to be OK for audio and nvidia drivers so I will try build that.

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

#80 Post by jongi »

Do I run

Code: Select all

export CONCURRENCY_LEVEL=2
from the command line before i start the make-kpkg process?
Desktop: Debian (Sid) 64-bit, Gentoo 64-bit and Ubuntu Jaunty 64-bit
Laptop: Gentoo 32-bit
MythTV: Debian (Testing) 32-bit

Post Reply