4. Installation of RTAI m1
==========================

4.1 Source
----------
* Linux-Kernel 2.4.20
   http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.20.tar.z2
* RTAI m1
   http://www.aero.polimi.it/RTAI/rtai-m1.tgz

4.2 Extracting
--------------
# cd /usr/src/

* Remove existing links
# rm linux
# rm linux-2.4

* Copy the files into the directory /usr/src/
# cp /tmp/linux-2.4.20.tar.bz2 .
# cp /tmp/rtai-m1.tgz .

* Test the files
# tar -tjf linux-2.4.20.tar.bz2
# tar -tzf rtai-m1.tgz

* Extract the files
# tar -xjf linux-2.4.20.tar.bz2
# tar -xzf rtai-m1.tgz

* Change owner
# chown -R root:root linux-2.4.20/
# chown -R root:root rtai-m1/

4.3 Patching
------------
* Create new links
# mv linux-2.4.20/ linux-2.4.20-rthal5g
# ln -s linux-2.4.20-rthal5g/ linux
# ln -s rtai-m1/ rtai
# cd linux/

* Test kernel patch
# patch -p1 --dry-run < ../rtai/rtai-core/arch/i386/patches/rthal-5g-2.4.20.diff

* Perform patch
# patch -p1 < ../rtai/rtai-core/arch/i386/patches/rthal-5g-2.4.20.diff

4.4 Kernel Configuration
------------------------
# cd /usr/src/linux/
# make menuconfig
* Processor type and features
+ Real-Time Hardware Abstraction Layer (NEW)

# cp .config my_config
# make mrproper
# cp my_config .config
# make oldconfig
# make dep
# make

4.5 Kernel Installation
-----------------------
* Create a kernel image
# make bzImage

* Copy the image into the boot partition
# cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.20-rthal5g

* Make and install kernel modules
# make modules modules_install

4.6 LILO Configuration
----------------------
* Add an entry for rtai:
# vi /etc/lilo.conf
+ image=/boot/vmlinuz-2.4.20-rthal5g
+	label=rtai
+	read-only
+	root=/dev/hda2

* Update changes
# lilo

4.7 RTAI Configuration
----------------------
# cd /usr/src/rtai/
# make clean
# make menuconfig
* Configure RTAI

# make

4.8 RTAI Installation
---------------------
# make install

4.9 Reboot
----------
# lilo -R rtai
# reboot