Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Start/Stop Maple |
| 4 | # |
| 5 | case "$1" in |
| 6 | start) |
| 7 | echo -e "Checking if svk_init.sh calls trx_init.sh\n" |
| 8 | cd /opt/bcm68620 |
| 9 | if [ ! -e trx_init.sh ]; then |
| 10 | echo "trx_init.sh not present" && cd - && exit 1 |
| 11 | fi |
| 12 | if [ -z "`grep "./bcm_user_appl < trx_init.sh" svk_init.sh`" ]; then |
| 13 | echo "svk_init.sh does not call trx_init.sh" && cd - && exit 1 |
| 14 | elif [[ ! -z "`grep "./bcm_user_appl < trx_init.sh" svk_init.sh | grep "^\s*#\s*"`" ]]; then |
| 15 | echo "call to trx_init.sh is commented out in svk_init.sh" && cd - && exit 1 |
| 16 | fi |
| 17 | |
| 18 | echo -n "Starting MAPLE: " |
| 19 | cd /opt/bcm68620 && ./svk_init.sh --proxy 40000 |
| 20 | ;; |
| 21 | stop) |
| 22 | echo -n "Stopping Maple: " |
| 23 | pkill -f bcm_user_appl |
| 24 | if [ ! -z "`lsmod | grep -m 1 coop_dba_linux`" ]; then |
| 25 | rmmod coop_dba_linux |
| 26 | fi |
| 27 | if [ ! -z "`lsmod | grep -m 1 bcm_dev_ctrl_linux`" ]; then |
| 28 | rmmod bcm_dev_ctrl_linux |
| 29 | fi |
| 30 | if [ ! -z "`lsmod | grep -m 1 i2c_devs`" ]; then |
| 31 | rmmod i2c_devs.ko |
| 32 | fi |
| 33 | if [ ! -z "`lsmod | grep -m 1 os_linux`" ]; then |
| 34 | rmmod os_linux.ko |
| 35 | fi |
| 36 | if [ ! -z "`lsmod | grep -m 1 ll_pcie`" ]; then |
| 37 | rmmod ll_pcie.ko |
| 38 | fi |
| 39 | if [ -e /dev/maple_dev_ctrl ]; then |
| 40 | rm /dev/maple_dev_ctrl |
| 41 | fi |
| 42 | LOCK_DIR_INIT=/tmp/bcm68620_svk_init |
| 43 | LOCK_DIR_KERNEL_LOG_OWNED=/tmp/bcm68620_kernel_log_owned |
| 44 | rm -fr $LOCK_DIR_INIT |
| 45 | rm -fr $LOCK_DIR_KERNEL_LOG_OWNED |
| 46 | echo "OK" |
| 47 | ;; |
| 48 | restart|reload) |
| 49 | "$0" stop |
| 50 | "$0" start |
| 51 | ;; |
| 52 | *) |
| 53 | echo "Usage: $0 {start|stop|restart}" |
| 54 | exit 1 |
| 55 | esac |
| 56 | |
| 57 | exit $? |