?? rtlinux
字號:
#!/bin/sh## Utility : rtlinux# Author : Edgar F. Hilton# Date : Nov. 18, 1999 and Sep 18, 2000# Warranty : GPL# System : Linux 2.2.x kernels# # NOTE: # A full list of RTLinux modules must be edited into the "INSERT_LIST"# variable below in the proper sequence of insertion# insertion sequence for RTLinux modules (assume user modules will go last)RTL_MODULES_LIST=`rtl-config --modules`# usage messageusage (){ echo "USAGE: " echo " rtlinux {start|stop|status} [module(s)]" echo echo "EXAMPLES:" echo echo " To insert RTLinux only --> ./rtlinux start" echo " To remove RTLinux modules only --> ./rtlinux stop" echo " To check status of RTLinux only --> ./rtlinux status" echo " To insert RTLinux and foo{1,2}.o modules --> ./rtlinux start foo1 foo2" echo " To remove foo{1,2}.o and RTLinux modules --> ./rtlinux stop foo1 foo2" echo "To check status of RTLinux and foo{1,2}.o modules --> ./rtlinux status foo1 foo2" echo echo "Copyright 2000, Finite State Machine Labs, Inc." echo "Questions? Contact Edgar F. Hilton <efhilton@fsmlabs.com>" echo}if [ $# -eq 0 ]; then usage 1 1 exit 1else COMMAND=$1fi# binary used to insert the modulesif [ -x /sbin/modprobe ]; then MODPROBE="/sbin/modprobe -a"else MODPROBE="`which modprobe` -a" if [ ! -x $MODPROBE ]; then echo "ERROR: 'modprobe' was not found in your path" exit 1 fifiif [ -x /sbin/insmod ]; then INSMOD=/sbin/insmodelse INSMOD=`which insmod` if [ ! -x $INSMOD ]; then echo "ERROR: 'insmod' was not found in your path" exit 1 fifi# binary used to remove the modulesif [ -x /sbin/rmmod ]; then RMMOD="/sbin/rmmod -r"else RMMOD="`which rmmod` -r" if [ ! -x $RMMOD ]; then echo "ERROR: 'rmmod' was not found in your path" exit 1 fifi# binary used to list modulesif [ -x /sbin/lsmod ]; then LSMOD=/sbin/lsmodelse LSMOD=`which lsmod` if [ ! -x $LSMOD ]; then echo "ERROR: 'lsmod' was not found in your path" exit 1 fifi# path to grepGREP=`which grep`if [ ! -x $GREP ]; then echo "ERROR: 'grep' was not found in your path" exit 1fi# add the user-specified module to the insert and remove list, respectivelyUSER_INS_LIST=""TOTAL_LIST=${RTL_MODULES_LIST}if [ $# -ge 2 ] ; then shift 1 for modules in $@ do TEMP=`echo $modules | sed -e s/"\.o"$//` USER_INS_LIST="$USER_INS_LIST $TEMP.o" donefi# reverse the USER_INS_LIST to create a removal sequence for user modulesUSER_DEL_LIST=""for modules in $USER_INS_LIST; do TEMP=`echo $modules | sed -e s/"\.o"$//` USER_DEL_LIST="$TEMP $USER_DEL_LIST"doneTOTAL_LIST="${USER_DEL_LIST} ${TOTAL_LIST}"# Do the heavy work...case "$COMMAND" in start|insert) ${MODPROBE} ${RTL_MODULES_LIST} for modules in $USER_INS_LIST do ${INSMOD} $modules done $0 status ${USER_INS_LIST} ;; stop|remove) for modules in $USER_DEL_LIST do MODINS=`${LSMOD} | ${GREP} ^$modules` if [ "$MODINS" ]; then ${RMMOD} $modules fi done for modules in ${RTL_MODULES_LIST} do MODINS=`${LSMOD} | ${GREP} ^$modules` if [ "$MODINS" ]; then ${RMMOD} $modules fi done $0 status ${USER_DEL_LIST} ;; status) echo echo "Scheme: (-) not loaded, (+) loaded" for modules in $TOTAL_LIST do MODINS=`${LSMOD} | ${GREP} ^$modules` if [ "$MODINS" ]; then echo " (+) $modules " else echo " (-) $modules " fi done ;; *) usage 1 1 exit 1esac# Exit normallyechoexit 0
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -