Why in the world?
I was bored and thought that I could write this HOWTO.. I know that there are many HOWTOs for building the Linux kernel, but in this HOWTO I'm going to show you how to make a realtime kernel with the NVIDIA driver modules. It is a little harder than it sounds, this is because of some changes in the new kernel source.
Let's get started!
This HOWTO assumes that you are an advanced Linux user, you can compile programs and that you know exactly what does each kernel option do. Also, I'm not going to cover on how to do this without a GUI.. So you need an X Server and a Window Manager or a Desktop Environment in order to build the kernel with the following instructions..
Before starting, I need to say that for building the kernel, all following commands need to be run as root.
So, let's get started.. Firstly, let's edit the kernel-img.conf file:
Code: Select all
cp /etc/kernel-img.conf /etc/kernel-img.conf.backup
xedit /etc/kernel-img.conf
Now save the file by pressing "Save" twice in the upper corner. Now quit xedit by pressing "Quit" in the upper corner.do_symlinks = Yes
warn_initrd = no
ramdisk = /usr/sbin/mkinitramfs /usr/sbin/mkinitrd
do_bootloader = no
do_bootfloppy = no
link_in_boot = no
postinst_hook = /usr/sbin/update-grub
postrm_hook = /usr/sbin/update-grub
Now let's get ready for building the kernel with the realtime preemption patch from Ingo Molnar and the NVIDIA driver:
Code: Select all
cd /usr/src/
apt-get install bzip2 binutils kernel-package debhelper module-init-tools initrd-tools initramfs-tools libqt3-mt-dev
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2
wget http://people.redhat.com/mingo/realtime-preempt/patch-2.6.20-rt8
wget http://ftp.debian.org/debian/pool/non-free/n/nvidia-graphics-drivers/nvidia-kernel-source_1.0.9746-2_`dpkg --print-architecture`.deb
wget http://ftp.debian.org/debian/pool/non-free/n/nvidia-graphics-drivers/nvidia-glx_1.0.9746-2_`dpkg --print-architecture`.deb
tar xvjf linux-2.6.20.tar.bz2
dpkg -x nvidia-kernel-source*.deb /
rm nvidia-kernel-source*.deb
tar xvzf nvidia-kernel-source.tar.gz
cd linux-2.6.20
patch -p1 < ../patch-2.6.20-rt8
Code: Select all
xedit /usr/src/modules/nvidia-kernel/nv/nv.c
And now let's edit the other file:
Code: Select all
xedit /usr/src/linux-2.6.20/arch/i386/kernel/paravirt.c
Press "Control-R" and select "Forward" to search for "EXPORT_SYMBOL_GPL(paravirt_ops)" and replace it with "EXPORT_SYMBOL(paravirt_ops)". Press "Replace" and save the file by pressing "Save" twice in the upper corner. Now quit xedit by pressing "Quit" in the upper corner.
Now we have edited the needed files.. let's proceed with configuring and building the kernel:
Code: Select all
cd /usr/src/linux-2.6.20/
make xconfig
Now you need to configure the rest of the kernel by your own. Finally, save it by clicking "File -> Save" and then "File -> Quit".Processor type and features -> Paravirtualization support (EXPERIMENTAL) -> Say Y
Processor type and features -> Preemption Mode -> Complete Preemption (Real-Time) -> Say Y
Processor type and features -> Timer frequency -> 1000 HZ -> Say Y
Now as the kernel is configured, we can build it. But to make the kernel more unique, let's edit the following file:
Code: Select all
xedit Makefile
Now it's finally time for building the kernel:
Code: Select all
make-kpkg --initrd --revision=synux1 kernel_image modules_image
The above command builds the kernel. This will take some time (on some machines even hours), but on my machine it takes only 15 minutes, so that's why I build kernels alot in a day.
.......After drinking coffee and coming back, my kernel compilation was already ready. Fine, let's do this to install the kernel:
Code: Select all
cd /usr/src/
dpkg -i linux-image*.deb
dpkg -i nvidia-kernel*.deb
dpkg -i nvidia-glx*.deb
Cheers,
Synux