>  i have to make a link of System.mapRTL20 to System.map to become "active"
> how can i configure my lilo.conf to linux and rtl maintains it's  System.map

Attached you will find a script that I call rtl_reboot ... please read
the code and the caveats/license etc. In effect, when I want to change
from RTAI to RTL or to vanilla Linux, I reboot using:

     % ./rtl_reboot linux-2.2.13
or
     % ./rtl_reboot rtai-0.9
or
     % ./rtl_reboot rtl-2.0
     
and it takes care of the symbolic links etc. This works well for me but
your mileage may vary - you'll need to arrange your directories in the
appropriate way too. Don't forget to make the script executable and,
possibly, edit the /bin/bash line at the top.

+==================================================================+
 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

#!/bin/bash
#
# rtl_reboot - reboots into another system
# Copyright (C) 2000 Philip N Daly ([EMAIL PROTECTED])
#
# This software 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.
#
# This software is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this software; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# Here is my setup:
#  VANILLA LINUX:
#    vanilla linux source is in /usr/src/linux-2.2.13
#    boot image is in           /boot/vmlinuz.linux-2.2.13
#    system map is in           /boot/System.map.linux-2.2.13
#    modules are in             /lib/modules/linux-2.2.13
#  RTAI v0.9:
#    patched linux source is in /usr/src/rtai-0.9
#    rtai source is in          /opt/rtl/rtai-0.9
#    boot image is in           /boot/vmlinuz.rtai-0.9
#    system map is in           /boot/System.map.rtai-0.9
#    modules are in             /lib/modules/rtai-0.9
#  RTL v2.0:
#    patched linux source is in /usr/src/rtl-2.0
#    rtai source is in          /opt/rtl/rtl-2.0
#    boot image is in           /boot/vmlinuz.rtl-2.0
#    system map is in           /boot/System.map.rtl-2.0
#    modules are in             /lib/modules/rtl-2.0
#
# To re-boot into vanilla linux, use:
#    % ./rtl_reboot linux-2.2.13
#   which sets:
#    /usr/src/linux      -> /usr/src/linux-2.2.13
#    /boot/vmlinuz       -> /boot/vmlinuz.linux-2.2.13
#    /boot/System.map    -> /boot/System.map.linux-2.2.13
#    /lib/modules/2.2.13 -> /lib/modules/linux-2.2.13
#
# To re-boot into RTAI v0.9, use:
#    % ./rtl_reboot rtai-0.9
#   which sets:
#    /usr/src/linux      -> /usr/src/rtai-0.9
#    /boot/vmlinuz       -> /boot/vmlinuz.rtai-0.9
#    /boot/System.map    -> /boot/System.map.rtai-0.9
#   assuming you have set EXTRAVERSION to -RTAI09 in the Makefile
#    /lib/modules/2.2.13-RTAI09 -> /lib/modules/rtai-0.9
#   else
#    /lib/modules/2.2.13 -> /lib/modules/rtai-0.9
#
# To re-boot into RTL v2.0, use:
#    % ./rtl_reboot rtl-2.0
#   which sets:
#    /usr/src/linux      -> /usr/src/rtl-2.0
#    /boot/vmlinuz       -> /boot/vmlinuz.rtl-2.0
#    /boot/System.map    -> /boot/System.map.rtl-2.0
#   assuming you have set EXTRAVERSION to -RTL20 in the Makefile
#    /lib/modules/2.2.13-RTL20 -> /lib/modules/rtl-2.0
#   else
#    /lib/modules/2.2.13 -> /lib/modules/rtl-2.0
#
# The minimal /etc/lilo.conf looks like this (edit as you see fit):
#   boot=/dev/hda
#   map=/boot/map
#   install=/boot/boot.b
#   prompt
#   timeout=30
#   default=vmlinuz
#   image=/boot/vmlinuz
#            label=vmlinuz
#            read-only
#            root=/dev/hda1
#            append="mem=256m"
# 

# check the source directory exists
LNXSRC=/usr/src/$1
if [ ! -e $LNXSRC ]; then
  RTERROR=T
  echo "Reboot error: $LNXSRC does not exist"
else
  RTERROR=F
  echo "Reboot: consistency check, $LNXSRC is OK"
fi

# check the compressed boot image exists
VMLINUZ=/boot/vmlinuz.$1
if [ ! -e $VMLINUZ ]; then
  RTERROR=T
  echo "Reboot error: $VMLINUZ does not exist"
else
  RTERROR=F
  echo "Reboot: consistency check, $VMLINUZ is OK"
fi

# check the system map exists
SYSMAP=/boot/System.map.$1
if [ ! -e $SYSMAP ]; then
  RTERROR=T
  echo "Reboot error: $SYSMAP does not exist"
else
  RTERROR=F
  echo "Reboot: consistency check, $SYSMAP is OK"
fi

# check the modules exist
MODDIR=/lib/modules/$1
if [ ! -e $MODDIR ]; then
  RTERROR=T
  echo "Reboot error: $MODDIR does not exist"
else
  RTERROR=F
  echo "Reboot: consistency check, $MODDIR is OK"
fi

# get the version for the required system
VERSION=`/bin/grep '^VERSION =' $LNXSRC/Makefile | /bin/awk '{print $3}'`
PATCHLEVEL=`/bin/grep '^PATCHLEVEL =' $LNXSRC/Makefile | /bin/awk '{print $3}'`
SUBLEVEL=`/bin/grep '^SUBLEVEL =' $LNXSRC/Makefile | /bin/awk '{print $3}'`
EXTRAVERSION=`/bin/grep '^EXTRAVERSION =' $LNXSRC/Makefile | /bin/awk '{print $3}'`
LNXVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}

# issue a message
echo "$LNXSRC is running Linux v$LNXVER"

# issue a message as required
if [ "$RTERROR" = "T" ]; then
  echo "Reboot error detected, failsafe, aborting"
  exit 0
fi

# reset the current links
/bin/rm -f /usr/src/linux
/bin/ln -sf $LNXSRC /usr/src/linux

/bin/rm -f /boot/vmlinuz
/bin/ln -sf $VMLINUZ /boot/vmlinuz

/bin/rm -f /boot/System.map
/bin/ln -sf $SYSMAP /boot/System.map

/usr/bin/find /lib/modules -type l -exec /bin/rm -f {} \;
/bin/ln -sf /lib/modules/$1 /lib/modules/$LNXVER

# reset the log files
if [ -f /var/log/messages ] ; then
  /bin/rm -f /var/log/messages
  /bin/touch /var/log/messages
fi
if [ -f /var/log/kernel ] ; then
  /bin/rm -f /var/log/kernel
  /bin/touch /var/log/kernel
fi
kill -HUP `cat /var/run/syslogd.pid`

# re-run lilo (not really necessary) and reboot as usual
/sbin/lilo
/sbin/reboot

# exit normally 
exit 0

Reply via email to