Based mostly on the Kernel-Build-HOWTO found at http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html and on tldp.org if you're lucky. Also see "installing RTAI 3.0" at http://www.fdn.fr/~brouchou/rtai/rtai-doc-prj/installation-guide.html
This document assumes a fast internet connection and some basic knowledge of Linux.. If you don't already have a system up and running that you need to install emc on, you should go with the BDI distro instead, even if you already know how to do all of this in your sleep.
You need to get the "vanilla" kernel source code: version 2.6.10 is the latest version that RTAI has patches for.
cd /usr/local/src/ sudo chmod a+rwx . wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.10.tar.bz2and its signature:
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.10.tar.bz2.sign
and RTAI and the associated kernel patches:
wget http://www.aero.polimi.it/RTAI/rtai-3.2.tar.bz2 wget http://cvs.gna.org/viewcvs/*checkout*/rtai/vulcano/base/arch/i386/patches/hal-linux-2.6.10-i386-r9.patch?rev=HEADand a bunch of other stuff:
sudo apt-get update sudo apt-get install cvs gcc-c++ gcc ncurses-devel pciutils-devel tk-devel tcl-devel gtk+-devel(note: i didn't install gcc-2.95)
Now verify that the kernel sources arrived intact:
gpg --keyserver wwwkeys.pgp.net --recv-keys 0x517D0F0E gpg --verify linux-2.6.10.tar.bz2.sign linux-2.6.10.tar.bz2(well, this didn't work for me, but it ought to dammit!)
Unpack the kernel and rtai patches:
bunzip2 linux-2.6.10.tar.bz2 tar -xf linux-2.6.10.tar bunzip2 rtai-3.2.tar.bz2 tar -xvf rtai-3.2.tarIt is a good idea to see if you can compile a straight vanilla kernel first just to make sure it works, before attempting to compile one with RTAI support. Let's do this now.
First, configure the kernel. This is a subject in its own right. Suffice to say, I left most values at their default settings. (xconfig will try to use the settings of your current kernel)
cd linux-2.6.10 make xconfigturn off ACPI, APM, CPU frequency scaling, module versioning (under general setup,) make sure CONFIG_REGPARM (under firmware drivers) is not on - it wasn't even there when I looked, save, and close the window.
make dep ;#(depreciated? well, can't hurt) make cleanCompile the kernel:
make bzImage(This took 10 minutes on my 900MHz Duron)
ls -l arch/i386/boot/bzImageYou should see something like:
-rw-r--r-- 1 blipkowi users 1563617 Jun 6 01:01 arch/i386/boot/bzImageOtherwise, you are going to have to use your brain! Now, build and install the modules:
make modules ;#(46 minutes) su - make modules_install mkinitrd /boot/initrd-2.6.10.img 2.6.10Install the new kernel:
cp arch/i386/boot/bzImage /boot/bzImage-2.6.10 cp System.map /boot/System.map-2.6.10 ln -s /boot/System.map-2.6.10 /boot/System.map
I edited my /boot/grub/grub.conf file to look like this: (fenn: fix this crappy wiki formatting please!)
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/hda2 # initrd /initrd-version.img #boot=/dev/hda default=1 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Fedora Core (2.6.9-1.667) root (hd0,0) kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/1 rhgb quiet initrd /initrd-2.6.9-1.667.img title Test Kernel (2.6.10) root (hd0,0) kernel /bzImage-2.6.10 ro root=LABEL=/1 initrd /initrd-2.6.10.img
cd /usr/local/src/linux-2.6.10 make clean cd .. tar -zcvf linux-2.6.10.tar.gz linux-2.6.10/
Let's patch the kernel! (finally)
mv linux-2.6.10 linux-2.6.10-adeos cd linux-2.6.10-adeos patch -p1 < ../hal-linux-2.6.10-i386-r9.patch\?rev\=HEAD
Now, compile the kernel as usual. (I wanted to wait until after compiling RTAI to do this, since compiling the kernel takes forever, but the automatic RTAI configuration script assumes that you're compiling on the kernel you want to run on, so we have to wait until we get the patched kernel running to compile RTAI.)
cd /usr/local/src/linux-2.6.10-adeos make xconfig ;#(make sure ACPI, APM, and module versioning are off) make bzImage make modules su make modules_install
Install the new kernel as before...
mkinitrd /boot/initrd-2.6.10-adeos.img 2.6.10 cp arch/i386/boot/bzImage /boot/bzImage-2.6.10-adeos cp System.map /boot/System.map-2.6.10-adeos ln -s /boot/System.map-2.6.10-adeos /boot/System.map
Edit /boot/grub/grub.conf as follows: (and make changes where necessary, i.e. which hard disk partition and default kernel choice)
echo "title RTAI Kernel (2.6.10-adeos)" >> /boot/grub/grub.conf echo " root (hd0,0)" >> /boot/grub/grub.conf echo " kernel /bzImage-2.6.10-adeos ro root=LABEL=/1" >> /boot/grub/grub.conf echo " initrd /initrd-2.6.10-adeos.img" >> /boot/grub/grub.confConfigure RTAI:
cd /usr/local/src/rtai-3.2/ make xconfigchange linux source tree to /usr/local/src/linux-2.6.10-adeos select "exit", and "yes," you wanna save the configuration.
Compile RTAI:
make sure you're running a realtime kernel before you do this
su - cd /usr/local/src/rtai-3.2/ make make installNow, test out RTAI:
cd /usr/realtime/testsuite/kern/latency/ ./runyou should see a bunch of numbers... max_latency is the one we're interested in. You can compare your results to others found on http://issaris.org/rtai/
That's it! If you've got numbers, it means your RTAI is up and running. Now it's time for CompilingEMC2.