blob: 0e3985c6da887076f2927a60719ce1e021c85e7d [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001#!/bin/bash
2#
3# Start/Stop BCM.USER
4#
5
6#
7# Set the directory path to bcm.user, or
8# allow the user to specify the path to bcm.user as the second argument when calling this script
9# (the first argument must be one of: [ start, stop ]
10#
11if [ -z $2 ]; then
12
13# Look for bcm.user, set the starting directory appropriately, or
14# simple exit if not found
15#
16if [ -f /mnt/bcm.user ]; then
17BCM_USER_BIN_DIR=/mnt/
18elif [ -f /broadcom/bcm.user ]; then
19BCM_USER_BIN_DIR=/broadcom
20elif [ -f /opt/bcm56450/bcm.user ]; then
21BCM_USER_BIN_DIR=/opt/bcm56450
22elif [ -f ./bcm.user ]; then
23BCM_USER_BIN_DIR=.
24else
25echo "cannot find bcm.user, exiting"
26exit 1
27fi
28
29else # the user may choose the starting directory directly using the second argment
30BCM_USER_BIN_DIR=$2
31fi
32
33case "$1" in
34 start)
35 echo -n "Starting bcm.user: "
36 cd ${BCM_USER_BIN_DIR}
37 lsmod | grep -q linux_user_bde > /dev/null
38 if [ "$?" == "0" ]; then
39 rmmod linux_user_bde
40 echo -n "(-user)"
41 fi
42
43 lsmod | grep -q linux_kernel_bde > /dev/null
44 if [ "$?" == "0" ]; then
45 rmmod linux_kernel_bde
46 echo -n "(-kernel)"
47 fi
48
49#
50# The linux_kernel_bde and linux_user_bde modules are loaded by the bcm.user executable
51#
52
53# Create the linux device file, if it does not already exist
54 if [ ! -c /dev/linux-user-bde ]; then
55 mknod /dev/linux-user-bde c 126 0
56 fi
57 ./bcm.user
58 echo "OK"
59 ;;
60 stop)
61 echo -n "Stopping bcm.user: "
62 pkill -f bcm.user
63 echo "OK"
64 ;;
65 restart|reload)
66 ;;
67 *)
68 echo "Usage: $0 {start|stop|restart}"
69 exit 1
70esac
71
72exit $?