[LWN Logo]

Date: Thu, 11 Nov 1999 16:16:57 -0800
From: Phil Wilshire <philwil@on-ramp.ior.com>
To: "rtl@rtlinux.cs.nmt.edu" <rtl@rtlinux.cs.nmt.edu>
Subject: [rtl] Version RTL 2.0 Install guide

PLease use / read / comment


Installing RT Linux...
NMT RTLinux

    This guide is free; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.



(C) Phil Wilshire  1999


The steps are...
============================================================================
1 ... unpack the kit
============================================================================



The steps I use are :

1.1 get a clean kernel from ftp.us.kernel.org
1.2 get the patch file FOR THAT KERNEL.

1.3  move your current copy of /usr/src/linux ( if it is not a link ) to
     /usr/src/oldlinux



    check with
    ls -l  /usr/src
    links look like this

ls -l /usr/src/linux
lrwxrwxrwx   1 root     root           17 Aug 17  1998 /usr/src/linux ->
va-linux-2.0.34-1
( in this case just delete the link and do the untar )

    If you have to move a tree do
    cd /usr/src
    mv linux oldlinux


1.4 Create a working directory .. I use /opt/rtl

    mkdir /opt/rtl

  You may need to do this as root .

  loosen up restrictions on the new directory
    chmod a+rw /opt/rtl

  This will allow you as a user to access this.
  NOTE: do most of your work as a regular user .. it's safer.
 
1.5 Untar the RTLinux tarball into /opt/rtl

   ie if the tarball is in /home/wilshire/download/rtl/rtlinux-2.0.tgz

   cd /opt/rtl
   tar xvzf /home/wilshire/download/rtl/rtlinux-2.0.tgz

   This will create 
   /opt/rtl/rtlinux-2.0



1.6 Look in the INSTALL file and follow the instructions.
   for example

   ********************INSTALL******************************
1. put a fresh copy of Linux 2.2.13 in this directory under the name
"linux.

2. cd linux
   patch -p1 < ../kernel_patch
   ***********************************************************

This means take the linux-2.2.13.tar.gz tarball and put it where the 
install guide suggests.

   ie if the tarball is in
/home/wilshire/download/linux/linux-2.2.13.tar.gz

   cd /opt/rtl/rtlinux-2.0
   tar xvzf /home/wilshire/download/linux/linux-2.2.13.tar.gz

============================================================================
2.0 Patch the Kernel
============================================================================

2.1 Run the patch

    Now you can patch.

  cd /opt/rtl/rtlinux-2.0/linux 
  patch -p1 < ../kernel_patch


2.2 Check for Rejects
   There should be no none nada rejects.


Here is an example of a reject ...


--------------------------
Patching file arch/i386/kernel/irq.c using Plan A...
Hunk #1 failed at 39.
Hunk #2 succeeded at 236.
Hunk #3 succeeded at 280.

Hunk #21 succeeded at 1324.
1 out of 21 hunks failed--saving rejects to arch/i386/kernel/irq.c.rej
----------------------------------
You find any rejects like this

  cd /opt/rtl/rtlinux-2.0/linux 
  find ./ -name *.rej
 ./arch/i386/kernel/irq.c.rej

You can only patch once ( well sort of ) so start again if you trip up.
cleanup

  cd /opt/rtl/rtlinux-2.0/
  rm -rf linux
  tar xvzf /home/wilshire/download/linux/linux-2.2.13.tar.gz

============================================================================
3.0 Configure and compile the Kernel
============================================================================

3.1 look at what's running

Now we need to configure and compile the patched kernel.
First we need to look at what's running.


[wilshire@pasrack3 linux]$ /sbin/lsmod
Module                  Size  Used by
3c59x                  18952   1

Then we need to configure our new kernel.
We see the modules used and make sure that we 
configure the new kernel for the same ones.

now type 

3.2 Configure the kernel

cd /opt/rtl/rtlinux-2.0/linux
make menuconfig

and check options as required

Code maturity level options  ---> yes

Processor type and features  --->
	(PPro/6x86MX) Processor family

	[*] Symmetric multi-processing support 
	[*] Hard realtime support

Loadable module support  --->
	[*] Enable loadable module support
	[ ] Set version information on all symbols for modules
	[ ] Kernel module loader
General setup  --->         accept defaults
Plug and Play support  ---> accept defaults
Plug and Play support  ---> accept defaults
Networking options  --->    accept defaults
SCSI support  --->          accept defaults

Network device support  --->
	Ethernet (10 or 100Mbit)  --->
		[*] 3COM cards
		<M> 3c590/3c900 series (592/595/597) "Vortex/Boomerang" support
	( in this case )
and finally

Kernel hacking  --->
	[*] Magic SysRq key
	
( this may come in handy )

Right having done all this ...
      save the configuration
      build the kernel

3.4 Compile the kernel

[wilshire@pasrack3 linux]$ make dep; make clean; make bzImage

go for a cup of tea , read your mail, write a manual ....10 minutes or
so.

You will end up with a new Kernel a new Symbol.map etc.

BEFORE you do anything else... set your system up to use this new kernel


go to root
su

3.5 Make/ Install the modules

make the modules
  make modules; make modules_install
watch the result here
 
[root@pasrack3 linux]# make modules_install
Installing modules under /lib/modules/2.2.13-RTL2.0/net
Installing modules under /lib/modules/2.2.13-RTL2.0/misc
the 
 /lib/modules/2.2.13-RTL2.0
shows you that just about every thing is well.



============================================================================
4.0 Set up boot / Lilo
============================================================================
copy the boot image to the right place
   cp arch/i386/boot/bzImage /boot/bzImageRTL20

copy the Symbol.map to the right place
   cp Symbol.map /boot/Symbol.mapRTL20

make the new symbol.map " active"
   rm /boot/Symbol.map
   ln -s /boot/Symbol.mapRTL20 /boot/Symbol.map

edit /etc/lilo.conf

It should look like ...
=======================================================
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50


image=/boot/bzImageRTL20
        label=linuxRTL20
        root=/dev/hda1
        append="mem=126M"
        read-only

image=/boot/bzImage
        label=linux
        root=/dev/hda1
        append="mem=126M"
        read-only
======================================================
#<keep another around just in case >

Run Lilo

[root@pasrack3 linux]# /sbin/lilo
Added linuxRTL20 *
Added linux


============================================================================
5.0 Boot 
============================================================================
Now is the time to reboot


Having rebooted we need to move the linux source link to our new source
tree.

rm /usr/src/linux
ln -s /opt/rtl/rtlinux-2.0/linux /usr/src/linux

============================================================================
6.0 Make the Modules
============================================================================
Now we can make the rtl modules

Check and adjust the date


[root@pasrack3 rtl]# date
Wed Nov 10 23:14:18 PST 1999
[root@pasrack3 rtl]# date 11111452
Thu Nov 11 14:52:00 PST 1999


cd /opt/rtl/rtlinux-2.0/rtl
make

....

Now you need to become root and do "make install"
[root@pasrack3 rtl]# make install

Testing for the mbuff device... mknod /dev/mbuff c 10 254
Testing for FIFOs... already existent.


Instaling modules in /lib/modules/2.2.13-RTL2.0/misc
/sbin/depmod -a
Installing man pages to /usr/local/man
Installing header /usr/include/rtlinux
install -c -m 644 rtl.mk /usr/include/rtlinux;

=======================set up your path============================
try lsmod
if you get 
[root@pasrack3 fp]# lsmod
bash: lsmod: command not found

do this
export PATH=/sbin:/$PATH
then try again

[root@pasrack3 fp]# lsmod
Module                  Size  Used by
3c59x                  19176   1 
=====================================================================
That's it for the main install..

============================================================================
7.0 Run the examples
============================================================================
Now for the examples

Grrrh I sent a load of patches to RTL they did not all make the cut..

=========================fp=====================================
cd examples
cd fp
make
mv rt_process.o fp_tasks.o

cd ../../; ./insrtl
cd examples/fp
make test

[root@pasrack3 fp]# make test
insmod fp_tasks.o
./fptest
[root@pasrack3 fp]# lsmod
Module                  Size  Used by
fp_tasks                 892   0  (unused)
rtl_fifo                5944   0  (unused)
rtl_posixio             6952   0  [rtl_fifo]
rtl_sched              35364   0  [fp_tasks rtl_posixio]
rtl_time                8424   0  [fp_tasks rtl_sched]
3c59x                  19176   1 

[root@pasrack3 fp]# rmmod fp_tasks
=====================================================================

[root@pasrack3 examples]# cd ../frank
[root@pasrack3 frank]# make
[root@pasrack3 frank]# make test 
.....
FIFO 2: Zappa 
FIFO 1: Frank 
FIFO 2: Zappa 
FIFO 2: Zappa 
FIFO 2: Zappa 
FIFO 1: Frank 
frank_app: now sending commands to stop RT-tasks

This all works
=============================================================================
[root@pasrack3 frank]# cd ../hello
[root@pasrack3 hello]# make

[root@pasrack3 hello]# make test
This is the simplest RTL program
First we remove any existing rtl-modules
You may see error warnings from "make" - ignore them
Type <return> to continue

rmmod sound
rmmod: module sound not loaded
make: [test] Error 1 (ignored)
rmmod rt_process
rmmod: module rt_process not loaded
make: [test] Error 1 (ignored)
rmmod frank_module
rmmod: module frank_module not loaded
make: [test] Error 1 (ignored)
(cd ../../; ./rmrtl)
Now insert the fifo and scheduler
Type <return> to continue

(cd ../../; ./insrtl)
Now start the real-time tasks  module
Type <return> to continue

Now let's stop the application
Type <return> to finish

[root@pasrack3 hello]# 
=========================look on the console to see any
messages=========

cd ../measurements
make 
make test
^C

min:     9152, max:    17632
make: *** [test] Interrupt

[root@pasrack3 measurements]# 


to look at some stuff try this
./monitor > m.out&
sleep(25)
./histplot m.out m.res
cat m.res

=====================================================================

That's enough for the examples....











=====================================================================
Example Reboot Problem.

I'm running RedHat and my ehternet card 
doesn't work now...

Solution #1 
something to do with 
cat /proc/version >/lib/modules/2.2.13-RTL2.0/.rhkmvtag
but this still does not work. I am working on it.


So

Solution #2
add 
# load up eth0
/sbin/modprobe eth0

to /etc/rc.d/rc.sysinit 
near the end



Hope this helps
    Phil Wilshire

--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.cs.nmt.edu OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.cs.nmt.edu
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/