Since they were requested ...

NOTES ON INSTALLING NMT RT-Linux Kernel-2.2.10+Beta10
====================================================


****> READ ALL THESE NOTES BEFORE PROCEEDING ...


These notes pertain to kernel v2.2.10 and RT-Linux Beta10.
Decide now if you require the kernel in bz2 or gz format.
Since the beta10 real time extensions come in gz format, I
will assume you get the kernel the same way.

Caveat Emptor: these instructions worked for me. Your
mileage may vay. Please report problems (but do not expect me 
to fix them). By the way, I am installing this on a dual 
Pentium II 350MHz with 256Mb of main memory so all of the 
below is just a good mornings work :-)

0. Login as root and watch your typing!

                                                    CHECK HERE WHEN OK ______

1. Get the appropriate kernel from ftp.kernel.org (if the
   load is too high try ftp.us.kernel.org or something
   appropriate to your country):

      % cd /usr/src
      % ftp ftp.kernel.org
      username: anonymous
      password: [EMAIL PROTECTED]
      ftp> cd pub/linux/kernel/v2.2
      ftp> binary
      ftp> get linux-2.2.10.tar.gz
      ftp> quit

                                                    CHECK HERE WHEN OK ______

2. Move any old linux directory and unpack the kernel.

      % if [ -e linux ]; then mv linux linux.old; fi
      % gunzip -c linux-2.2.10.tar.gz | tar xvf -
   __OR__
      % bunzip2 -c linux-2.2.10.tar.bz2 | tar xvf -

                                                    CHECK HERE WHEN OK ______

3. Go to the linux directory and prepare the kernel. Make
   sure the asm include directory points to the correct
   directory in the linux source tree for your architechture!
 
      % cd linux
      % rm /usr/include/asm /usr/include/linux /usr/include/scsi
      % ln -s /usr/src/linux/include/asm-i386  /usr/include/asm
      % ln -s /usr/src/linux/include/linux     /usr/include/linux
      % ln -s /usr/src/linux/include/scsi      /usr/include/scsi
      % make mrproper

                                                    CHECK HERE WHEN OK ______

4. Configure the kernel for your system. The command "make config"
   should work on any dumb terminal but I prefer to use the
   menu-driven X-interface:

      % make xconfig

   Remember to select SMP if you require it plus the enhanced real
   time clock support! 

                                                    CHECK HERE WHEN OK ______

5. Make the dependencies and clean up before proceeding:

      % make dep
      % make clean

                                                    CHECK HERE WHEN OK ______

6. Decide which kernel image you want to build. In my humble opinion the
   safest at this stage is bzdisk which compresses the kernel and makes
   a boot floppy. So, put a floppy in the drive and type:

      % make bzdisk 

   (other options are: % make zImage __OR__ % make bzImage)

                                                    CHECK HERE WHEN OK ______

7. The kernel should make without errors. If you get errors check your
   distribution and options and try again. Start at note 1.

                                                    CHECK HERE WHEN OK ______

8. Assuming your kernel built OK, build and install the modules:

      % make modules
      % make modules_install

                                                    CHECK HERE WHEN OK ______

9. Prepare your machine for a reboot. The following just cleans up
   some files (which may not be present on your system):

      % rm /var/log/messages
      % touch /var/log/messages
      % rm /var/log/kernel
      % touch /var/log/kernel
      % kill -HUP `cat /var/run/syslogd.pid`

   If the above commands do not work, ignore them as they are purely
   housecleaning options. There is a utility relog appended to do this.

                                                    CHECK HERE WHEN OK ______

10. You can boot from the floppy by putting the floppy in the drive
    and typing:

      % reboot

   The system should boot normally (for your architecture). If it does
   not, and you have LILO, try step 11. If both fail, return to step
   1 and try again.

                                                    CHECK HERE WHEN OK ______

11. You can boot from the hard drive with LILO. Here I force
    the /etc/lilo.conf file to accept a new boot sequence but it
    might be easier for you to edit the file with vi, emacs etc.
    Be aware that you partition might not be called /dev/hda3!
    Note the TABs in the following echo statements.

      % cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage2210
      % cp /etc/lilo.conf /etc/lilo.conf.old
      % echo "image=/boot/bzImage2210" >> /etc/lilo.conf
      % echo "  label=linux2210"       >> /etc/lilo.conf
      % echo "  root=/dev/hda3"        >> /etc/lilo.conf
      % echo "  read-only"             >> /etc/lilo.conf
      % /sbin/lilo
      % reboot

    and at the LILO: prompt type, linux2210. You should boot the new
    kernel directly off the hard disk.

                                                    CHECK HERE WHEN OK ______

12. The rest of these notes assume that the regular linux kernel was
    built successfully. Indeed, I am installing the beta10 RT-Linux
    extensions from a working system booted with the v2.2.10 kernel.
    First, back up the configured kernel tree that you just made 
    and clean the directories:

      % cd /usr/src
      % tar czvf /usr/src/linux-2.2.10.tar.gz linux
      % cd /usr/src/linux
      % make clean

                                                    CHECK HERE WHEN OK ______

13. Unpack the RT-Linux extensions in beta10:
        NB: The created directory is /usr/src/beta10/rtl etc!

      % cd /usr/src
      % gunzip -c beta10.tgz | tar xvf -

                                                    CHECK HERE WHEN OK ______

14. Return to the linux tree and patch the kernel:

      % cd /usr/src/linux
      % patch -p1 < /usr/src/beta10/kernel_patch > ../patch.beta10 2>&1

                                                    CHECK HERE WHEN OK ______

15. Check the patch file. The output I received is shown below and
    reports no errors:

      % more ../patch.beta10
      patching file `Makefile'
      patching file `arch/i386/config.in'
      patching file `arch/i386/kernel/entry.S'
      patching file `arch/i386/kernel/i386_ksyms.c'
      patching file `arch/i386/kernel/io_apic.c'
      patching file `arch/i386/kernel/irq.c'
      patching file `arch/i386/kernel/irq.h'
      patching file `arch/i386/kernel/smp.c'
      patching file `arch/i386/kernel/time.c'
      patching file `fs/proc/array.c'
      patching file `fs/proc/root.c'
      patching file `include/asm-i386/irq.h'
      patching file `include/asm-i386/rtl_sync.h'
      patching file `include/asm-i386/system.h'
      patching file `include/asm-i386/timex.h'
      patching file `include/linux/cons.h'
      patching file `include/linux/major.h'
      patching file `include/linux/proc_fs.h'
      patching file `include/linux/rtl.h'
      patching file `init/main.c'
      patching file `kernel/Makefile'
      patching file `kernel/ksyms.c'
      patching file `kernel/rtl.c'


                                                    CHECK HERE WHEN OK ______

16. Now go back and remake the kernel, modules, modules_install and
    reboot from the floppy or hard drive as before. Note that I call
    the new image on disk rtImage as opposed to bzImage (but you can
    call it whatever you like):

    NB: It is here that one must re-do the config as the "Processor Type
    and Features" menu now includes the "Hard realtime support" which is
    N by default. If you are brave, you could patch your previous .config
    file with CONFIG_RTL=y.

      % make xconfig
      % make dep
      % make bzdisk
      % make modules
      % make modules_install

      % rm /var/log/messages
      % touch /var/log/messages
      % rm /var/log/kernel
      % touch /var/log/kernel
      % kill -HUP `cat /var/run/syslogd.pid`

      % cp /usr/src/linux/arch/i386/boot/bzImage /boot/rtImage2210
      % cp /etc/lilo.conf /etc/lilo.conf.old
      % echo "image=/boot/rtImage2210" >> /etc/lilo.conf
      % echo "  label=RTL-2210"        >> /etc/lilo.conf
      % echo "  root=/dev/hda3"        >> /etc/lilo.conf
      % echo "  read-only"             >> /etc/lilo.conf
      % /sbin/lilo
      % reboot

                                                    CHECK HERE WHEN OK ______

17. You should now be able to boot the linux kernel modified for
    real time performance. The login banner I get is:

      Red Hat Linux Release 5.2 (Apollo)
      Kernel 2.2.10-RTL_BETA10 on an i686

      login:

                                                    CHECK HERE WHEN OK ______

18. Now go to the beta directory and read the READMEFIRST file:

      % cd /usr/src/beta10
      % more READMEFIRST

                                                    CHECK HERE WHEN OK ______

19. The beta release will not make from the unpacking directory so you
    need to change some things around. Also you need to delete all the
    old fifos as the major number has changed (and let the rtl make
    re-create them):

      % cd /usr/src
      % mv beta10/rtl rtl
      % cd rtl
      % pwd
      /usr/src/rtl
      % rm -i /dev/rtf*

      (Alternatively there is a ulility appended to re-create fifos).

                                                    CHECK HERE WHEN OK ______

20. If you require more than 4 fifos, edit the Makefile and copy the
    lines making the fifo devices (starting mknod). I prefer fifos 0-9
    but you can leave it alone if you wish. Then make the modules:

      % make clean
      % make
      % make install

                                                    CHECK HERE WHEN OK ______

21. Initial test of the release is to insert the modules without error:

      % cd /lib/modules/2.2.10-RTL_BETA10/misc
      % insmod rtl_time.o
      % insmod rtl_sched.o
      % insmod rtl_fifo.o
      % lsmod
      Module                  Size    Used by
      rtl_fifo                6768     0  (unused)
      rtl_sched              35857     0  (unused)
      rtl_time                7348     0  [rtl_sched]

                                                    CHECK HERE WHEN OK ______

22. Try making the examples (but do not run them yet!). They should all
    make cleanly:

      % cd /usr/src/rtl
      % make examples

      % cd /usr/src/rtl/examples/compat
      % make clean
      % make

      % cd /usr/src/rtl/examples/fp
      % make clean
      % make

      % cd /usr/src/rtl/examples/frank
      % make clean
      % make

      % cd /usr/src/rtl/examples/measurement
      % make clean
      % make

      % cd /usr/src/rtl/examples/parallel
      % make clean
      % make

      % cd /usr/src/rtl/examples/regression
      % make clean
      % make

      % cd /usr/src/rtl/examples/sound
      % make clean
      % make

                                                    CHECK HERE WHEN OK ______

23. Test the examples. The makefiles are problematic at this point as
    the test targets often refer to the /usr/src/rtl/modules directory which
    is empty (the install command in note 20 moves them to the standard
    modules directory!).

    Note that some of the examples have more options than expressed here.
    These tests should verify your installation without hanging anything
    up. Should you require more detailed results, read and understand the
    code for the separate examples.

    Appended below is my rtlinux utility for inserting/removing modules.
    Make sure it is executable (chmod a+x rtlinux) and that it resides
    in some directory in your $PATH.

      % cd /usr/src/rtl/examples/compat
      % rtlinux start
      % insmod rt_process.o; ./monitor
      min: -11, max:   3
      min: -15, max:  -3
      min: -18, max:  -6
      min: -21, max:  -9
      min: -11, max: -12
      (type ctrl/C when you've seen enough)
      % rmmod rt_process

                                                    CHECK HERE WHEN OK ______

      % cd /usr/src/rtl/sound
      % insmod sound; cat linux.au > /dev/rtf0
      (you should hear Linus Torvalds voice albeit with poor clarity)

                                                    CHECK HERE WHEN OK ______

      % cd /usr/src/rtl/examples/frank
      % insmod frank_module.o; ./frank_app
      FIFO 1: Frank
      FIFO 2: Zappa
      (type ctrl/C when you've seen enough)
      % rmmod frank_module

                                                    CHECK HERE WHEN OK ______

      % cd /usr/src/rtl/examples/measurements
      % insmod rt_process.o; ./monitor
      RTL measurement module on CPU 1
      About to thread create
      created RT-thread
      min:      3616, max:      5920
      min:      3648, max:      4480
      min:      3648, max:      9376
      min:      3680, max:      5152
      min:      3616, max:      6368
      (type ctrl/C when you've seen enough)
      % rmmod rt_process
      Removing module on CPU 0

                                                    CHECK HERE WHEN OK ______

      % cd /usr/src/rtl/examples/regression
      % insmod multitask.o
      RTL multithread test  module on CPU 1
      About to thread create
      Multitask 0 task starts
      Multi task period 20000000  906792800 
      Multitask 1 task starts
      Multi task period 1000000  906850816 
      created RT-threads
      T1
      T1
      T1
      T0
      (type % rmmod multitask when you have seen enough)
      Removing module on CPU 0

                                                    CHECK HERE WHEN OK ______

      % cd /usr/src/rtl/examples/regression
      % insmod sched_test.o; ./monitor
      About to thread create
      Measurement task starts
      Measurement task period 20000000  630717984 
      created RT-thread
      (type ctrl/C when you've seen enough)
      % rmmod sched_test
      Removing module on CPU 1

                                                    CHECK HERE WHEN OK ______

      % cd /usr/src/rtl/examples/regression
      % insmod rtc_fifo_test.o; ./monitor
      Starting RTC measurement module
      Requested 8 and got 0
      MAXDIFF=0min: 32134;  max: 44907
      (type ctrl/C when you've seen enough)
      % rmmod rtc_fifo_test

                                                    CHECK HERE WHEN OK ______

      If you have an oscilliscope, check the parallel port example:
      % cd /usr/src/rtl/examples/parallel
      % insmod sched_toggle.o
      Starting parallel port module
      % rmmod sched_toggle
      % insmod rtc_toggle.o
      Starting parallel port module
      Requested 8 and got 1
      % rmmod rtc_toggle

                                                    CHECK HERE WHEN OK ______
      
24. Congratulations. RT-Linux is installed and appears to be working.

+===CUT HERE===========================+

#!/bin/sh
#
# Utility  : rtlinux
# Author   : P N Daly
# Date     : 25-June-1999, ([EMAIL PROTECTED])
# Warranty : None, use at own risk
# System   : Linux kernel v2.2.10, RT-Linux patch Beta10
# Usage    :   
#  To insert modules
#   %./rtlinux start
#  To remove modules
#   %./rtlinux stop
#  To check modules
#   %./rtlinux status
#  Note that modules in () were not present or not found

# Where are the modules
MOD_DIR=/lib/modules/2.2.10-RTL_BETA10/misc
MOD_FILE=/var/lock/subsys/rtl.modules

# See how we were called
case "$1" in
  start|insert)
        /bin/touch ${MOD_FILE}
        echo -n "Inserting RT-Linux modules: "
        if [ -f ${MOD_DIR}/rtl_time.o ] ; then
          echo -n " rtl_time"
          /sbin/insmod -f ${MOD_DIR}/rtl_time.o || echo -n " not inserted"
        fi
        if [ -f ${MOD_DIR}/rtl_fifo.o ] ; then
          echo -n " rtl_fifo"
          /sbin/insmod -f ${MOD_DIR}/rtl_fifo.o || echo -n " not inserted"
        fi
        if [ -f ${MOD_DIR}/rtl_sched.o ] ; then
          echo -n " rtl_sched"
          /sbin/insmod -f ${MOD_DIR}/rtl_sched.o || echo -n " not inserted"
        fi
        if [ -f ${MOD_DIR}/rtl_ipc.o ] ; then
          echo -n " rtl_ipc"
          /sbin/insmod -f ${MOD_DIR}/rtl_ipc.o || echo -n " not inserted"
        fi
        echo ""
        ;;
  stop|remove)
        echo -n "Removing RT-Linux modules: "
        MODINS=`/sbin/lsmod | /bin/grep rtl_ipc`
        if [ "$MODINS" ]; then
          echo -n " rtl_ipc"
          /sbin/rmmod rtl_ipc
        else
          echo -n " (rtl_ipc)"
        fi
        MODINS=`/sbin/lsmod | /bin/grep rtl_fifo`
        if [ "$MODINS" ]; then
          echo -n " rtl_fifo"
          /sbin/rmmod rtl_fifo
        else
          echo -n " (rtl_fifo)"
        fi
        MODINS=`/sbin/lsmod | /bin/grep rtl_sched`
        if [ "$MODINS" ]; then
          echo -n " rtl_sched"
          /sbin/rmmod rtl_sched
        else
          echo -n " (rtl_sched)"
        fi
        MODINS=`/sbin/lsmod | /bin/grep rtl_time`
        if [ "$MODINS" ]; then
          echo -n " rtl_time"
          /sbin/rmmod rtl_time
        else
          echo -n " (rtl_time)"
        fi
        echo ""
        rm -f ${MOD_FILE}
        ;;
  status)
        echo -n "Checking RT-Linux modules: "
        MODINS=`/sbin/lsmod | /bin/grep rtl_ipc`
        if [ "$MODINS" ]; then
          echo -n " rtl_ipc"
        else    
          echo -n " (rtl_ipc)"
        fi
        MODINS=`/sbin/lsmod | /bin/grep rtl_fifo`
        if [ "$MODINS" ]; then
          echo -n " rtl_fifo"
        else    
          echo -n " (rtl_fifo)"
        fi
        MODINS=`/sbin/lsmod | /bin/grep rtl_sched`
        if [ "$MODINS" ]; then
          echo -n " rtl_sched"
        else
          echo -n " (rtl_sched)"
        fi
        MODINS=`/sbin/lsmod | /bin/grep rtl_time`
        if [ "$MODINS" ]; then
          echo " rtl_time"
        else
          echo " (rtl_time)"
        fi
        ;;
  *)
        echo "Usage: rtlinux {start|stop|status}"
        exit 1
esac

# Exit normally
exit 0

+===CUT HERE===========================+

#!/bin/sh
#
# Utility  : mkrtf
# Author   : P N Daly
# Date     : 25-June-1999, ([EMAIL PROTECTED])
# Warranty : None, use at own risk
# System   : Linux kernel v2.2.10
# Usage    :   
#  To (re-)make the fifos for New Mexico Tech RT-Linux
#   %./mkrtf 150
#  To (re-)make the fifos for DIAPM RTAI
#   %./mkrtf 63

# edit this line for the number of fifos to create
NUM_FIFOS=10

# Delete the existing fifos
for file in /dev/rtf*
do
  echo "Removing $file"
  rm -f $file
done

# make new fifos with the supplied major number
num=0
while [ $num -le $NUM_FIFOS ]
do
  echo "Creating /dev/rtf$num with major number $1 minor number $num"
  /bin/mknod /dev/rtf$num c $1 $num
  num=`/usr/bin/expr $num + 1`
done

# Exit normally
exit 0

+===CUT HERE===========================+

#!/bin/sh
#
# Utility  : relog
# Author   : P N Daly
# Date     : 25-June-1999, ([EMAIL PROTECTED])
# Warranty : None, use at own risk
# System   : Linux kernel v2.2.10
# Usage    :   
#  To reset the system log files (/var/log/messages, /var/log/kernel)
#   %./relog

# reset the log file
unalias rm
if [ -f /var/log/messages ] ; then
  rm /var/log/messages
  /bin/touch /var/log/messages
fi

# reset the log file
if [ -f /var/log/kernel ] ; then
  rm /var/log/kernel
  /bin/touch /var/log/kernel
fi

# restart the system log daemon
kill -HUP `cat /var/run/syslogd.pid`

# exit normally 
exit 0

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

Reply via email to