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


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


These notes pertain to kernel v2.2.10 and RT-Linux Beta11.
Decide now if you require the kernel in bz2 or gz format.
Since the beta11 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.

                                                    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 beta11 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 beta11:
        NB: The created directory is /usr/src/beta11/rtl etc!

      % cd /usr/src
      % gunzip -c beta11.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/beta11/kernel_patch > ../patch.beta11 2>&1

                                                    CHECK HERE WHEN OK ______

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

      % more ../patch.beta11
      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_BETA11 on an i686

      login:

                                                    CHECK HERE WHEN OK ______

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

      % cd /usr/src/beta11
      % 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 beta11/rtl rtl
      % cd rtl
      % pwd
      /usr/src/rtl
      % rm -i /dev/rtf*

    Optionally, remake the fifos with the mkrtf utility (appended below)
        specifying major number 150:

          % mkrtf 150

                                                    CHECK HERE WHEN OK ______

20. It is here that some people tun into problems (although they do not
        know it yet). There is a file called updateconf called by the Makefile.
        This file replaces the /usr/src/rtl/.config which is shipped as empty.
        The problem is that updateconf uses the C pre-processor (cpp) and the
        update fails if the executable is not in your path. The usual place for
        the cpp file is /lib/cpp and I edit the updatecong file to reflect this:

          % cd /usr/src/rtl/misc
          % mv updateconf updateconf.original
          % sed '1,$s?cpp?/lib/cpp?g' updateconf.original > updateconf

    You can check if it works by running it there and then:

          % chmod a+x updateconf
          % ./updateconf
          % more .config
          CONFIG_RTL_FP_SUPPORT=y
          CONFIG_RTL_USE_TSC=y
          CONFIG_RTL_USE_8254_TIMER=y
          CONFIG_RTL_USE_APIC_TIMER=y

                                                    CHECK HERE WHEN OK ______

21. 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 examples
      % make clean
      % make
      % make install

                                                    CHECK HERE WHEN OK ______

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

      % cd /lib/modules/2.2.10-RTL_BETA11/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 ______

23. Try making the examples (but do not run them yet!):

          % 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 ______

24. 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!).

        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. Also after running a test, check the
        output in /var/log/messages and/or /var/log/kernel.

        NB: None of these tests should hang the sytem!

          % rtlinux start

      % cd /usr/src/rtl/examples/compat
          % insmod rt_process.o; ./monitor
            (ctrl/C when you've seen enough)
          % rmmod rt_process

          % cd /usr/src/rtl/examples/frank
          % insmod frank_module.o; ./frank_app
            (ctrl/C when you've seen enough)
          % rmmod frank_module

          % cd /usr/src/rtl/examples/measurements
          % insmod rt_process.o; ./monitor
            (ctrl/C when you've seen enough)
          % rmmod rt_process

          % cd /usr/src/rtl/examples/regression
          % insmod multitask.o
            (ctrl/C when you've seen enough)
          % rmmod multitask
          % insmod rtc_test.o
            (ctrl/C when you've seen enough)
          % rmmod rtc_test
          % insmod rtc_fifo_test.o; ./monitor
            (ctrl/C when you've seen enough)
          % rmmod rtc_fifo_test

          % cd /usr/src/rtl/examples/sound
          % insmod sound.o
          % cat linux.au > /dev/rtf0
          % rmmod sound

        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

25. Congratulations. RT-Linux is installed and appears to be working.

Phil Daly, NOAO/AURA, 950 N. Cherry Avenue, Tucson AZ 85719, U S A
E-mail: [EMAIL PROTECTED]  V-mail: (520) 318 8438  Fax: (520) 318 8360


+===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 Beta11
# 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_BETA11/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